home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / contol32 / part01 < prev    next >
Encoding:
Text File  |  1992-03-04  |  55.0 KB  |  1,676 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!think.com!mips!msi!dcmartin
  3. From: chuck@trantor.harris-atd.com (Chuck Musciano)
  4. Subject: v16i086: Contool 3.2, Part01/05
  5. Message-ID: <1992Mar5.192238.3984@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. Date: Thu, 5 Mar 1992 19:22:38 GMT
  10. Approved: dcmartin@msi.com
  11.  
  12. Submitted-by: chuck@trantor.harris-atd.com (Chuck Musciano)
  13. Posting-number: Volume 16, Issue 86
  14. Archive-name: contool-3.2/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 5)."
  23. # Contents:  README Makefile filters.c icons images place_dialog.c
  24. # Wrapped by dcmartin@fascet on Sat Feb 22 10:11:09 1992
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'README' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'README'\"
  28. else
  29. echo shar: Extracting \"'README'\" \(9604 characters\)
  30. sed "s/^X//" >'README' <<'END_OF_FILE'
  31. X/************************************************************************/
  32. X/*    Copyright 1988-1990 by Chuck Musciano and Harris Corporation    */
  33. X/*                                    */
  34. X/*    Permission to use, copy, modify, and distribute this software    */
  35. X/*    and its documentation for any purpose and without fee is    */
  36. X/*    hereby granted, provided that the above copyright notice    */
  37. X/*    appear in all copies and that both that copyright notice and    */
  38. X/*    this permission notice appear in supporting documentation, and    */
  39. X/*    that the name of Chuck Musciano and Harris Corporation not be    */
  40. X/*    used in advertising or publicity pertaining to distribution    */
  41. X/*    of the software without specific, written prior permission.    */
  42. X/*    Chuck Musciano and Harris Corporation make no representations    */
  43. X/*    about the suitability of this software for any purpose.  It is    */
  44. X/*    provided "as is" without express or implied warranty.  This     */
  45. X/*    software may not be sold without the prior explicit permission    */
  46. X/*    of Harris Corporation.                        */
  47. X/************************************************************************/
  48. X
  49. X     Contool Version 3.2
  50. X     
  51. X     Contool will capture and display system console messages with timestamps.
  52. XIt is a replacement for the standard Sun console, which is created with 
  53. X"cmdtool -C".  Contool will flash its icon and beep when messages are written
  54. Xto the icon, so you can keep it closed on your desktop until a message arrives.
  55. XYou can modify this beeping and flashing behavior; see the man page for more
  56. Xdetails.
  57. X
  58. X     You can instruct contool to filter and ignore certain common console
  59. Xmessages.  The man page explains how to create a file of filters in 
  60. Xcan modify this to suit yourself, and copy it to ~/.contool.
  61. X
  62. X     This version of contool will only work with Open Windows 2.0, from Sun,
  63. Xor the XView 2.0 libraries available via anonymous FTP from expo.lcs.mit.edu.
  64. XIn either case, obviously, you'll need to be running some version of X Windows.
  65. X
  66. X     There are no plans to produce a SunView version of contool 3.0.
  67. X     
  68. X     Before building contool, you need to check several site dependencies
  69. Xin the Makefile.  These dependencies are:
  70. X
  71. X    In Makefile:
  72. X        BIN        Where the executable will go, normally
  73. X                /usr/local/bin
  74. X
  75. X        MANDIR        Where the man page will go, normally
  76. X                /usr/man/manl
  77. X
  78. X        MANEXT        The man page extension, usually 'l',
  79. X                for local man pages.  You may want to
  80. X                make MANDIR /usr/man/man1, in which case
  81. X                MANEXT should be '1'.
  82. X
  83. X        HELPDIR        Where the context-sensitive help file
  84. X                will be stored.
  85. X
  86. X        MAILER        The full path of your system mailer.
  87. X
  88. X        ICON_PATH    Path to search (at runtime) for other
  89. X                icon files.  This path will only be used
  90. X                if the user does not have the ICON_PATH
  91. X                environment variable defined.  Should
  92. X                consist of a various directories
  93. X                separated by colons.
  94. X
  95. X        OPENWINHOME    Where you installed Open Windows.
  96. X                Alternately, where you installed the
  97. X                XView toolkit shipped with X11R4.  Must
  98. X                be a directory with a child directory
  99. X                named "include" which contains X and
  100. X                XView include files.
  101. X
  102. X        LDFLAGS        Where ld can find your XView libraries.
  103. X                If you compile with Open Windows, the
  104. X                default value should be correct.  If you
  105. X                are using the X11 XView libraries, you
  106. X                may need to modify this value.
  107. X
  108. X        CPPFLAGS    Where cpp can find your XView include
  109. X                files.  If you compile with Open Windows,
  110. X                the default value should be correct.  If
  111. X                you are using the X11 XView toolkit, you
  112. X                may need to modify this value.
  113. X
  114. XOnce you have adjusted these values, just type "make contool" or "make
  115. Xinstall".  
  116. X
  117. X     Contool honors window command line options, described in xview(1),
  118. Xso you can change the default window size, icon position, etc.  We like
  119. Xto bring contool up closed, using "-Wi".
  120. X
  121. X     Fun with sounds: if your machine can play sounds, you can use the
  122. X"Execute command with message" feature to produce all sorts of audible
  123. Xsignals when messages arrive.  Ellery Chan here at Harris found a nifty
  124. Xuse of sound: he plays the sound /usr/demo/SOUND/sounds/splat.au as the
  125. Xdefault action when a message arrives, and has the window open.  When a
  126. Xmessage arrives, he gets a satisfying "splat!" sound and contool appears
  127. Xon his screen.  If you are running on a SPARCstation (or otherwise have
  128. Xa copy of splat.au for your machine) give it a try.
  129. X
  130. X     Comments, bugs, to me, please.  I would be very interested in your 
  131. Ximpressions of contool and any suggestions you might have to make it better.
  132. XBy the way, there are a few convenient untility routines in misc.c you might
  133. Xfind useful in other programs you are writing.
  134. X
  135. XChuck Musciano
  136. XAdvanced Technology Department
  137. XHarris Corporation
  138. XPO Box 37, MS 3A/1912
  139. XMelbourne, FL 32902
  140. X(407) 727-6131
  141. XARPA: chuck@trantor.harris-atd.com
  142. X
  143. X******************************** KNOWN XVIEW BUG ********************************
  144. X*                                        *
  145. X*      It is a known bug in XView that if you bring up a dialog box with the    *
  146. X* pushpin out (the default) and display a menu without selecting an item from    *
  147. X* the menu, the dialog box will be closed.  This can be demonstrated in contool    *
  148. X* by bringing up the edit filters window, and displaying the "edit" menu     *
  149. X* without selecting an action.                            *
  150. X*                                        *
  151. X*      This bug has been reported to Sun, but will not be fixed until version    *
  152. X* 3.0 of XView.                                    *
  153. X*                                        *
  154. X*********************************************************************************
  155. X
  156. X*********************************************************************************
  157. X*                Change history                    *
  158. X*********************************************************************************
  159. X
  160. X         1.0    20 Jun 88    Original release
  161. X         1.1    30 Jun 88    Added -p option to pop open when messages
  162. X                        arrive.  Suggested by Doug Lind
  163. X                        (lind@perron.ms.washington.edu).
  164. X                     Added alternate icon sets for more attractive
  165. X                        appearance when messages arrive.  Alternate
  166. X                        set two is from David Eckelcamp 
  167. X                        (eckelcamp@mcc.com).
  168. X                     Cleaned up Makefile.  Again, courtesy of
  169. X                        David Eckelcamp.
  170. X    2.0    23 Aug 88    Added automatic reload of filters when
  171. X                   filter file is modified.  Suggested by
  172. X                   Craig Musicant (cmusican@stanford.prime.com).
  173. X                Filter strings are now regular expressions.
  174. X                   Provided by jqj@hogg.cc.uoregon.edu.
  175. X                Reworked frame menu, based upon diffs posted
  176. X                   to sun-source@titan.rice.edu.
  177. X                Added protection from overflowing the text edit
  178. X                   window when too many messages arrive.
  179. X                Filters can now be read from any file, not
  180. X                   just ~/.contool.
  181. X    2.1    10 Feb 89    Added logging capability, courtesy of
  182. X                   Gregory Bond (gnb@melba.bby.oz.au).
  183. X    2.2    19 Sep 89    Added filter editing.
  184. X                Added icon pathname completion, courtesy of
  185. X                   Mike Arms (sandia!marms@unmvax.cs.unm.edu).
  186. X                Added moving the blinking icon to the front,
  187. X                   courtesy of Peter Lennevi
  188. X                   (etxlevi@solsta.ericsson.se).
  189. X                Changed icon loading to use ICON_PATH, and
  190. X                   supported ~ expansion, suggested by
  191. X                   Larry Virden (osu-cis!chemabs!lwv27).
  192. X                Fixed multiple message alert handling,
  193. X                   as suggested by Ellery Chan
  194. X                   (ellery@trantor.harris-atd.com).
  195. X    3.0     6 Jun 90    Ported to XView toolkit, running under
  196. X                   Open Windows 2.0.
  197. X                Reworked interface to be OPEN LOOK
  198. X                   compliant.
  199. X                Added saving of default actions to
  200. X                   filter file.
  201. X                Removed large number of command line
  202. X                   options in lieu of properties
  203. X                   dialog box.
  204. X                Added ability to associate a command
  205. X                   to be executed when a message arrives.
  206. X                Added explicit filter reset capability.
  207. X                Added the ability to print the contents
  208. X                   of the console.  Suggested by 
  209. X                   Danielle Heinzer
  210. X                   (ESC1298%ESOC.BITNET@cunyvm.cuny.edu).
  211. X                Reworked console overflow handling,
  212. X                   courtesy of Matt Cohen
  213. X                   (sysnmc@magic706.chron.com).
  214. X    3.0a    18 Oct 90    Allowed reading of 1.0 filter files.
  215. X                Fixed handling of custom default icon
  216. X                   when blinking stops.
  217. X                Tweaked Makefile slightly.
  218. X                Fixed handling of dialog boxes under
  219. X                   window managers other than olwm.
  220. X                Add Imakefile.
  221. X    3.0b     1 Nov 90    Fixed "tiny icon" bug.
  222. X                Added "About contool..." dialog.
  223. X                Source restructuring for maintainability.
  224. X    3.0c    15 Jan 91    Added -n option to prevent console
  225. X                   acquisition on startup.
  226. X                Fixed bugs in send mail dialog.
  227. X                Changed send mail "Cancel" to close window.
  228. X                Updated help for "File" button.
  229. X                Dialogs no longer come up clipped by the
  230. X                   bottom of the screen.
  231. X    3.1    24 May 91    Added syntax to support control characters
  232. X                   in filters.
  233. X                Reworked handling of "Other:" mail address.
  234. X                Added filter versions.
  235. X                Missing end patterns are now flagged.
  236. X                Contool now sets its class and name hints.
  237. X                Sending SIGUSR1 (30) to contool stops blinking,
  238. X                   suggested by Frank Peters.
  239. X                Sending SIGHUP (1) closes and reopens the log
  240. X                   file.
  241. X                Added "Apply and Save" button to filter dialog.
  242. X                Added individual message logging.
  243. X                Finally fixed overflow handling.
  244. X                Added multi-line filter timeout.
  245. X    3.1a    24 Jul 91    Added support for WIN_CMDLINE attribute,
  246. X                   from Tomas Stephanson
  247. X                   (Tomas.Stephanson@eua.ericsson.se)
  248. X                Fixed handling of messages without trailing
  249. X                   newlines, suggested by Ellery Chan
  250. X                   (ellery@trantor.harris-atd.com)
  251. X                Fixed typos in the man page
  252. X    3.2    16 Oct 91    Added -i option to allow reading messages
  253. X                   from other sources.
  254. X                Fixed minor error in abend() code.
  255. X                Fixed bug in masking alternative icons.
  256. X                Added message archiving.
  257. X                Added -f option to make contool fork after acquiring 
  258. X                   the console.
  259. END_OF_FILE
  260. if test 9604 -ne `wc -c <'README'`; then
  261.     echo shar: \"'README'\" unpacked with wrong size!
  262. fi
  263. # end of 'README'
  264. fi
  265. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  266.   echo shar: Will not clobber existing file \"'Makefile'\"
  267. else
  268. echo shar: Extracting \"'Makefile'\" \(11111 characters\)
  269. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  270. X# Makefile generated by imake - do not edit!
  271. X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  272. X#
  273. X# The cpp used on this machine replaces all newlines and multiple tabs and
  274. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  275. X# for this, but is not always successful.
  276. X#
  277. X
  278. X# -------------------------------------------------------------------------
  279. X# Makefile generated from "Imake.tmpl" and <Imakefile>
  280. X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  281. X#
  282. X# Platform-specific parameters may be set in the appropriate <vendor>.cf
  283. X# configuration files.  Site-specific parameters should be set in the file
  284. X# site.def.  Full rebuilds are recommended if any parameters are changed.
  285. X#
  286. X# If your C preprocessor does not define any unique symbols, you will need
  287. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  288. X# "make World" the first time).
  289. X#
  290. X
  291. X# -------------------------------------------------------------------------
  292. X# site-specific configuration parameters that need to come before
  293. X# the platform-specific parameters - edit site.def to change
  294. X
  295. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  296. X
  297. X# -------------------------------------------------------------------------
  298. X# platform-specific configuration parameters - edit sun.cf to change
  299. X
  300. X# platform:  $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
  301. X
  302. X# operating system:  SunOS 4.1.1
  303. X
  304. X# $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
  305. X
  306. X# -------------------------------------------------------------------------
  307. X# site-specific configuration parameters that go after
  308. X# the platform-specific parameters - edit site.def to change
  309. X
  310. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  311. X
  312. X            SHELL = /bin/sh
  313. X
  314. X              TOP = .
  315. X      CURRENT_DIR = .
  316. X
  317. X               AR = ar clq
  318. X  BOOTSTRAPCFLAGS =
  319. X               CC = cc
  320. X               AS = as
  321. X
  322. X         COMPRESS = compress
  323. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  324. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  325. X          INSTALL = install
  326. X               LD = ld
  327. X             LINT = lint
  328. X      LINTLIBFLAG = -C
  329. X         LINTOPTS = -axz
  330. X               LN = ln -s
  331. X             MAKE = make
  332. X               MV = mv
  333. X               CP = cp
  334. X
  335. X           RANLIB = ranlib
  336. X  RANLIBINSTFLAGS =
  337. X
  338. X               RM = rm -f
  339. X            TROFF = psroff
  340. X         MSMACROS = -ms
  341. X              TBL = tbl
  342. X              EQN = eqn
  343. X     STD_INCLUDES =
  344. X  STD_CPP_DEFINES =
  345. X      STD_DEFINES =
  346. X EXTRA_LOAD_FLAGS =
  347. X  EXTRA_LIBRARIES =
  348. X             TAGS = ctags
  349. X
  350. X    SHAREDCODEDEF = -DSHAREDCODE
  351. X         SHLIBDEF = -DSUNSHLIB
  352. X
  353. X    PROTO_DEFINES =
  354. X
  355. X     INSTPGMFLAGS =
  356. X
  357. X     INSTBINFLAGS = -m 0755
  358. X     INSTUIDFLAGS = -m 4755
  359. X     INSTLIBFLAGS = -m 0644
  360. X     INSTINCFLAGS = -m 0444
  361. X     INSTMANFLAGS = -m 0444
  362. X     INSTDATFLAGS = -m 0444
  363. X    INSTKMEMFLAGS = -m 4755
  364. X
  365. X      PROJECTROOT = /usr/X11/R5
  366. X
  367. X     TOP_INCLUDES = -I$(INCROOT)
  368. X
  369. X      CDEBUGFLAGS = -O
  370. X        CCOPTIONS = -pipe
  371. X
  372. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  373. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  374. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  375. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  376. X
  377. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  378. X
  379. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  380. X
  381. X   LDCOMBINEFLAGS = -X -r
  382. X      DEPENDFLAGS =
  383. X
  384. X        MACROFILE = sun.cf
  385. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  386. X
  387. X    IMAKE_DEFINES =
  388. X
  389. X         IRULESRC = $(CONFIGDIR)
  390. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  391. X
  392. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  393. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  394. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  395. X
  396. X# -------------------------------------------------------------------------
  397. X# X Window System Build Parameters
  398. X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  399. X
  400. X# -------------------------------------------------------------------------
  401. X# X Window System make variables; this need to be coordinated with rules
  402. X
  403. X          PATHSEP = /
  404. X        USRLIBDIR = /usr/X11/R5/lib
  405. X           BINDIR = /usr/X11/R5/bin
  406. X          INCROOT = /usr/X11/R5/include
  407. X     BUILDINCROOT = $(TOP)
  408. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  409. X      BUILDINCTOP = ..
  410. X           INCDIR = $(INCROOT)/X11
  411. X           ADMDIR = /usr/adm
  412. X           LIBDIR = $(USRLIBDIR)/X11
  413. X        CONFIGDIR = $(LIBDIR)/config
  414. X       LINTLIBDIR = $(USRLIBDIR)/lint
  415. X
  416. X          FONTDIR = $(LIBDIR)/fonts
  417. X         XINITDIR = $(LIBDIR)/xinit
  418. X           XDMDIR = $(LIBDIR)/xdm
  419. X           TWMDIR = $(LIBDIR)/twm
  420. X          MANPATH = /usr/X11/R5/man
  421. X    MANSOURCEPATH = $(MANPATH)/man
  422. X        MANSUFFIX = n
  423. X     LIBMANSUFFIX = 3
  424. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  425. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  426. X           NLSDIR = $(LIBDIR)/nls
  427. X        PEXAPIDIR = $(LIBDIR)/PEX
  428. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  429. X       FONTCFLAGS = -t
  430. X
  431. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  432. X
  433. X            IMAKE = imake
  434. X           DEPEND = makedepend
  435. X              RGB = rgb
  436. X
  437. X            FONTC = bdftopcf
  438. X
  439. X        MKFONTDIR = mkfontdir
  440. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  441. X
  442. X        CONFIGSRC = $(TOP)/config
  443. X       DOCUTILSRC = $(TOP)/doc/util
  444. X        CLIENTSRC = $(TOP)/clients
  445. X          DEMOSRC = $(TOP)/demos
  446. X           LIBSRC = $(TOP)/lib
  447. X          FONTSRC = $(TOP)/fonts
  448. X       INCLUDESRC = $(TOP)/X11
  449. X        SERVERSRC = $(TOP)/server
  450. X          UTILSRC = $(TOP)/util
  451. X        SCRIPTSRC = $(UTILSRC)/scripts
  452. X       EXAMPLESRC = $(TOP)/examples
  453. X       CONTRIBSRC = $(TOP)/../contrib
  454. X           DOCSRC = $(TOP)/doc
  455. X           RGBSRC = $(TOP)/rgb
  456. X        DEPENDSRC = $(UTILSRC)/makedepend
  457. X         IMAKESRC = $(CONFIGSRC)
  458. X         XAUTHSRC = $(LIBSRC)/Xau
  459. X          XLIBSRC = $(LIBSRC)/X
  460. X           XMUSRC = $(LIBSRC)/Xmu
  461. X       TOOLKITSRC = $(LIBSRC)/Xt
  462. X       AWIDGETSRC = $(LIBSRC)/Xaw
  463. X       OLDXLIBSRC = $(LIBSRC)/oldX
  464. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  465. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  466. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  467. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  468. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  469. X         FSLIBSRC = $(FONTSRC)/lib/fs
  470. X    FONTSERVERSRC = $(FONTSRC)/server
  471. X     EXTENSIONSRC = $(TOP)/extensions
  472. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  473. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  474. X
  475. X# $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
  476. X
  477. XSHLIBLDFLAGS = -assert pure-text
  478. XPICFLAGS = -pic
  479. X
  480. X  DEPEXTENSIONLIB =
  481. X     EXTENSIONLIB = -lXext
  482. X
  483. X          DEPXLIB = $(DEPEXTENSIONLIB)
  484. X             XLIB = $(EXTENSIONLIB) -lX11
  485. X
  486. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  487. X           XMULIB = -lXmu
  488. X
  489. X       DEPOLDXLIB =
  490. X          OLDXLIB = -loldX
  491. X
  492. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  493. X         XTOOLLIB = -lXt
  494. X
  495. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  496. X           XAWLIB = -lXaw
  497. X
  498. X        DEPXILIB =
  499. X           XILIB = -lXi
  500. X
  501. X        SOXLIBREV = 4.10
  502. X          SOXTREV = 4.10
  503. X         SOXAWREV = 5.0
  504. X        SOOLDXREV = 4.10
  505. X         SOXMUREV = 4.10
  506. X        SOXEXTREV = 4.10
  507. X      SOXINPUTREV = 4.10
  508. X
  509. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  510. X         XAUTHLIB =  -lXau
  511. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  512. X         XDMCPLIB =  -lXdmcp
  513. X
  514. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  515. X           PHIGSLIB =  -lphigs
  516. X
  517. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  518. X          XBSDLIB =  -lXbsd
  519. X
  520. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  521. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  522. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  523. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  524. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  525. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  526. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  527. X
  528. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  529. X
  530. X         DEPLIBS1 = $(DEPLIBS)
  531. X         DEPLIBS2 = $(DEPLIBS)
  532. X         DEPLIBS3 = $(DEPLIBS)
  533. X
  534. X# -------------------------------------------------------------------------
  535. X# Imake rules for building libraries, programs, scripts, and data files
  536. X# rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  537. X
  538. X# -------------------------------------------------------------------------
  539. X# start of Imakefile
  540. X
  541. XOPENWINHOME    = /usr/openwin
  542. X
  543. XHELPDIR        = /usr/local/lib/help
  544. X
  545. XMAILER        = /usr/ucb/mail
  546. X
  547. XLOCAL_LIBRARIES = -lxview -lolgx $(XLIB)
  548. X
  549. XLDOPTIONS    = -L$(OPENWINHOME)/lib
  550. X
  551. XCPPFLAGS    = -I$(OPENWINHOME)/include
  552. X
  553. XCFLAGS        = -O -DMAILER=\"$(MAILER)\"
  554. X
  555. XEXTRA_INCLUDES    = -I$(OPENWINHOME)/include
  556. X
  557. XSRCS        = about.c archive.c busy.c contool.c contool_ui.c error.c expand.c filename_completion.c \
  558. X          filters.c getopt.c load.c load_icon.c logging.c misc.c parse.y \
  559. X          pinned_menu_notify.c place_dialog.c props.c regexp.c send_mail.c store.c
  560. X
  561. XOBJS        = about.o archive.o busy.o contool.o contool_ui.o error.o expand.o filename_completion.o \
  562. X          filters.o getopt.o load.o load_icon.o logging.o misc.o parse.o \
  563. X          pinned_menu_notify.o place_dialog.o props.o regexp.o send_mail.o store.o
  564. X
  565. X PROGRAM = contool
  566. X
  567. Xall:: contool
  568. X
  569. Xcontool: $(OBJS) $(DEPLIBS)
  570. X    $(RM) $@
  571. X    $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  572. X
  573. Xsaber_contool:: $(SRCS)
  574. X    # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  575. X
  576. Xosaber_contool:: $(OBJS)
  577. X    # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  578. X
  579. Xinstall:: contool
  580. X    @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
  581. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
  582. X    $(INSTALL) -c $(INSTPGMFLAGS)  contool $(DESTDIR)$(BINDIR)
  583. X
  584. Xinstall.man:: contool.man
  585. X    @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  586. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  587. X    $(INSTALL) -c $(INSTMANFLAGS) contool.man $(DESTDIR)$(MANDIR)/contool.$(MANSUFFIX)
  588. X
  589. Xdepend::
  590. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  591. X
  592. Xlint:
  593. X    $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  594. Xlint1:
  595. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  596. X
  597. Xclean::
  598. X    $(RM) $(PROGRAM)
  599. X
  600. Xinstall: install.man install.help
  601. X
  602. Xinstall.help:
  603. X    $(INSTALL) -c $(INSTMANFLAGS) contool.info $(HELPDIR)/contool.info
  604. X
  605. X# -------------------------------------------------------------------------
  606. X# common rules for all Makefiles - do not edit
  607. X
  608. Xemptyrule::
  609. X
  610. Xclean::
  611. X    $(RM_CMD) "#"*
  612. X
  613. XMakefile::
  614. X    -@if [ -f Makefile ]; then set -x; \
  615. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  616. X    else exit 0; fi
  617. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  618. X
  619. Xtags::
  620. X    $(TAGS) -w *.[ch]
  621. X    $(TAGS) -xw *.[ch] > TAGS
  622. X
  623. Xsaber:
  624. X    # load $(ALLDEFINES) $(SRCS)
  625. X
  626. Xosaber:
  627. X    # load $(ALLDEFINES) $(OBJS)
  628. X
  629. X# -------------------------------------------------------------------------
  630. X# empty rules for directories that do not have SUBDIRS - do not edit
  631. X
  632. Xinstall::
  633. X    @echo "install in $(CURRENT_DIR) done"
  634. X
  635. Xinstall.man::
  636. X    @echo "install.man in $(CURRENT_DIR) done"
  637. X
  638. XMakefiles::
  639. X
  640. Xincludes::
  641. X
  642. X# -------------------------------------------------------------------------
  643. X# dependencies generated by makedepend
  644. X
  645. END_OF_FILE
  646. if test 11111 -ne `wc -c <'Makefile'`; then
  647.     echo shar: \"'Makefile'\" unpacked with wrong size!
  648. fi
  649. # end of 'Makefile'
  650. fi
  651. if test -f 'filters.c' -a "${1}" != "-c" ; then 
  652.   echo shar: Will not clobber existing file \"'filters.c'\"
  653. else
  654. echo shar: Extracting \"'filters.c'\" \(28125 characters\)
  655. sed "s/^X//" >'filters.c' <<'END_OF_FILE'
  656. X/************************************************************************/
  657. X/*    Copyright 1987-1991 by Chuck Musciano and Harris Corporation     */
  658. X/*                                    */
  659. X/*    Full ownership of this software, and all rights pertaining to     */
  660. X/*    the for-profit distribution of this software, are retained by     */
  661. X/*    Chuck Musciano and Harris Corporation.  You are permitted to     */
  662. X/*    use this software without fee.  This software is provided "as     */
  663. X/*    is" without express or implied warranty.  You may redistribute     */
  664. X/*    this software, provided that this copyright notice is retained,    */
  665. X/*    and that the software is not distributed for profit.  If you     */
  666. X/*    wish to use this software in a profit-making venture, you must     */
  667. X/*    first license this code and its underlying technology from     */
  668. X/*    Harris Corporation.                         */
  669. X/*                                    */
  670. X/*    Bottom line: you can have this software, you can use it, you     */
  671. X/*    can give it away.  You just can't sell any or all parts of it     */
  672. X/*    without prior permission from Harris Corporation.         */
  673. X/************************************************************************/
  674. X
  675. X/************************************************************************/
  676. X/*                                    */
  677. X/*    filters.c    contool filters dialog manager            */
  678. X/*                                    */
  679. X/************************************************************************/
  680. X
  681. X#include    <stdio.h>
  682. X#include    <sys/param.h>
  683. X#include    <sys/types.h>
  684. X#include    <xview/xview.h>
  685. X#include    <xview/panel.h>
  686. X#include    <xview/notice.h>
  687. X#include    <xview/xv_xrect.h>
  688. X
  689. X#include    "manifest.h"
  690. X#include    "contool.h"
  691. X#include    "contool_ui.h"
  692. X
  693. XEXPORT    Filter    *filters = NULL;
  694. X
  695. XPUBLIC    contool_base_objects    *contool_base;
  696. X
  697. XPRIVATE    short    single_bits[] = {
  698. X#include    "images/single.icon"
  699. X              };
  700. X
  701. XPRIVATE    short    range_bits[] = {
  702. X#include    "images/range.icon"
  703. X              };
  704. X
  705. XPRIVATE    short    empty_bits[] = {
  706. X#include    "images/empty.icon"
  707. X              };
  708. X
  709. XPRIVATE    Filter    *edit_set = NULL, *clipboard = NULL;
  710. XPRIVATE    contool_filters_objects    *contool_filters = NULL;
  711. XPRIVATE    Server_image    single, range, empty;
  712. X
  713. X/************************************************************************/
  714. XPRIVATE    int    selection_count()
  715. X
  716. X{    int    i, s, total;
  717. X
  718. X    total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  719. X    for (i = s = 0; i < total; i++)
  720. X       if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i))
  721. X          s++;
  722. X    return(s);
  723. X}
  724. X
  725. X/************************************************************************/
  726. XPRIVATE    int    curr_selection()
  727. X
  728. X{    int    i, total;
  729. X
  730. X    for (i = 0, total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS); i < total; i++)
  731. X       if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i))
  732. X          break;
  733. X    if (i >= total)
  734. X       fprintf(stderr, "No item selected!\n");
  735. X    return(i);
  736. X}
  737. X
  738. X/************************************************************************/
  739. XPRIVATE    Filter    *duplicate_filter(f)
  740. X
  741. XFilter    *f;
  742. X
  743. X{    Filter    *new;
  744. X
  745. X    new = (Filter *) malloc(sizeof(Filter));
  746. X    *new = *f;
  747. X    new->start = strsave(f->start);
  748. X    new->stop = strsave(f->stop);
  749. X    compile_exp(new, new->start, new->stop);
  750. X    new->command = strsave(f->command);
  751. X    new->comment = strsave(f->comment);
  752. X    new->next = NULL;
  753. X    return(new);
  754. X}
  755. X
  756. X/************************************************************************/
  757. XPRIVATE    Filter    *duplicate_list(list)
  758. X
  759. XFilter    *list;
  760. X
  761. X{    Filter    *f, *head = NULL, *curr;
  762. X
  763. X    for (f = list; f; f = f->next)
  764. X       if (head == NULL)
  765. X          head = curr = duplicate_filter(f);
  766. X       else {
  767. X          curr->next = duplicate_filter(f);
  768. X          curr = curr->next;
  769. X          }
  770. X    return(head);
  771. X}
  772. X
  773. X/************************************************************************/
  774. XPRIVATE    free_filter(f)
  775. X
  776. XFilter    *f;
  777. X
  778. X{
  779. X    cond_free(f->start);
  780. X    cond_free(f->start_re);
  781. X    cond_free(f->stop);
  782. X    cond_free(f->stop_re);
  783. X    cond_free(f->command);
  784. X    cond_free(f->comment);
  785. X    free(f);
  786. X}
  787. X
  788. X/************************************************************************/
  789. XEXPORT    free_list(list)
  790. X
  791. XFilter    *list;
  792. X
  793. X{    Filter    *next;
  794. X
  795. X    for ( ; list; list = next) {
  796. X       next = list->next;
  797. X       free_filter(list);
  798. X       }
  799. X}
  800. X
  801. X/************************************************************************/
  802. XPRIVATE    update_controls()
  803. X
  804. X{    Filter    *f;
  805. X    int    i;
  806. X
  807. X    if (selection_count() == 1) {
  808. X       for (f = edit_set, i = 0; f; f = f->next, i++)
  809. X          if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i))
  810. X             break;
  811. X       if (f == NULL) {
  812. X          error("Internal error: filters do not match scrolling list!");
  813. X          return;
  814. X          }
  815. X       xv_set(contool_filters->filter_update, PANEL_INACTIVE, FALSE, NULL);
  816. X       xv_set(contool_filters->filter_type, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->stop? 1 : 0, NULL);
  817. X       xv_set(contool_filters->start, PANEL_INACTIVE, FALSE, PANEL_VALUE, is_null(f->start), NULL);
  818. X       xv_set(contool_filters->stop, PANEL_INACTIVE, f->stop == NULL, PANEL_VALUE, is_null(f->stop), NULL);
  819. X       xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, f->stop == NULL, PANEL_VALUE, f->timeout, NULL);
  820. X       xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, f->stop == NULL, NULL);
  821. X       xv_set(contool_filters->comment, PANEL_INACTIVE, FALSE, PANEL_VALUE, is_null(f->comment), NULL);
  822. X       xv_set(contool_filters->ignore, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->save? 0 : 1, NULL);
  823. X       if (f->save) {
  824. X          i = 0;
  825. X          if (f->beep) {
  826. X             i |= BEEP_BIT;
  827. X             xv_set(contool_filters->filter_beep_count, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->beep, NULL);
  828. X             xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, FALSE, NULL);
  829. X             }
  830. X          else {
  831. X             xv_set(contool_filters->filter_beep_count, PANEL_INACTIVE, TRUE, NULL);
  832. X             xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, TRUE, NULL);
  833. X             }
  834. X          if (f->command) {
  835. X             i |= COMMAND_BIT;
  836. X             xv_set(contool_filters->filter_command, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->command, NULL);
  837. X             xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, FALSE, NULL);
  838. X             }
  839. X          else
  840. X             xv_set(contool_filters->filter_command, PANEL_INACTIVE, TRUE, NULL);
  841. X          if (f->flash)
  842. X             i |= FLASH_BIT;
  843. X          if (f->log)
  844. X             i |= LOG_BIT;
  845. X          if (f->open)
  846. X             i |= OPEN_BIT;
  847. X          if (f->stamp)
  848. X             i |= STAMP_BIT;
  849. X          xv_set(contool_filters->action, PANEL_INACTIVE, FALSE, PANEL_VALUE, i, NULL);
  850. X          }
  851. X       else {
  852. X          xv_set(contool_filters->action, PANEL_INACTIVE, TRUE, NULL);
  853. X          xv_set(contool_filters->filter_beep_count, PANEL_INACTIVE, TRUE, NULL);
  854. X          xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, TRUE, NULL);
  855. X          xv_set(contool_filters->filter_command, PANEL_INACTIVE, TRUE, NULL);
  856. X          }
  857. X       }
  858. X    else {
  859. X       xv_set(contool_filters->filter_update,        PANEL_INACTIVE, TRUE, NULL);
  860. X       xv_set(contool_filters->filter_type,          PANEL_INACTIVE, TRUE, NULL);
  861. X       xv_set(contool_filters->filter_timeout,       PANEL_INACTIVE, TRUE, NULL);
  862. X       xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, TRUE, NULL);
  863. X       xv_set(contool_filters->start,                PANEL_INACTIVE, TRUE, NULL);
  864. X       xv_set(contool_filters->stop,                 PANEL_INACTIVE, TRUE, NULL);
  865. X       xv_set(contool_filters->comment,              PANEL_INACTIVE, TRUE, NULL);
  866. X       xv_set(contool_filters->ignore,               PANEL_INACTIVE, TRUE, NULL);
  867. X       xv_set(contool_filters->action,               PANEL_INACTIVE, TRUE, NULL);
  868. X       xv_set(contool_filters->filter_beep_count,    PANEL_INACTIVE, TRUE, NULL);
  869. X       xv_set(contool_filters->filter_beep_times,    PANEL_INACTIVE, TRUE, NULL);
  870. X       xv_set(contool_filters->filter_command,       PANEL_INACTIVE, TRUE, NULL);
  871. X       }
  872. X}
  873. X
  874. X/************************************************************************/
  875. XPRIVATE    init_filters()
  876. X
  877. X{    Filter    *f;
  878. X    int    i, total;
  879. X
  880. X    xv_set(contool_filters->filter_list, PANEL_PAINT, PANEL_NO_CLEAR, NULL);
  881. X    for (total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS); total > 0; total--)
  882. X       xv_set(contool_filters->filter_list, PANEL_LIST_DELETE, total - 1, NULL);
  883. X    xv_set(contool_filters->filter_list, PANEL_PAINT, PANEL_CLEAR, NULL);
  884. X    free_list(edit_set);
  885. X    edit_set = duplicate_list(filters);
  886. X    for (i = 0, f = edit_set; f; f = f->next, i++)
  887. X       xv_set(contool_filters->filter_list,
  888. X                PANEL_LIST_INSERT, i,
  889. X                PANEL_LIST_GLYPH,  i, f->stop? range : single,
  890. X                PANEL_LIST_STRING, i, f->start,
  891. X             NULL);
  892. X    update_controls();
  893. X}
  894. X
  895. X/************************************************************************/
  896. XPRIVATE    insert_item(pos)
  897. X
  898. Xint    pos;
  899. X
  900. X{    int    i, total;
  901. X    Filter    *f, *t;
  902. X
  903. X    total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  904. X    for (i = 0; i < total; i++)
  905. X       if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i))
  906. X          xv_set(contool_filters->filter_list, PANEL_LIST_SELECT, i, FALSE, NULL);
  907. X    xv_set(contool_filters->filter_list, PANEL_LIST_INSERT, pos, NULL);
  908. X    xv_set(contool_filters->filter_list, PANEL_LIST_GLYPH, pos, empty, NULL);
  909. X    xv_set(contool_filters->filter_list, PANEL_LIST_SELECT, pos, TRUE, NULL);
  910. X    if (pos == 0) {
  911. X       f = (Filter *) malloc(sizeof(Filter));
  912. X       f->next = edit_set;
  913. X       edit_set = f;
  914. X       }
  915. X    else {
  916. X       for (i = 1, f = edit_set; i < pos; i++, f = f->next)
  917. X          ;
  918. X       t = f->next;
  919. X       f->next = (Filter *) malloc(sizeof(Filter));
  920. X       f = f->next;
  921. X       f->next = t;
  922. X       }
  923. X    f->start = f->stop = f->comment = NULL;
  924. X    f->beep = defaults.beep;
  925. X    f->command = strsave(defaults.command);
  926. X    f->flash = defaults.flash;
  927. X    f->log = defaults.log;
  928. X    f->open = defaults.open;
  929. X    f->stamp = defaults.stamp;
  930. X    f->timeout = 0;
  931. X    f->save = TRUE;
  932. X    update_controls();
  933. X/* update the scrolling view */
  934. X}
  935. X
  936. X/************************************************************************/
  937. XPRIVATE    paste_items(pos)
  938. X
  939. Xint    pos;
  940. X
  941. X{    int    i;
  942. X    Filter    *new, *tail, *f;
  943. X
  944. X    new = duplicate_list(clipboard);
  945. X    for (f = new, i = 0; f; f = f->next, i++) {
  946. X       xv_set(contool_filters->filter_list, PANEL_LIST_INSERT, pos + i, 0);
  947. X       xv_set(contool_filters->filter_list,
  948. X                PANEL_LIST_STRING, pos + i, f->start,
  949. X                PANEL_LIST_GLYPH,  pos + i, f->stop? range : single,
  950. X             NULL);
  951. X       tail = f;
  952. X       }
  953. X    if (pos == 0) {
  954. X       tail->next = edit_set;
  955. X       edit_set = new;
  956. X       }
  957. X    else {
  958. X       for (i = 1, f = edit_set; i < pos; i++, f = f->next)
  959. X          ;
  960. X       tail->next = f->next;
  961. X       f->next = new;
  962. X       }
  963. X    update_controls();
  964. X}
  965. X
  966. X/************************************************************************/
  967. XPRIVATE    int    update_values(f, flag)
  968. X
  969. XFilter    *f;
  970. Xint    flag;
  971. X
  972. X{    char    *start, *stop, *msg;
  973. X    int    i;
  974. X
  975. X    start = (char *) xv_get(contool_filters->start, PANEL_VALUE);
  976. X    if (is_empty(start)) {
  977. X       if (flag)
  978. X          error("You must specify a starting message pattern");
  979. X       return(FALSE);
  980. X       }
  981. X    if (xv_get(contool_filters->filter_type, PANEL_VALUE) == 1) {
  982. X       stop = (char *) xv_get(contool_filters->stop, PANEL_VALUE);
  983. X       if (is_empty(stop)) {
  984. X          if (flag)
  985. X             error("You must specify an ending message pattern");
  986. X          return(FALSE);
  987. X          }
  988. X       }
  989. X    else
  990. X       stop = NULL;
  991. X    if (msg = compile_exp(f, start, stop)) {
  992. X       if (flag)
  993. X          error(msg);
  994. X       return(FALSE);
  995. X       }
  996. X    if ((int) xv_get(contool_filters->ignore, PANEL_VALUE) == 0) {
  997. X       i = (int) xv_get(contool_filters->action, PANEL_VALUE);
  998. X       if (i & COMMAND_BIT)
  999. X          if (msg = (char *) xv_get(contool_filters->filter_command, PANEL_VALUE))
  1000. X             f->command = strsave(msg);
  1001. X          else {
  1002. X             if (flag)
  1003. X                error("You must specify a command for this filter");
  1004. X             return(FALSE);
  1005. X             }
  1006. X       else
  1007. X          f->command = NULL;
  1008. X       if (i & BEEP_BIT)
  1009. X          f->beep = (int) xv_get(contool_filters->filter_beep_count, PANEL_VALUE);
  1010. X       else
  1011. X          f->beep = 0;
  1012. X       f->flash = (i & FLASH_BIT)? TRUE : FALSE;
  1013. X       f->log = (i & LOG_BIT)? TRUE : FALSE;
  1014. X       f->open = (i & OPEN_BIT)? TRUE : FALSE;
  1015. X       f->stamp = (i & STAMP_BIT)? TRUE : FALSE;
  1016. X       f->save = TRUE;
  1017. X       }
  1018. X    else
  1019. X       f->save = FALSE;
  1020. X    f->timeout = (stop == NULL)? 0 : (int) xv_get(contool_filters->filter_timeout, PANEL_VALUE);
  1021. X    f->start = strsave(start);
  1022. X    f->stop = strsave(stop);
  1023. X    f->comment = strsave((char *) xv_get(contool_filters->comment, PANEL_VALUE));
  1024. X    return(TRUE);
  1025. X}
  1026. X
  1027. X/************************************************************************/
  1028. XEXPORT    Menu_item    edit_filters(item, op)
  1029. X
  1030. XMenu_item    item;
  1031. XMenu_generate    op;
  1032. X
  1033. X{    Filter    *f, *curr;
  1034. X
  1035. X    if (op == MENU_NOTIFY) {
  1036. X       xv_set(contool_base->base, FRAME_BUSY, TRUE, NULL);
  1037. X       if (contool_filters == NULL) {
  1038. X          contool_filters = contool_filters_objects_initialize(NULL, contool_base->base);
  1039. X          place_dialog(contool_base->base, contool_filters->filters);
  1040. X          xv_set(contool_filters->filter_list, PANEL_LIST_ROW_HEIGHT, 16, NULL);
  1041. X          single = (Server_image) xv_create(NULL, SERVER_IMAGE,
  1042. X                                 XV_WIDTH, 16,
  1043. X                                 XV_HEIGHT, 16,
  1044. X                                 SERVER_IMAGE_BITS, single_bits,
  1045. X                              0);
  1046. X          range  = (Server_image) xv_create(NULL, SERVER_IMAGE,
  1047. X                                 XV_WIDTH, 16,
  1048. X                                 XV_HEIGHT, 16,
  1049. X                                 SERVER_IMAGE_BITS, range_bits,
  1050. X                              0);
  1051. X          empty  = (Server_image) xv_create(NULL, SERVER_IMAGE,
  1052. X                                 XV_WIDTH, 16,
  1053. X                                 XV_HEIGHT, 16,
  1054. X                                 SERVER_IMAGE_BITS, empty_bits,
  1055. X                              0);
  1056. X          }
  1057. X       if (xv_get(contool_filters->filters, XV_SHOW) == FALSE) {
  1058. X          edit_set = duplicate_list(filters);
  1059. X          free_list(clipboard);
  1060. X          clipboard = NULL;
  1061. X          init_filters();
  1062. X          }
  1063. X       xv_set(contool_filters->filters, XV_SHOW, TRUE, NULL);
  1064. X       xv_set(contool_base->base, FRAME_BUSY, FALSE, NULL);
  1065. X       }
  1066. X    return item;
  1067. X}
  1068. X
  1069. X/************************************************************************/
  1070. XEXPORT    int    filter_notify(item, string, client_data, op, event)
  1071. X
  1072. XPanel_item    item;
  1073. Xchar        *string;
  1074. XXv_opaque    client_data;
  1075. XPanel_list_op    op;
  1076. XEvent        *event;
  1077. X
  1078. X{    
  1079. X    if (op == PANEL_LIST_OP_DESELECT || op == PANEL_LIST_OP_SELECT)
  1080. X       update_controls();
  1081. X    return XV_OK;
  1082. X}
  1083. X
  1084. X/************************************************************************/
  1085. XEXPORT    Menu    filter_insert_handler(menu, op)
  1086. X
  1087. XMenu        menu;
  1088. XMenu_generate    op;
  1089. X
  1090. X{
  1091. X    xv_set(menu, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1092. X    xv_set(contool_filters->filter_insert, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1093. X    return menu;
  1094. X}
  1095. X
  1096. X/************************************************************************/
  1097. XEXPORT    Menu_item    insert_at_top(item, op)
  1098. X
  1099. XMenu_item    item;
  1100. XMenu_generate    op;
  1101. X
  1102. X{
  1103. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1104. X    xv_set(contool_filters->filter_insert, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1105. X    if (op == MENU_NOTIFY)
  1106. X       insert_item(0);
  1107. X    return item;
  1108. X}
  1109. X
  1110. X/************************************************************************/
  1111. XEXPORT    Menu_item    insert_above(item, op)
  1112. X
  1113. XMenu_item    item;
  1114. XMenu_generate    op;
  1115. X
  1116. X{
  1117. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1118. X    xv_set(contool_filters->filter_insert, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1119. X    if (op == MENU_DISPLAY)
  1120. X       xv_set(item, MENU_INACTIVE, selection_count() != 1, NULL);
  1121. X    else if (op == MENU_NOTIFY)
  1122. X       insert_item(curr_selection());
  1123. X    return item;
  1124. X}
  1125. X
  1126. X/************************************************************************/
  1127. XEXPORT    Menu_item    insert_below(item, op)
  1128. X
  1129. XMenu_item    item;
  1130. XMenu_generate    op;
  1131. X
  1132. X{
  1133. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1134. X    xv_set(contool_filters->filter_insert, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1135. X    if (op == MENU_DISPLAY)
  1136. X       xv_set(item, MENU_INACTIVE, selection_count() != 1, NULL);
  1137. X    else if (op == MENU_NOTIFY)
  1138. X       insert_item(curr_selection() + 1);
  1139. X    return item;
  1140. X}
  1141. X
  1142. X/************************************************************************/
  1143. XEXPORT    Menu_item    insert_at_bottom(item, op)
  1144. X
  1145. XMenu_item    item;
  1146. XMenu_generate    op;
  1147. X
  1148. X{
  1149. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1150. X    xv_set(contool_filters->filter_insert, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1151. X    if (op == MENU_NOTIFY)
  1152. X       insert_item(xv_get(contool_filters->filter_list, PANEL_LIST_NROWS));
  1153. X    return item;
  1154. X}
  1155. X
  1156. X/************************************************************************/
  1157. XEXPORT    Menu    filter_edit_handler(menu, op)
  1158. X
  1159. XMenu        menu;
  1160. XMenu_generate    op;
  1161. X
  1162. X{
  1163. X    xv_set(menu, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1164. X    xv_set(contool_filters->filter_insert, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1165. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1166. X    return menu;
  1167. X}
  1168. X
  1169. X/************************************************************************/
  1170. XEXPORT    Menu_item    filter_cut(item, op)
  1171. X
  1172. XMenu_item    item;
  1173. XMenu_generate    op;
  1174. X
  1175. X{    int    i, total;
  1176. X    Filter    *f, *prev, *curr = NULL;
  1177. X
  1178. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1179. X    xv_set(contool_filters->filter_edit, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1180. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1181. X    if (op == MENU_DISPLAY)
  1182. X       xv_set(item, MENU_INACTIVE, selection_count() == 0, NULL);
  1183. X    else if (op == MENU_NOTIFY) {
  1184. X       free_list(clipboard);
  1185. X       clipboard = NULL;
  1186. X       total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  1187. X       for (prev = NULL, f = edit_set, i = 0; i < total; i++, f = f->next)
  1188. X          if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i)) {
  1189. X             if (clipboard == NULL)
  1190. X                clipboard = curr = f;
  1191. X             else {
  1192. X                curr->next = f;
  1193. X                curr = curr->next;
  1194. X                }
  1195. X             if (prev == NULL)
  1196. X                edit_set = f->next;
  1197. X             else
  1198. X                prev->next = f->next;
  1199. X             xv_set(contool_filters->filter_list, PANEL_LIST_DELETE, i, NULL);
  1200. X             i--;
  1201. X             total--;
  1202. X             }
  1203. X          else
  1204. X             prev = f;
  1205. X       if (curr)
  1206. X          curr->next = NULL;
  1207. X       update_controls();
  1208. X       xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1209. X       }
  1210. X    return item;
  1211. X}
  1212. X
  1213. X/************************************************************************/
  1214. XEXPORT    Menu_item    filter_copy(item, op)
  1215. X
  1216. XMenu_item    item;
  1217. XMenu_generate    op;
  1218. X
  1219. X{    int    i, total;
  1220. X    Filter    *f, *curr;
  1221. X
  1222. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1223. X    xv_set(contool_filters->filter_edit, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1224. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1225. X    if (op == MENU_DISPLAY)
  1226. X       xv_set(item, MENU_INACTIVE, selection_count() == 0, NULL);
  1227. X    else if (op == MENU_NOTIFY) {
  1228. X       free_list(clipboard);
  1229. X       clipboard = NULL;
  1230. X       total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  1231. X       for (f = edit_set, i = 0; i < total; i++, f = f->next)
  1232. X          if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i))
  1233. X             if (clipboard == NULL)
  1234. X                clipboard = curr = duplicate_filter(f);
  1235. X             else {
  1236. X                curr->next = duplicate_filter(f);
  1237. X                curr = curr->next;
  1238. X                }
  1239. X       curr->next = NULL;
  1240. X       xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1241. X       }
  1242. X    return item;
  1243. X}
  1244. X
  1245. X/************************************************************************/
  1246. XEXPORT    Menu_item    filter_delete(item, op)
  1247. X
  1248. XMenu_item    item;
  1249. XMenu_generate    op;
  1250. X
  1251. X{    int    i, total;
  1252. X    Filter    *f, *prev, *temp = NULL, *curr;
  1253. X
  1254. X    xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1255. X    xv_set(contool_filters->filter_edit, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1256. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1257. X    if (op == MENU_DISPLAY)
  1258. X       xv_set(item, MENU_INACTIVE, selection_count() == 0, NULL);
  1259. X    else if (op == MENU_NOTIFY) {
  1260. X       total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  1261. X       for (prev = NULL, f = edit_set, i = 0; i < total; i++, f = f->next)
  1262. X          if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i)) {
  1263. X             if (temp == NULL)
  1264. X                temp = curr = f;
  1265. X             else {
  1266. X                curr->next = f;
  1267. X                curr = curr->next;
  1268. X                }
  1269. X             if (prev == NULL)
  1270. X                edit_set = f->next;
  1271. X             else
  1272. X                prev->next = f->next;
  1273. X             xv_set(contool_filters->filter_list, PANEL_LIST_DELETE, i, NULL);
  1274. X             i--;
  1275. X             total--;
  1276. X             }
  1277. X          else
  1278. X             prev = f;
  1279. X       if (curr)
  1280. X          curr->next = NULL;
  1281. X       free_list(temp);
  1282. X       update_controls();
  1283. X       xv_set(item, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1284. X       }
  1285. X    return item;
  1286. X}
  1287. X
  1288. X/************************************************************************/
  1289. XEXPORT    Menu_item    filter_paste(item, op)
  1290. X
  1291. XMenu_item    item;
  1292. XMenu_generate    op;
  1293. X
  1294. X{
  1295. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1296. X    if (op == MENU_DISPLAY)
  1297. X       xv_set(item, MENU_INACTIVE, clipboard == NULL, NULL);
  1298. X    return item;
  1299. X}
  1300. X
  1301. X/************************************************************************/
  1302. XEXPORT    Menu_item    paste_at_top(item, op)
  1303. X
  1304. XMenu_item    item;
  1305. XMenu_generate    op;
  1306. X
  1307. X{
  1308. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1309. X    if (op == MENU_NOTIFY)
  1310. X       paste_items(0);
  1311. X    return item;
  1312. X}
  1313. X
  1314. X/************************************************************************/
  1315. XEXPORT    Menu_item    paste_above(item, op)
  1316. X
  1317. XMenu_item    item;
  1318. XMenu_generate    op;
  1319. X
  1320. X{
  1321. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1322. X    if (op == MENU_DISPLAY)
  1323. X       xv_set(item, MENU_INACTIVE, selection_count() != 1, NULL);
  1324. X    else if (op == MENU_NOTIFY)
  1325. X       paste_items(curr_selection());
  1326. X    return item;
  1327. X}
  1328. X
  1329. X/************************************************************************/
  1330. XEXPORT    Menu_item    paste_below(item, op)
  1331. X
  1332. XMenu_item    item;
  1333. XMenu_generate    op;
  1334. X
  1335. X{
  1336. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1337. X    if (op == MENU_DISPLAY)
  1338. X       xv_set(item, MENU_INACTIVE, selection_count() != 1, NULL);
  1339. X    else if (op == MENU_NOTIFY)
  1340. X       paste_items(curr_selection() + 1);
  1341. X    return item;
  1342. X}
  1343. X
  1344. X/************************************************************************/
  1345. XEXPORT    Menu_item    paste_at_bottom(item, op)
  1346. X
  1347. XMenu_item    item;
  1348. XMenu_generate    op;
  1349. X
  1350. X{
  1351. X    xv_set(xv_get(contool_filters->filter_edit, PANEL_ITEM_MENU), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1352. X    if (op == MENU_NOTIFY)
  1353. X       paste_items((int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS));
  1354. X    return item;
  1355. X}
  1356. X
  1357. X/************************************************************************/
  1358. XEXPORT    void    filter_update(item, event)
  1359. X
  1360. XPanel_item    item;
  1361. XEvent        *event;
  1362. X
  1363. X{    int    i, curr;
  1364. X    Filter    *f;
  1365. X
  1366. X    xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1367. X
  1368. X    curr = curr_selection();
  1369. X    for (i = 0, f = edit_set; i < curr; i++, f = f->next)
  1370. X       ;
  1371. X    if (update_values(f, TRUE))
  1372. X       xv_set(contool_filters->filter_list,
  1373. X             PANEL_LIST_STRING, curr, f->start,
  1374. X             PANEL_LIST_GLYPH,  curr, f->stop? range : single,
  1375. X              NULL);
  1376. X}
  1377. X
  1378. X/************************************************************************/
  1379. XEXPORT    void    set_filter_type(item, value, event)
  1380. X
  1381. XPanel_item    item;
  1382. Xint        value;
  1383. XEvent        *event;
  1384. X
  1385. X{
  1386. X    xv_set(contool_filters->stop, PANEL_INACTIVE, value == 0, NULL);
  1387. X    xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, value == 0, NULL);
  1388. X    xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, value == 0, NULL);
  1389. X}
  1390. X
  1391. X/************************************************************************/
  1392. XEXPORT    void    set_filter_action(item, value, event)
  1393. X
  1394. XPanel_item    item;
  1395. Xint        value;
  1396. XEvent        *event;
  1397. X
  1398. X{    contool_filters_objects    *ip = (contool_filters_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1399. X
  1400. X    if (value == 0) { /* save this message */
  1401. X       xv_set(ip->action,            PANEL_INACTIVE, FALSE, NULL);
  1402. X       xv_set(ip->filter_beep_count, PANEL_INACTIVE, !((int) xv_get(ip->action, PANEL_VALUE) & BEEP_BIT), NULL);
  1403. X       xv_set(ip->filter_beep_times, PANEL_INACTIVE, !((int) xv_get(ip->action, PANEL_VALUE) & BEEP_BIT), NULL);
  1404. X       xv_set(ip->filter_command,    PANEL_INACTIVE, !((int) xv_get(ip->action, PANEL_VALUE) & COMMAND_BIT), NULL);
  1405. X       }
  1406. X    else { /* ignore this message */
  1407. X       xv_set(ip->action,            PANEL_INACTIVE, TRUE, NULL);
  1408. X       xv_set(ip->filter_beep_count, PANEL_INACTIVE, TRUE, NULL);
  1409. X       xv_set(ip->filter_beep_times, PANEL_INACTIVE, TRUE, NULL);
  1410. X       xv_set(ip->filter_command,    PANEL_INACTIVE, TRUE, NULL);
  1411. X       }
  1412. X}
  1413. X
  1414. X/************************************************************************/
  1415. XEXPORT    void    set_match_action(item, value, event)
  1416. X
  1417. XPanel_item    item;
  1418. Xunsigned int    value;
  1419. XEvent        *event;
  1420. X
  1421. X{    contool_filters_objects    *ip = (contool_filters_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1422. X    
  1423. X    xv_set(ip->filter_beep_count, PANEL_INACTIVE, !(value & BEEP_BIT), NULL);
  1424. X    xv_set(ip->filter_beep_times, PANEL_INACTIVE, !(value & BEEP_BIT), NULL);
  1425. X    xv_set(ip->filter_command,    PANEL_INACTIVE, !(value & COMMAND_BIT), NULL);
  1426. X}
  1427. X
  1428. X/************************************************************************/
  1429. XEXPORT    void    filter_done(frame)
  1430. X
  1431. XFrame        frame;
  1432. X
  1433. X{
  1434. X    free_list(edit_set);
  1435. X    edit_set = NULL;
  1436. X    free_list(clipboard);
  1437. X    clipboard = NULL;
  1438. X    xv_set(frame, XV_SHOW, FALSE, 0);
  1439. X}
  1440. X
  1441. X/************************************************************************/
  1442. XPRIVATE    int    check_for_update()
  1443. X
  1444. X{    int    i, result, curr, diff = FALSE;
  1445. X    Filter    *f, new;
  1446. X
  1447. X    if (selection_count() != 1)
  1448. X       return(TRUE);
  1449. X    curr = curr_selection();
  1450. X    for (i = 0, f = edit_set; i < curr; i++, f = f->next)
  1451. X       ;
  1452. X    new = *f;
  1453. X    if (update_values(&new, FALSE) == FALSE)
  1454. X       diff = TRUE;
  1455. X    else if ((f->start != NULL && new.start == NULL) || (f->start == NULL && new.start != NULL))
  1456. X       diff = TRUE;
  1457. X    else if ((f->stop != NULL && new.stop == NULL) || (f->stop == NULL && new.stop != NULL))
  1458. X       diff = TRUE;
  1459. X    else if ((f->comment != NULL && new.comment == NULL) || (f->comment == NULL && new.comment != NULL))
  1460. X       diff = TRUE;
  1461. X    else if ((f->command != NULL && new.command == NULL) || (f->command == NULL && new.command != NULL))
  1462. X       diff = TRUE;
  1463. X    else if (new.stop && f->timeout != new.timeout)
  1464. X       diff = TRUE;
  1465. X    else if (f->save != new.save || f->beep != new.beep || f->flash != new.flash || f->log != new.log || f->open != new.open || f->stamp != new.stamp)
  1466. X       diff = TRUE;
  1467. X    else if (f->start && strcmp(f->start, new.start) != 0)
  1468. X       diff = TRUE;
  1469. X    else if (f->stop && strcmp(f->stop, new.stop) != 0)
  1470. X       diff = TRUE;
  1471. X    else if (f->comment && strcmp(f->comment, new.comment) != 0)
  1472. X       diff = TRUE;
  1473. X    else if (f->command && strcmp(f->command, new.command) != 0)
  1474. X       diff = TRUE;
  1475. X    if (diff) {
  1476. X       result = notice_prompt(contool_base->base, NULL,
  1477. X                        NOTICE_MESSAGE_STRINGS,
  1478. X                           "You have modified the attributes of the selected filter.",
  1479. X                           " ",
  1480. X                           "Do you wish to perform an Update before doing an Apply?",
  1481. X                           NULL,
  1482. X                        NOTICE_BUTTON_YES, "Update, then Apply",
  1483. X                        NOTICE_BUTTON_NO, "Apply",
  1484. X                        NOTICE_BUTTON, "Cancel", 101,
  1485. X                     NULL);
  1486. X       if (result == NOTICE_YES)
  1487. X          filter_update(contool_filters->filters, NULL);
  1488. X       return(result != 101);
  1489. X       }
  1490. X    return(TRUE);
  1491. X}
  1492. X
  1493. X/************************************************************************/
  1494. XEXPORT    void    accept_filters(item, event)
  1495. X
  1496. XPanel_item    item;
  1497. XEvent        *event;
  1498. X
  1499. X{    Filter    *f;
  1500. X    int    i, total;
  1501. X    char    *msg = NULL;
  1502. X
  1503. X    xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1504. X
  1505. X    if (!check_for_update())
  1506. X       return;
  1507. X
  1508. X    total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  1509. X    for (i = 0; i < total; i++)
  1510. X       if (xv_get(contool_filters->filter_list, PANEL_LIST_SELECTED, i))
  1511. X          xv_set(contool_filters->filter_list, PANEL_LIST_SELECT, i, FALSE, NULL);
  1512. X    for (f = edit_set, i = 0; f; f = f->next, i++)
  1513. X       if (is_empty(f->start) || (msg = compile_exp(f, f->start, f->stop))) {
  1514. X          xv_set(contool_filters->filter_list, PANEL_LIST_SELECT, i, TRUE, NULL);
  1515. X          update_controls();
  1516. X          error(msg? msg : "No pattern is specified for the indicated filter");
  1517. X          return;
  1518. X          }
  1519. X    free_list(filters);
  1520. X    filters = edit_set;
  1521. X    if (xv_get(contool_filters->filters, FRAME_CMD_PUSHPIN_IN))
  1522. X       edit_set = duplicate_list(filters);
  1523. X    else {
  1524. X       edit_set = NULL;
  1525. X       free_list(clipboard);
  1526. X       clipboard = NULL;
  1527. X       }
  1528. X    filters_changed();
  1529. X    xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, NULL);
  1530. X}
  1531. X
  1532. X/************************************************************************/
  1533. XEXPORT    void    accept_and_save_filters(item, event)
  1534. X
  1535. XPanel_item    item;
  1536. XEvent        *event;
  1537. X
  1538. X{
  1539. X    accept_filters(item, event);
  1540. X    if (xv_get(item, PANEL_NOTIFY_STATUS) == XV_OK)
  1541. X       if (!store_filters_to_file(filter_file, TRUE, TRUE))
  1542. X          xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1543. X}
  1544. X
  1545. X/************************************************************************/
  1546. XEXPORT    void    reset_filters(item, event)
  1547. X
  1548. XPanel_item    item;
  1549. XEvent        *event;
  1550. X
  1551. X{
  1552. X    init_filters();
  1553. X    xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1554. X}
  1555. END_OF_FILE
  1556. if test 28125 -ne `wc -c <'filters.c'`; then
  1557.     echo shar: \"'filters.c'\" unpacked with wrong size!
  1558. fi
  1559. # end of 'filters.c'
  1560. fi
  1561. if test ! -d 'icons' ; then
  1562.     echo shar: Creating directory \"'icons'\"
  1563.     mkdir 'icons'
  1564. fi
  1565. if test ! -d 'images' ; then
  1566.     echo shar: Creating directory \"'images'\"
  1567.     mkdir 'images'
  1568. fi
  1569. if test -f 'place_dialog.c' -a "${1}" != "-c" ; then 
  1570.   echo shar: Will not clobber existing file \"'place_dialog.c'\"
  1571. else
  1572. echo shar: Extracting \"'place_dialog.c'\" \(2563 characters\)
  1573. sed "s/^X//" >'place_dialog.c' <<'END_OF_FILE'
  1574. X/************************************************************************/
  1575. X/*    Copyright 1987-1991 by Chuck Musciano and Harris Corporation     */
  1576. X/*                                    */
  1577. X/*    Full ownership of this software, and all rights pertaining to     */
  1578. X/*    the for-profit distribution of this software, are retained by     */
  1579. X/*    Chuck Musciano and Harris Corporation.  You are permitted to     */
  1580. X/*    use this software without fee.  This software is provided "as     */
  1581. X/*    is" without express or implied warranty.  You may redistribute     */
  1582. X/*    this software, provided that this copyright notice is retained,    */
  1583. X/*    and that the software is not distributed for profit.  If you     */
  1584. X/*    wish to use this software in a profit-making venture, you must     */
  1585. X/*    first license this code and its underlying technology from     */
  1586. X/*    Harris Corporation.                         */
  1587. X/*                                    */
  1588. X/*    Bottom line: you can have this software, you can use it, you     */
  1589. X/*    can give it away.  You just can't sell any or all parts of it     */
  1590. X/*    without prior permission from Harris Corporation.         */
  1591. X/************************************************************************/
  1592. X
  1593. X/************************************************************************/
  1594. X/*                                    */
  1595. X/*    place_dialog.c    position a dialog box at the right place    */
  1596. X/*                                    */
  1597. X/************************************************************************/
  1598. X
  1599. X#include    <stdio.h>
  1600. X#include    <sys/param.h>
  1601. X#include    <sys/types.h>
  1602. X#include    <xview/xview.h>
  1603. X#include    <X11/Xutil.h>
  1604. X
  1605. X#include    "manifest.h"
  1606. X
  1607. X/************************************************************************/
  1608. XEXPORT    void    place_dialog(base, dialog)
  1609. X
  1610. XXv_opaque    base;
  1611. XXv_opaque    dialog;
  1612. X
  1613. X{    Rect        br, dr, sr;
  1614. X    XWMHints    *hints;
  1615. X
  1616. X    sr = *((Rect *) xv_get(base, WIN_SCREEN_RECT));
  1617. X    frame_get_rect(base, &br);
  1618. X    frame_get_rect(dialog, &dr);
  1619. X    if (rect_right(&br) + dr.r_width < sr.r_width) {
  1620. X       dr.r_left = rect_right(&br);
  1621. X       dr.r_top = br.r_top;
  1622. X       }
  1623. X    else if (dr.r_width <= br.r_left) {
  1624. X       dr.r_left = br.r_left - dr.r_width;
  1625. X       dr.r_top = br.r_top;
  1626. X       }
  1627. X    else {
  1628. X       dr.r_left = br.r_left + 32;
  1629. X       dr.r_top = br.r_top + 32;
  1630. X       }
  1631. X    if (dr.r_top + dr.r_height > sr.r_height)
  1632. X       dr.r_top = sr.r_height - dr.r_height;
  1633. X    if (dr.r_top < 0)
  1634. X       dr.r_top = 0;
  1635. X    if (rect_right(&dr) > sr.r_width)
  1636. X       dr.r_left = sr.r_width - dr.r_width;
  1637. X    if (dr.r_left < 0)
  1638. X       dr.r_left = 0;
  1639. X    frame_set_rect(dialog, &dr);
  1640. X
  1641. X    hints = XGetWMHints(xv_get(dialog, XV_DISPLAY), xv_get(dialog, XV_XID));
  1642. X    hints->flags |= StateHint;
  1643. X    hints->initial_state = NormalState;
  1644. X    XSetWMHints(xv_get(dialog, XV_DISPLAY), xv_get(dialog, XV_XID), hints);
  1645. X    XFree(hints);
  1646. X}
  1647. X
  1648. END_OF_FILE
  1649. if test 2563 -ne `wc -c <'place_dialog.c'`; then
  1650.     echo shar: \"'place_dialog.c'\" unpacked with wrong size!
  1651. fi
  1652. # end of 'place_dialog.c'
  1653. fi
  1654. echo shar: End of archive 1 \(of 5\).
  1655. cp /dev/null ark1isdone
  1656. MISSING=""
  1657. for I in 1 2 3 4 5 ; do
  1658.     if test ! -f ark${I}isdone ; then
  1659.     MISSING="${MISSING} ${I}"
  1660.     fi
  1661. done
  1662. if test "${MISSING}" = "" ; then
  1663.     echo You have unpacked all 5 archives.
  1664.     rm -f ark[1-9]isdone
  1665. else
  1666.     echo You still need to unpack the following archives:
  1667.     echo "        " ${MISSING}
  1668. fi
  1669. ##  End of shell archive.
  1670. exit 0
  1671. -- 
  1672. --
  1673. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1674. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1675. Sunnyvale, California 94086            at&t: 408/522-9236
  1676.