home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume18 / bricons1 / part01 < prev    next >
Encoding:
Text File  |  1992-08-02  |  50.5 KB  |  1,910 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!gatech!darwin.sura.net!mips!msi!dcmartin
  3. From: bri@ukc.ac.uk
  4. Subject: v18i081: bricons - iconic command panel, Part01/02
  5. Message-ID: <csx-18i081-bricons-1.0@uunet.UU.NET>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. Date: Mon, 3 Aug 1992 19:20:36 GMT
  10. Approved: dcmartin@msi.com
  11. Lines: 1897
  12.  
  13. Submitted-by: bri@ukc.ac.uk
  14. Posting-number: Volume 18, Issue 81
  15. Archive-name: bricons-1.0/part01
  16.  
  17.     The bricons program allows the user to start up applications 
  18.     from a configured command panel on a workstation display 
  19.     running X.  The bricons interface can consist of up to sixteen
  20.     buttons which can display some text or an icon. Each button is 
  21.     used to execute a shell command using the Bourne shell.
  22.     Each button can be configured to display a single spring 
  23.     loaded popup menu with up to ten more buttons.
  24.  
  25. #!/bin/sh
  26. # This is a shell archive (produced by shar 3.50)
  27. # To extract the files from this archive, save it to a file, remove
  28. # everything above the "!/bin/sh" line above, and type "sh file_name".
  29. #
  30. # made 08/03/1992 16:40 UTC by dcmartin@fascet
  31. # Source directory /home/fascet/dcmartin/csx/src/bricons
  32. #
  33. # existing files will NOT be overwritten unless -c is specified
  34. #
  35. # This is part 1 of a multipart archive                                    
  36. # do not concatenate these parts, unpack them in order with /bin/sh        
  37. #
  38. # This shar contains:
  39. # length  mode       name
  40. # ------ ---------- ------------------------------------------
  41. #    511 -rw-r--r-- Imakefile
  42. #    635 -rw-r--r-- Makefile.std
  43. #    342 -rw-r--r-- Xbricons
  44. #    440 -rw-r--r-- .briconsrc
  45. #   6754 -rw-r--r-- bricons.l
  46. #   8068 -rw-r--r-- bricons.txt
  47. #   1515 -rwxr-xr-x README
  48. #   1802 -rw-r--r-- gen.h
  49. #     22 -rw-r--r-- patchlevel.h
  50. #   1066 -rw-r--r-- trans.h
  51. #    162 -rw-r--r-- widgets.h
  52. #   4594 -rw-r--r-- action.c
  53. #  10097 -rw-r--r-- buttons.c
  54. #   2863 -rw-r--r-- gen.c
  55. #   7959 -rw-r--r-- main.c
  56. #   7867 -rw-r--r-- parser.c
  57. #   2378 -rw-r--r-- bitmaps/help
  58. #   1871 -rw-r--r-- bitmaps/calander
  59. #   1883 -rw-r--r-- bitmaps/letters
  60. #   1965 -rw-r--r-- bitmaps/dclock
  61. #   2256 -rw-r--r-- bitmaps/dragon
  62. #   2256 -rw-r--r-- bitmaps/games
  63. #    875 -rw-r--r-- bitmaps/load
  64. #   1748 -rw-r--r-- bitmaps/readNews
  65. #  10825 -rw-r--r-- Makefile
  66. #
  67. if test -r _shar_seq_.tmp; then
  68.     echo 'Must unpack archives in sequence!'
  69.     echo Please unpack part `cat _shar_seq_.tmp` next
  70.     exit 1
  71. fi
  72. # ============= Imakefile ==============
  73. if test -f 'Imakefile' -a X"$1" != X"-c"; then
  74.     echo 'x - skipping Imakefile (File already exists)'
  75.     rm -f _shar_wnt_.tmp
  76. else
  77. > _shar_wnt_.tmp
  78. echo 'x - extracting Imakefile (Text)'
  79. sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
  80. /**/# static char* sccs_imake = "%W%%G%";
  81. /**/# Imakefile,v 1 25 June 1991
  82. /**/#
  83. /**/# MTI: Build srcs
  84. /**/#
  85. /**/# #include "/s/bri/Xstuff/Xukc.tmpl"
  86. /**/# #define PassCDebugFlags
  87. X
  88. X        DEPLIBS = XawClientDepLibs
  89. LOCAL_LIBRARIES = XawClientLibs
  90. X
  91. SRCS =  main.c \
  92. X    action.c \
  93. X    buttons.c \
  94. X    gen.c \
  95. X    parser.c \
  96. X    gen.h \
  97. X    trans.h \
  98. X    widgets.h
  99. X
  100. OBJS =  main.o \
  101. X    buttons.o \
  102. X    action.o \
  103. X    parser.o \
  104. X    gen.o 
  105. X
  106. X
  107. TARGET = bricons 
  108. INSTALLBIN = /s/bri/bin/mbins/$Mbin
  109. X
  110. ComplexProgramTarget($(TARGET))
  111. X
  112. DependTarget()
  113. SHAR_EOF
  114. chmod 0644 Imakefile ||
  115. echo 'restore of Imakefile failed'
  116. Wc_c="`wc -c < 'Imakefile'`"
  117. test 511 -eq "$Wc_c" ||
  118.     echo 'Imakefile: original size 511, current size' "$Wc_c"
  119. rm -f _shar_wnt_.tmp
  120. fi
  121. # ============= Makefile.std ==============
  122. if test -f 'Makefile.std' -a X"$1" != X"-c"; then
  123.     echo 'x - skipping Makefile.std (File already exists)'
  124.     rm -f _shar_wnt_.tmp
  125. else
  126. > _shar_wnt_.tmp
  127. echo 'x - extracting Makefile.std (Text)'
  128. sed 's/^X//' << 'SHAR_EOF' > 'Makefile.std' &&
  129. X
  130. OBJS=main.o gen.o action.o buttons.o parser.o
  131. X
  132. #CC=gcc
  133. CC=cc
  134. #CFLAGS= -ansi -pedantic
  135. CFLAGS= -g
  136. #CFLAGS= -O2
  137. X
  138. LIBS= -lXaw -lXmu -lXt -lXext -lX11 
  139. X
  140. TARGET= bricons
  141. X
  142. X
  143. all:    $(OBJS)
  144. X    $(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
  145. X
  146. main.o:        gen.h widgets.h trans.h main.c
  147. X        $(CC) $(CFLAGS) -c main.c
  148. X
  149. gen.o:        gen.h gen.c
  150. X        $(CC) $(CFLAGS) -c gen.c
  151. X
  152. action.o:    gen.h widgets.h action.c
  153. X        $(CC) $(CFLAGS) -c action.c
  154. X
  155. buttons.o:    gen.h widgets.h trans.h buttons.c
  156. X        $(CC) $(CFLAGS) -c buttons.c
  157. X
  158. parser.o:     gen.h parser.c
  159. X        $(CC) $(CFLAGS) -c parser.c    
  160. X
  161. install:
  162. X    strip $(TARGET)
  163. X    mv $(TARGET) /s/bri/bin/mbins/$Mbin
  164. X
  165. clean:
  166. X    rm $(TARGET) *.o
  167. SHAR_EOF
  168. chmod 0644 Makefile.std ||
  169. echo 'restore of Makefile.std failed'
  170. Wc_c="`wc -c < 'Makefile.std'`"
  171. test 635 -eq "$Wc_c" ||
  172.     echo 'Makefile.std: original size 635, current size' "$Wc_c"
  173. rm -f _shar_wnt_.tmp
  174. fi
  175. # ============= Xbricons ==============
  176. if test -f 'Xbricons' -a X"$1" != X"-c"; then
  177.     echo 'x - skipping Xbricons (File already exists)'
  178.     rm -f _shar_wnt_.tmp
  179. else
  180. > _shar_wnt_.tmp
  181. echo 'x - extracting Xbricons (Text)'
  182. sed 's/^X//' << 'SHAR_EOF' > 'Xbricons' &&
  183. ! Application resources file for bricons program
  184. ! B.R. Ingram 9th Sept 1991
  185. *no_of_cols:             16
  186. *icon_file:             /home/cur/bri/.briconsrc
  187. *help_file:            /home/cur/bri/Man/bricons.l
  188. .bitmapFilePath:        /usr/local/include/X11/bitmaps:/s/bri/Pics
  189. *borderColor:            yellow
  190. *popup_layout*.borderColor:    black
  191. *background:            #ffd28e
  192. *box.background:        gray
  193. SHAR_EOF
  194. chmod 0644 Xbricons ||
  195. echo 'restore of Xbricons failed'
  196. Wc_c="`wc -c < 'Xbricons'`"
  197. test 342 -eq "$Wc_c" ||
  198.     echo 'Xbricons: original size 342, current size' "$Wc_c"
  199. rm -f _shar_wnt_.tmp
  200. fi
  201. # ============= .briconsrc ==============
  202. if test -f '.briconsrc' -a X"$1" != X"-c"; then
  203.     echo 'x - skipping .briconsrc (File already exists)'
  204.     rm -f _shar_wnt_.tmp
  205. else
  206. > _shar_wnt_.tmp
  207. echo 'x - extracting .briconsrc (Text)'
  208. sed 's/^X//' << 'SHAR_EOF' > '.briconsrc' &&
  209. # <-- a line starting with a '#' is a comment line
  210. #
  211. X
  212. # first line must have keyword %icon or %text
  213. # to indicate if button is an icon
  214. %icon help
  215. xterm -e vi `pwd`/bricons.txt
  216. %icon letters
  217. xterm -e mail 
  218. %icon calander
  219. cal 1992
  220. %text Sub-\nmenu
  221. %sub_menu
  222. X    %text bitmap\neditor
  223. X    bitmap `pwd`/bitmaps/dclock
  224. X    %icon dclock
  225. X    xclock
  226. X    %icon load
  227. X    xload
  228. X    %text Shell
  229. X    xterm -n Shell
  230. %end_sub_menu
  231. %icon readNews
  232. xterm -name rn -e rn -r -S1 -t -m
  233. SHAR_EOF
  234. chmod 0644 .briconsrc ||
  235. echo 'restore of .briconsrc failed'
  236. Wc_c="`wc -c < '.briconsrc'`"
  237. test 440 -eq "$Wc_c" ||
  238.     echo '.briconsrc: original size 440, current size' "$Wc_c"
  239. rm -f _shar_wnt_.tmp
  240. fi
  241. # ============= bricons.l ==============
  242. if test -f 'bricons.l' -a X"$1" != X"-c"; then
  243.     echo 'x - skipping bricons.l (File already exists)'
  244.     rm -f _shar_wnt_.tmp
  245. else
  246. > _shar_wnt_.tmp
  247. echo 'x - extracting bricons.l (Text)'
  248. sed 's/^X//' << 'SHAR_EOF' > 'bricons.l' &&
  249. .\" static char* sccs_bricons_c = "%W%%G%";
  250. .\"  bricons.l  B. Ingram version 1.0 24th June 1991
  251. .TH BRICONS l "28th March 1992"
  252. .SH NAME
  253. bricons \- quick start up utility for applications using text, icons and pop-up
  254. menus on an X display
  255. .SH SYNOPSIS
  256. .B bricons
  257. \ [options]
  258. .br
  259. [\fB\-file\fP] [\fB\-col\fP] [\fB\-help\fP] [\fB\-sensitive\fP] [\fB\-bmdir\fP]
  260. .br
  261. .SH DESCRIPTION
  262. .LP
  263. Bricons program allows the user to quickly start up applications
  264. by selecting the appropriate button from the display and pressing the left 
  265. mouse button.  A maximum of up to sixteen main menu buttons can be displayed.  
  266. Each main menu button can launch an application or pop-up a sub menu containing 
  267. more buttons. The buttons can be represented as a bitmap or as text.
  268. .LP
  269. Information on how the program is to present each button (either as a bitmap 
  270. or text) and the application that is to be executed if that button is selected 
  271. is contained in script file called .briconsrc.  This file should be stored in 
  272. the same directory as the program is executed from.
  273. .LP
  274. The \&.briconsrc file contains a number of key words which are used to
  275. indicate if the button label is some text or a bitmap and if the button is to
  276. pop-up a sub menu or launch a program.  These key words are explained below:
  277. .LP
  278. The .briconsrc file should start with the keyword
  279. .B %icon
  280. or
  281. .B %text
  282. The key word %icon indicates that the button label is a bitmap.  This should be
  283. followed by the file name containing the bitmap.  For example:
  284. .sp
  285. .ce
  286. %icon clock.icon
  287. .LP
  288. The key word %text indicates that the button label is some text.  The text can
  289. be split over three lines by using the new line character \\n.  For 
  290. example:
  291. .sp
  292. .ce
  293. %text Line1\\nLine2\\nLine3
  294. .LP
  295. would be presented as:
  296. .ce 3
  297. Line1
  298. Line2
  299. Line3
  300. .LP
  301. Once a button has been selected it is prevented from accidentally being 
  302. re-selected by "graying out" the button (default action).  Sometimes however 
  303. it maybe desirable to allow the button to be selected more than once.  This
  304. can be done be using the keyword
  305. .B %icon+
  306. or 
  307. .B %text+
  308. .LP
  309. The next line in the \&.briconsrc file should either contain the key word
  310. %sub_menu or the application to be started.  If the name of an 
  311. application  is given then a check is made to see if such an program can be 
  312. executed.  If the program does not exist or is not in the users path then an 
  313. error message is printed and the button associated with the application is 
  314. ignored.
  315. .LP
  316. If the key word %sub_menu is used then a pop-up sub menu is created.  Any
  317. further buttons defined in the briconsrc file will appear in the sub menu for
  318. that button until the key word %end_sub_menu is found.  A maximum of
  319. ten buttons are allowed in a single pop-up sub menu.
  320. .LP
  321. Any line in the \&.briconsrc file starting with a # character is 
  322. treated as a comment and will be ignored.  
  323. .LP
  324. This program has four default buttons labelled source, edit, help and quit.
  325. The edit button allows the user to edit there icon file (default being an empty
  326. ./briconsrc file) and to add or delete buttons from the script file.  The 
  327. source button causes the program to distory all the current buttons being 
  328. displayed and re-read the icon file and display the new buttons.
  329. .SH OPTIONS
  330. .LP
  331. bricons accepts all of the standard X  Toolkit  command  line options along 
  332. with the additional options listed below:
  333. .TP
  334. -file
  335. Tells the program to read this file instead of the default file.
  336. .TP
  337. -col
  338. Indicates the number of buttons in a column before starting a new row.  The 
  339. default number of columns is 15.
  340. .TP
  341. -help
  342. Tells the program the path for the help file.
  343. .TP
  344. -sensitive
  345. Toggle used for default "graying out" of selected buttons.  If set to TRUE 
  346. then buttons will "gray out" unless specifically requested not to.
  347. .TP
  348. -bmdir
  349. This program will search the default bitmap directory (./bitmaps) for any 
  350. bitmaps that are to be used to represent buttons.  If you wish to add 
  351. different bitmap directories then use this command line argument followed by
  352. a colon separated list of path names.  For example if the program needs to find
  353. bitmaps in two different directories then the following can be entered at the
  354. command line:
  355. .sp
  356. .ce
  357. bricons -bmdir /usr/local/bitmaps:/usr/mydir/bitmaps
  358. .sp
  359. .SH X DEFAULTS
  360. .LP
  361. The bricons program reads the .Xdefaults file and Xbricons resource file
  362. during startup and uses the appropriate resource specification to
  363. customise the appearance or characteristics of its display.  This program 
  364. understands all of the core resource names and classes as well as:
  365. .TP
  366. no_of_cols
  367. Specifies the number of buttons in a column.
  368. .TP
  369. icon_file
  370. Specifies path name for icon file to be read.
  371. .TP
  372. help_file
  373. Specifies path name for help file.
  374. .TP
  375. icon_dirs
  376. Specifies path name for bitmap directories.
  377. .sp
  378. .SH "SETTING BITMAP DIRECTORIES"
  379. .LP
  380. This section explains how to specify bitmap file paths using the .Xdefaults
  381. file.  For the quickest and simplest method see the OPTIONS section under
  382. -bmdir.
  383. .LP
  384. This program will search the default bitmap directory for any bitmaps that
  385. are to be used to represent buttons. If the user wishes the program to
  386. search other directories for bitmap files then this should be specified in
  387. the users .X11defaults file.  *BitmapFilePath: should be added followed by
  388. colon separated path names where the bitmap files can be found.  For example:
  389. .sp
  390. .ce
  391. *BitmapFilePath:    /usr/local/include/X11/bitmaps:/usr/mydir/bitmaps
  392. .LP
  393. .SH RESOURCE FILES
  394. .LP
  395. The Xbricons file specifies the required resources.  To make sure the program
  396. uses the resources file set the following line in your .login:
  397. .ce
  398. setenv  XUSERFILESEARCHPATH ~/app_defaults/%N
  399. .LP
  400. and place all all resources in the app_defaults directory.
  401. .SH WIDGETS
  402. .LP
  403. The bricons program is a toolkit-based application which consists of a 
  404. combination of widgets.  In order to specify resources, it is useful to know
  405. the hierarchy of the widgets which compose bricons.  In the list below, 
  406. indentation indicates hierarchical structure.  The widget class name is given 
  407. first, followed by the widget instance name.
  408. .sp
  409. .nf
  410. X    Xbricons    toplevel    
  411. X        Form    box
  412. X            Command    action[18]
  413. X            OverrideShell    popup_shell
  414. X                Form    popup_layout
  415. X                Command    sub_action[10]
  416. .fi
  417. .SH EXAMPLE
  418. .LP
  419. Below is an example of a simple \&.briconsrc file:
  420. .sp
  421. .nf
  422. # <-- a line starting with a '#' is a comment line
  423. #
  424. #       Bri's icon file
  425. #
  426. X
  427. # first line must have keyword %icon or %text
  428. # to indicate if button is an icon
  429. X
  430. %icon calculator
  431. xcalc
  432. %text Games\\n sub\\n menu
  433. %sub_menu
  434. X    %text xeyes
  435. X    xeyes
  436. X    %text othello
  437. X    othello 
  438. %end_sub_menu
  439. .if
  440. .sp
  441. .SH BUGS
  442. After selecting the source button the buttons may not be re-displayed 
  443. correctly.  Selecting the source button a second time may help.
  444. .SH AUTHOR
  445. Bruce R Ingram, University of Kent at Canterbury.
  446. SHAR_EOF
  447. chmod 0644 bricons.l ||
  448. echo 'restore of bricons.l failed'
  449. Wc_c="`wc -c < 'bricons.l'`"
  450. test 6754 -eq "$Wc_c" ||
  451.     echo 'bricons.l: original size 6754, current size' "$Wc_c"
  452. rm -f _shar_wnt_.tmp
  453. fi
  454. # ============= bricons.txt ==============
  455. if test -f 'bricons.txt' -a X"$1" != X"-c"; then
  456.     echo 'x - skipping bricons.txt (File already exists)'
  457.     rm -f _shar_wnt_.tmp
  458. else
  459. > _shar_wnt_.tmp
  460. echo 'x - extracting bricons.txt (Text)'
  461. sed 's/^X//' << 'SHAR_EOF' > 'bricons.txt' &&
  462. X
  463. X
  464. X
  465. BRICONS(l)        MISC. REFERENCE MANUAL PAGES         BRICONS(l)
  466. X
  467. X
  468. X
  469. NAME
  470. X     bricons - quick start  up  utility  for  applications  using
  471. X     text, icons and pop-up menus on an X display
  472. X
  473. SYNOPSIS
  474. X     bricons  [options]
  475. X     [-file] [-col] [-help] [-sensitive] [-bmdir]
  476. X
  477. DESCRIPTION
  478. X     Bricons program allows the user to quickly start up applica-
  479. X     tions  by  selecting the appropriate button from the display
  480. X     and pressing the left mouse button.  A maximum of up to six-
  481. X     teen main menu buttons can be displayed. Each main menu but-
  482. X     ton can launch an application or pop-up a sub menu  contain-
  483. X     ing more buttons. The buttons can be represented as a bitmap
  484. X     or as text.
  485. X
  486. X     Information on how the program is  to  present  each  button
  487. X     (either  as a bitmap or text) and the application that is to
  488. X     be executed if that  button  is  selected  is  contained  in
  489. X     script  file  called .briconsrc.  This file should be stored
  490. X     in the same directory as the program is executed from.
  491. X
  492. X     The .briconsrc file contains a number of key words which are
  493. X     used  to indicate if the button label is some text or a bit-
  494. X     map and if the button is to pop-up a sub menu  or  launch  a
  495. X     program.  These key words are explained below:
  496. X
  497. X     The .briconsrc file should start with the keyword  %icon  or
  498. X     %text  The key word %icon indicates that the button label is
  499. X     a bitmap.  This should be followed by the file name contain-
  500. X     ing the bitmap.  For example:
  501. X
  502. X                           %icon clock.icon
  503. X
  504. X     The key word %text indicates that the button label  is  some
  505. X     text.   The  text can be split over three lines by using the
  506. X     new line character \n.  For example:
  507. X
  508. X                      %text Line1\nLine2\nLine3
  509. X
  510. X     would be presented as:
  511. X                                Line1
  512. X                                Line2
  513. X                                Line3
  514. X
  515. X     Once a  button  has  been  selected  it  is  prevented  from
  516. X     accidentally  being  re-selected by "graying out" the button
  517. X     (default action).  Sometimes however it maybe  desirable  to
  518. X     allow the button to be selected more than once.  This can be
  519. X     done be using the keyword %icon+ or %text+
  520. X
  521. X
  522. X
  523. X
  524. Sun Release 4.1   Last change: 28th March 1992                  1
  525. X
  526. X
  527. X
  528. X
  529. X
  530. X
  531. BRICONS(l)        MISC. REFERENCE MANUAL PAGES         BRICONS(l)
  532. X
  533. X
  534. X
  535. X     The next line in the .briconsrc file should  either  contain
  536. X     the key word %sub_menu or the application to be started.  If
  537. X     the name of an application  is given then a check is made to
  538. X     see if such an program can be executed.  If the program does
  539. X     not exist or is not in the users path then an error  message
  540. X     is printed and the button associated with the application is
  541. X     ignored.
  542. X
  543. X     If the key word %sub_menu is used then a pop-up sub menu  is
  544. X     created.   Any further buttons defined in the briconsrc file
  545. X     will appear in the sub menu for that button  until  the  key
  546. X     word  %end_sub_menu  is found.  A maximum of ten buttons are
  547. X     allowed in a single pop-up sub menu.
  548. X
  549. X     Any line in the .briconsrc file starting with a #  character
  550. X     is treated as a comment and will be ignored.
  551. X
  552. X     This program has four default buttons labelled source, edit,
  553. X     help  and  quit.   The  edit  button allows the user to edit
  554. X     there icon file (default being an empty source button causes
  555. X     the  program  to  distory  all  the  current  buttons  being
  556. X     displayed and re-read the icon file and display the new but-
  557. X     tons.
  558. X
  559. OPTIONS
  560. X     bricons accepts all of  the  standard  X   Toolkit   command
  561. X     line options along with the additional options listed below:
  562. X
  563. X     -file
  564. X          Tells the program to read  this  file  instead  of  the
  565. X          default file.
  566. X
  567. X     -col Indicates the number of  buttons  in  a  column  before
  568. X          starting  a  new row.  The default number of columns is
  569. X          15.
  570. X
  571. X     -help
  572. X          Tells the program the path for the help file.
  573. X
  574. X     -sensitive
  575. X          Toggle used for default "graying out" of selected  but-
  576. X          tons.   If  set  to  TRUE  then buttons will "gray out"
  577. X          unless specifically requested not to.
  578. X
  579. X     -bmdir
  580. X          This program will search the default  bitmap  directory
  581. X          (./bitmaps)  for  any  bitmaps  that  are to be used to
  582. X          represent buttons.  If you wish to add different bitmap
  583. X          directories  then  use  this command line argument fol-
  584. X          lowed by a colon separated list  of  path  names.   For
  585. X          example  if  the  program  needs to find bitmaps in two
  586. X          different directories then the following can be entered
  587. X
  588. X
  589. X
  590. Sun Release 4.1   Last change: 28th March 1992                  2
  591. X
  592. X
  593. X
  594. X
  595. X
  596. X
  597. BRICONS(l)        MISC. REFERENCE MANUAL PAGES         BRICONS(l)
  598. X
  599. X
  600. X
  601. X          at the command line:
  602. X
  603. X           bricons -bmdir /usr/local/bitmaps:/usr/mydir/bitmaps
  604. X
  605. X
  606. XX DEFAULTS
  607. X     The bricons program reads the .Xdefaults file  and  Xbricons
  608. X     resource  file  during  startup  and  uses  the  appropriate
  609. X     resource  specification  to  customise  the  appearance   or
  610. X     characteristics  of  its  display.  This program understands
  611. X     all of the core resource names and classes as well as:
  612. X
  613. X     no_of_cols
  614. X          Specifies the number of buttons in a column.
  615. X
  616. X     icon_file
  617. X          Specifies path name for icon file to be read.
  618. X
  619. X     help_file
  620. X          Specifies path name for help file.
  621. X
  622. X     icon_dirs
  623. X          Specifies path name for bitmap directories.
  624. X
  625. X
  626. SETTING BITMAP DIRECTORIES
  627. X     This section explains how to specify bitmap file paths using
  628. X     the  .Xdefaults  file.  For the quickest and simplest method
  629. X     see the OPTIONS section under -bmdir.
  630. X
  631. X     This program will search the default  bitmap  directory  for
  632. X     any bitmaps that are to be used to represent buttons. If the
  633. X     user wishes the program to search other directories for bit-
  634. X     map  files  then  this  should  be  specified  in  the users
  635. X     .X11defaults file.  *BitmapFilePath: should  be  added  fol-
  636. X     lowed  by  colon separated path names where the bitmap files
  637. X     can be found.  For example:
  638. X
  639. X     *BitmapFilePath:    /usr/local/include/X11/bitmaps:/usr/mydir/bitmaps
  640. X
  641. RESOURCE FILES
  642. X     The Xbricons file specifies the required resources.  To make
  643. X     sure  the  program uses the resources file set the following
  644. X     line in your .login:
  645. X            setenv  XUSERFILESEARCHPATH ~/app_defaults/%N
  646. X
  647. X     and place all all resources in the app_defaults directory.
  648. X
  649. WIDGETS
  650. X     The bricons program is  a  toolkit-based  application  which
  651. X     consists  of  a combination of widgets.  In order to specify
  652. X     resources, it is useful to know the hierarchy of the widgets
  653. X
  654. X
  655. X
  656. Sun Release 4.1   Last change: 28th March 1992                  3
  657. X
  658. X
  659. X
  660. X
  661. X
  662. X
  663. BRICONS(l)        MISC. REFERENCE MANUAL PAGES         BRICONS(l)
  664. X
  665. X
  666. X
  667. X     which compose bricons.  In the list below, indentation indi-
  668. X     cates hierarchical structure.   The  widget  class  name  is
  669. X     given first, followed by the widget instance name.
  670. X
  671. X          Xbricons  toplevel
  672. X               Form box
  673. X                    Command   action[18]
  674. X                    OverrideShell  popup_shell
  675. X                         Form popup_layout
  676. X                         Command   sub_action[10]
  677. X
  678. EXAMPLE
  679. X     Below is an example of a simple .briconsrc file:
  680. X
  681. X     # <-- a line starting with a '#' is a comment line
  682. X     #
  683. X     #       Bri's icon file
  684. X     #
  685. X
  686. X     # first line must have keyword %icon or %text
  687. X     # to indicate if button is an icon
  688. X
  689. X     %icon calculator
  690. X     xcalc
  691. X     %text Games\n sub\n menu
  692. X     %sub_menu
  693. X          %text xeyes
  694. X          xeyes
  695. X          %text othello
  696. X          othello
  697. X     %end_sub_menu
  698. X
  699. X
  700. X
  701. BUGS
  702. X     After selecting the source button the  buttons  may  not  be
  703. X     re-displayed  correctly.   Selecting  the  source  button  a
  704. X     second time may help.
  705. X
  706. AUTHOR
  707. X     Bruce R Ingram, University of Kent at Canterbury.
  708. X
  709. X
  710. X
  711. X
  712. X
  713. X
  714. X
  715. X
  716. X
  717. X
  718. X
  719. X
  720. X
  721. X
  722. Sun Release 4.1   Last change: 28th March 1992                  4
  723. X
  724. X
  725. X
  726. SHAR_EOF
  727. chmod 0644 bricons.txt ||
  728. echo 'restore of bricons.txt failed'
  729. Wc_c="`wc -c < 'bricons.txt'`"
  730. test 8068 -eq "$Wc_c" ||
  731.     echo 'bricons.txt: original size 8068, current size' "$Wc_c"
  732. rm -f _shar_wnt_.tmp
  733. fi
  734. # ============= README ==============
  735. if test -f 'README' -a X"$1" != X"-c"; then
  736.     echo 'x - skipping README (File already exists)'
  737.     rm -f _shar_wnt_.tmp
  738. else
  739. > _shar_wnt_.tmp
  740. echo 'x - extracting README (Text)'
  741. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  742. PROGRAM
  743. X    bricons
  744. X
  745. DESCRIPTION
  746. X    The bricons program allows the user to start up applications 
  747. X    from a configured command panel on a workstation display 
  748. X    running X.  The bricons interface can consist of up to sixteen
  749. X    buttons which can display some text or an icon. Each button is 
  750. X    used to execute a shell command using the Bourne shell.
  751. X    Each button can be configured to display a single spring 
  752. X    loaded popup menu with up to ten more buttons.
  753. X
  754. COMPILATION
  755. X    Assuming a good X installation at your site, simply:
  756. X
  757. X        xmkmf ; make
  758. X
  759. X    Otherwise use the Makefile provided.
  760. X
  761. CONFIGURATION
  762. X    Once the bricons program has been successfully compiled it can
  763. X    be executed straight away it should display some example buttons
  764. X    one of which is a sub menu.
  765. X
  766. X    The bricons program looks for a .briconsrc configuration file in
  767. X    your home directory otherwise it looks in the current directory
  768. X    for the file.
  769. X
  770. PORTABILITY
  771. X    The bricons program has been compiled and tested on the following:
  772. X
  773. X    machine         SPARC workstation1     SPARC workstation2 
  774. X    operating system    SunOS 4.1.1        SunOS 4.1.2_ER
  775. X
  776. X    machine            DEC3100         VAX station
  777. X    operating system    Ultrix Worksystem V2.1    Ultrix-32 V3.1
  778. X                (Rev 14)        (Rev. 9)
  779. X
  780. X    machine            Sun3
  781. X    operating system    SunOS 4.1.1    
  782. X
  783. ACKNOWLEDGEMENTS
  784. X    Many thanks go to Richard Hesketh and Martin Davy for all their
  785. X    help and advice.
  786. X
  787. ___________________________________________________________________________
  788. X    Bruce Ingram    email    bri@ukc.ac.uk
  789. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  790. SHAR_EOF
  791. chmod 0755 README ||
  792. echo 'restore of README failed'
  793. Wc_c="`wc -c < 'README'`"
  794. test 1515 -eq "$Wc_c" ||
  795.     echo 'README: original size 1515, current size' "$Wc_c"
  796. rm -f _shar_wnt_.tmp
  797. fi
  798. # ============= gen.h ==============
  799. if test -f 'gen.h' -a X"$1" != X"-c"; then
  800.     echo 'x - skipping gen.h (File already exists)'
  801.     rm -f _shar_wnt_.tmp
  802. else
  803. > _shar_wnt_.tmp
  804. echo 'x - extracting gen.h (Text)'
  805. sed 's/^X//' << 'SHAR_EOF' > 'gen.h' &&
  806. static char* sccs_gen_h = "%W%%G%";
  807. X
  808. #include <stdio.h>
  809. #include <sys/param.h>
  810. #include <sys/stat.h>
  811. #include <X11/Xos.h>
  812. #include <X11/Intrinsic.h>
  813. #include <X11/StringDefs.h>
  814. #include <X11/Xaw/Form.h>
  815. #include <X11/Xaw/Command.h>
  816. #include <X11/Xaw/MenuButton.h>
  817. #include <X11/Shell.h>
  818. #include <X11/Xaw/Cardinals.h>
  819. #include <stdlib.h> 
  820. #include <malloc.h>
  821. #include <ctype.h>
  822. #include <unistd.h>
  823. X
  824. /*
  825. X    Macro for using prototypes if ANSI C is available.
  826. */
  827. #ifdef __STDC__
  828. #define PROTO(x) x
  829. #else
  830. #define PROTO(x) ()
  831. #endif
  832. X
  833. #define    MAXLINE        500    
  834. #define    MAXBUTTONS    16        /* max number of "buttons" */
  835. #define    MAXSUBBUTTONS    9    /* max number of sub menu buttons */
  836. #define NO_OF_COLS  18        /* default number of columns */
  837. #define    W_WIDTH        55        /* width of "button" widgets */
  838. #define    W_HEIGHT    55        /* height of "button" widgets */
  839. X
  840. #define    EDITOR        "xterm -e vi "    /* editor used to edit icon file. */
  841. #define    FORMATTER    "xterm -e vi "  /* text formatter for help file */
  842. #define    HELP_VIEWER    " "        /* viewer for help file */
  843. X
  844. #define    MAXPROCS    20
  845. X
  846. #define    ICON        1    
  847. #define    TEXT        2
  848. #define    SUB_MENU    3
  849. #define    END_SUB_MENU    4
  850. #define    UNKNOWN        5
  851. #define    END        6
  852. #define    TEXTPLUS    7
  853. #define    ICONPLUS    8
  854. X
  855. #ifndef MAXPATHLEN
  856. #define MAXPATHLEN    1024
  857. #endif
  858. X
  859. #define    RESOURCE_NAME    ".bitmapFilePath: "
  860. #define    RESOURCE_VALUE    "/bitmaps"
  861. /*
  862. X    structure for holding info on number of buttons created, number of
  863. X    columns & file to be read.
  864. */
  865. typedef struct    info{
  866. X        int    no_of_buttons;
  867. X        int    no_of_columns;
  868. X        Boolean    sensitive;
  869. X        Boolean    default_buttons;
  870. X        char    *icon_file;
  871. X        char    *help_file;
  872. }Info;
  873. X
  874. typedef struct    c_id{
  875. X        int    child_id;
  876. X        Widget    w_id;
  877. }ChildInfo;
  878. X
  879. ChildInfo    ci_ptr[MAXPROCS];
  880. X
  881. /* forward declarations */
  882. int    fprintf(), ungetc(), fclose(), fscanf();
  883. char    *strcpy(), *getenv(), *malloc(); 
  884. X
  885. typedef int     bool_t;
  886. X
  887. SHAR_EOF
  888. chmod 0644 gen.h ||
  889. echo 'restore of gen.h failed'
  890. Wc_c="`wc -c < 'gen.h'`"
  891. test 1802 -eq "$Wc_c" ||
  892.     echo 'gen.h: original size 1802, current size' "$Wc_c"
  893. rm -f _shar_wnt_.tmp
  894. fi
  895. # ============= patchlevel.h ==============
  896. if test -f 'patchlevel.h' -a X"$1" != X"-c"; then
  897.     echo 'x - skipping patchlevel.h (File already exists)'
  898.     rm -f _shar_wnt_.tmp
  899. else
  900. > _shar_wnt_.tmp
  901. echo 'x - extracting patchlevel.h (Text)'
  902. sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
  903. #define PATCH_LEVEL 0
  904. SHAR_EOF
  905. chmod 0644 patchlevel.h ||
  906. echo 'restore of patchlevel.h failed'
  907. Wc_c="`wc -c < 'patchlevel.h'`"
  908. test 22 -eq "$Wc_c" ||
  909.     echo 'patchlevel.h: original size 22, current size' "$Wc_c"
  910. rm -f _shar_wnt_.tmp
  911. fi
  912. # ============= trans.h ==============
  913. if test -f 'trans.h' -a X"$1" != X"-c"; then
  914.     echo 'x - skipping trans.h (File already exists)'
  915.     rm -f _shar_wnt_.tmp
  916. else
  917. > _shar_wnt_.tmp
  918. echo 'x - extracting trans.h (Text)'
  919. sed 's/^X//' << 'SHAR_EOF' > 'trans.h' &&
  920. static char* sccs_trans_h = "%W%%G%";
  921. X
  922. /*
  923. X    translations for the main menu buttons to popup the sub menu.  
  924. X    SetPopup positions the shell.  MenuPopup realizes the shell.
  925. */
  926. X
  927. static    String pb_Trans =
  928. X    "<EnterWindow>:    highlight() \n\
  929. X    <LeaveWindow>:    unhighlight() \n\
  930. X    <Btn1Down>:    set_popup(box.action%d.popup_menu) MenuPopup(popup_menu) unhighlight()";
  931. X
  932. /*
  933. X    translations for the command buttons of the popup menus the
  934. X    command callback is invoked when the button is released with
  935. X    the pointer in the command widget.
  936. */
  937. X
  938. static    String cb_Trans =
  939. X    "<EnterWindow>:    set() \n\
  940. X    <LeaveWindow>:    unset() \n\
  941. X    <Btn1Up>:    notify() delay() reset()";
  942. X
  943. /*
  944. X    translations for the shell of the popup menu.  When the button
  945. X    is released the shell catches it and pops itself down.
  946. */
  947. X
  948. static    String pm_Trans =
  949. X    "<Btn1Up>:    MenuPopdown()";
  950. X
  951. /* add new actions to this program */
  952. X
  953. static    XtActionsRec    menu_actions[] = {
  954. X    { "set_popup", set_popup },
  955. X    { "delay", delay }
  956. };
  957. X
  958. /*  the name of the shell, used by SetPopup and MenuPopup actions */
  959. static  String popup_menu_name = "popup_menu";
  960. X
  961. SHAR_EOF
  962. chmod 0644 trans.h ||
  963. echo 'restore of trans.h failed'
  964. Wc_c="`wc -c < 'trans.h'`"
  965. test 1066 -eq "$Wc_c" ||
  966.     echo 'trans.h: original size 1066, current size' "$Wc_c"
  967. rm -f _shar_wnt_.tmp
  968. fi
  969. # ============= widgets.h ==============
  970. if test -f 'widgets.h' -a X"$1" != X"-c"; then
  971.     echo 'x - skipping widgets.h (File already exists)'
  972.     rm -f _shar_wnt_.tmp
  973. else
  974. > _shar_wnt_.tmp
  975. echo 'x - extracting widgets.h (Text)'
  976. sed 's/^X//' << 'SHAR_EOF' > 'widgets.h' &&
  977. X
  978. Widget  toplevel,       /* must exist on which to place other widgets */
  979. X        box,
  980. X            action[MAXBUTTONS + 1],
  981. X            popup_shell,
  982. X                popup_layout,
  983. X                sub_action[10];
  984. SHAR_EOF
  985. chmod 0644 widgets.h ||
  986. echo 'restore of widgets.h failed'
  987. Wc_c="`wc -c < 'widgets.h'`"
  988. test 162 -eq "$Wc_c" ||
  989.     echo 'widgets.h: original size 162, current size' "$Wc_c"
  990. rm -f _shar_wnt_.tmp
  991. fi
  992. # ============= action.c ==============
  993. if test -f 'action.c' -a X"$1" != X"-c"; then
  994.     echo 'x - skipping action.c (File already exists)'
  995.     rm -f _shar_wnt_.tmp
  996. else
  997. > _shar_wnt_.tmp
  998. echo 'x - extracting action.c (Text)'
  999. sed 's/^X//' << 'SHAR_EOF' > 'action.c' &&
  1000. #include "gen.h"
  1001. #include "widgets.h"
  1002. #include <signal.h>
  1003. #include <sys/wait.h>
  1004. #include <stdio.h>
  1005. X
  1006. extern    XtAppContext    app_context;
  1007. X
  1008. static void     catch_child();
  1009. static void    ResetButton PROTO((XtPointer,XtIntervalId *));
  1010. extern  int     ProcessFile PROTO((Info*, char*));
  1011. extern  void    PositionButtons PROTO((int,int));
  1012. extern    void    ManageButtons();
  1013. X
  1014. extern void 
  1015. Quit(widget, client_data,call_data)
  1016. Widget          widget;
  1017. XXtPointer       client_data;
  1018. XXtPointer       call_data;
  1019. {
  1020. X    /* exit graciously */
  1021. X    XtDestroyWidget(toplevel);
  1022. X        exit(0);
  1023. }
  1024. X
  1025. X
  1026. extern void 
  1027. MultiAction(widget,client_data,call_data)
  1028. Widget          widget;
  1029. XXtPointer       client_data;
  1030. XXtPointer       call_data;
  1031. {
  1032. X    char    *command = (char*) client_data;
  1033. X    int    pid;
  1034. X    static    bool_t first_time = TRUE;
  1035. X    char    *exec_command;    /* for "exec " + command */
  1036. X
  1037. #define PREPEND "exec "
  1038. X
  1039. X        if (first_time) 
  1040. X    {
  1041. X            first_time = FALSE;
  1042. X        if ((int) signal(SIGCHLD, catch_child) == -1) 
  1043. X        {
  1044. X            (void) fprintf(stderr,"unable to install child catcher");
  1045. X            exit(1);
  1046. X        }
  1047. X    }
  1048. X
  1049. X    switch(pid = fork())
  1050. X    {
  1051. X        case -1:
  1052. X            (void) fprintf(stderr,"ERROR: Process cannot fork\n");
  1053. X            (void) fprintf(stderr,"Sorry unable to execute command\n");
  1054. X            break;
  1055. X        case 0:
  1056. X            /* child */
  1057. X            exec_command = malloc((unsigned) sizeof(PREPEND) +
  1058. X                strlen(command) + 1);
  1059. X            if(exec_command == NULL)
  1060. X            {
  1061. X                (void) fprintf(stderr,"ERROR: out of memory\n");
  1062. X                exit(1);
  1063. X            }
  1064. X            strcpy(exec_command,PREPEND);
  1065. X            strcat(exec_command,command);
  1066. X            (void)execlp("/bin/sh","sh","-c",exec_command,(char *) 0);
  1067. X            exit(127);
  1068. X            break;
  1069. X    }
  1070. }
  1071. X
  1072. X
  1073. extern void 
  1074. SingleAction(widget,client_data,call_data)
  1075. Widget          widget;
  1076. XXtPointer       client_data;
  1077. XXtPointer       call_data;
  1078. {
  1079. X    char    *command = (char*) client_data;
  1080. X    int    pid;
  1081. X    int    i = 0;
  1082. X    static    bool_t first_time = TRUE;
  1083. X    char    *exec_command;    /* for "exec " + command */
  1084. X
  1085. #define PREPEND "exec "
  1086. X
  1087. /*
  1088. X    This section of code was taken from xalias written by Godfrey Paul
  1089. X        First time only, arrange for SIGCHLD to be called.
  1090. */
  1091. X        if (first_time) 
  1092. X    {
  1093. X            first_time = FALSE;
  1094. X        if ((int) signal(SIGCHLD, catch_child) == -1) 
  1095. X        {
  1096. X            (void) fprintf(stderr,"unable to install child catcher");
  1097. X            exit(1);
  1098. X        }
  1099. X    }
  1100. X
  1101. X    switch(pid = fork())
  1102. X    {
  1103. X        case -1:
  1104. X            (void) fprintf(stderr,"ERROR: Process cannot fork\n");
  1105. X            (void) fprintf(stderr,"Sorry unable to execute command\n");
  1106. X            break;
  1107. X        case 0:
  1108. X            /* child */
  1109. X            exec_command = malloc((unsigned) sizeof(PREPEND) +
  1110. X                strlen(command) + 1);
  1111. X            if(exec_command == NULL)
  1112. X            {
  1113. X                (void) fprintf(stderr,"ERROR: out of memory\n");
  1114. X                exit(1);
  1115. X            }
  1116. X            strcpy(exec_command,PREPEND);
  1117. X            strcat(exec_command,command);
  1118. X            (void)execlp("/bin/sh","sh","-c",exec_command,(char *) 0);
  1119. X            exit(127);
  1120. X            break;
  1121. X    }
  1122. X    while((ci_ptr[i].child_id != 0) && (i < MAXPROCS))
  1123. X            i++;
  1124. X    if(i < MAXPROCS)
  1125. X    {
  1126. X        ci_ptr[i].child_id = pid;
  1127. X        ci_ptr[i].w_id = widget;
  1128. X        XtSetSensitive(widget,False);
  1129. X    }
  1130. X    else
  1131. X        (void) printf("\nWarning: unable to deactivate selected button\n");
  1132. X
  1133. }
  1134. X
  1135. X
  1136. /*
  1137. X    This section of code was taken from xalias written by Godfrey Paul
  1138. */
  1139. static void
  1140. catch_child()
  1141. {
  1142. X        int         pid;
  1143. X    int        i = 0;
  1144. X        union wait      status;
  1145. X
  1146. X
  1147. X        /*
  1148. X         * wait3() returns -1 if the are no children left, or 0
  1149. X         * if there are no exited children.
  1150. X         */
  1151. X        while ((pid = wait3(&status, WNOHANG, (struct rusage *) NULL)) > 0)
  1152. X    {
  1153. X
  1154. X        while((ci_ptr[i].child_id != pid) && (i < MAXPROCS))
  1155. X                i++;
  1156. X        if(ci_ptr[i].child_id == pid)
  1157. X        {
  1158. X            XtAppAddTimeOut(app_context,50,ResetButton,pid);
  1159. X        }
  1160. X    }
  1161. X        return;
  1162. }
  1163. X
  1164. extern void
  1165. Source(widget,client_data,call_data)
  1166. Widget          widget;
  1167. XXtPointer       client_data;
  1168. XXtPointer       call_data;
  1169. {
  1170. X    Info    *data = (Info*) client_data;
  1171. X
  1172. X    int        x = 0;
  1173. X    WidgetList    w_list;
  1174. X    Cardinal    num_childern, i;
  1175. X    if(data->no_of_buttons >= 0)
  1176. X    {
  1177. X        while(x < MAXPROCS)
  1178. X        {
  1179. X            ci_ptr[x].child_id = 0;
  1180. X            ci_ptr[x].w_id = NULL;
  1181. X            x++;
  1182. X        }
  1183. X        XtUnmanageChild(box);
  1184. X        XtVaGetValues(
  1185. X            box,
  1186. X            XtNchildren,
  1187. X            &w_list,
  1188. X            XtNnumChildren,
  1189. X            &num_childern,
  1190. X            NULL);
  1191. X
  1192. X        for(i = 0; i < num_childern; i++)
  1193. X        {
  1194. X            XtDestroyWidget(w_list[i]);
  1195. X        }
  1196. X        data->no_of_buttons = 0;
  1197. X        data->no_of_buttons = ProcessFile(data, "bricons");
  1198. X        PositionButtons(data->no_of_buttons,data->no_of_columns);
  1199. X        ManageButtons();
  1200. X        XtManageChild(box);
  1201. X    }
  1202. }
  1203. X
  1204. static void
  1205. ResetButton(client_data,id)
  1206. XXtPointer       client_data;
  1207. XXtIntervalId    *id;
  1208. {
  1209. X    int    c_pid = (int) client_data;
  1210. X    int    i = 0;
  1211. X    while((ci_ptr[i].child_id != c_pid) && (i < MAXPROCS))
  1212. X            i++;
  1213. X    if(ci_ptr[i].child_id == c_pid)
  1214. X    {
  1215. X        XtSetSensitive(ci_ptr[i].w_id,True);
  1216. X        ci_ptr[i].child_id = 0;
  1217. X    }
  1218. }
  1219. SHAR_EOF
  1220. chmod 0644 action.c ||
  1221. echo 'restore of action.c failed'
  1222. Wc_c="`wc -c < 'action.c'`"
  1223. test 4594 -eq "$Wc_c" ||
  1224.     echo 'action.c: original size 4594, current size' "$Wc_c"
  1225. rm -f _shar_wnt_.tmp
  1226. fi
  1227. # ============= buttons.c ==============
  1228. if test -f 'buttons.c' -a X"$1" != X"-c"; then
  1229.     echo 'x - skipping buttons.c (File already exists)'
  1230.     rm -f _shar_wnt_.tmp
  1231. else
  1232. > _shar_wnt_.tmp
  1233. echo 'x - extracting buttons.c (Text)'
  1234. sed 's/^X//' << 'SHAR_EOF' > 'buttons.c' &&
  1235. static char* sccs_buttons_c = "%W%%G%";
  1236. X
  1237. #include "gen.h"
  1238. #include "widgets.h"
  1239. X
  1240. X
  1241. extern void    CreateSubButton PROTO((Info*, int, int, char*));
  1242. extern    void    CreateMainMenuButton PROTO((Info*, int, int, char*, char*));
  1243. static    void    CreateDefaultSubButton PROTO((int, char*, int));
  1244. extern  void    Quit PROTO((Widget,XtPointer,XtPointer)),
  1245. X        SingleAction PROTO((Widget,XtPointer,XtPointer)),
  1246. X        MultiAction PROTO((Widget,XtPointer,XtPointer)),
  1247. X                ReadALine PROTO((FILE*,char **)),
  1248. X                Source PROTO((Widget,XtPointer,XtPointer));
  1249. extern  void    set_popup PROTO((Widget,XEvent *,String *,Cardinal *));
  1250. extern    void    delay PROTO((Widget,XEvent *,String *,Cardinal *));
  1251. X
  1252. static  void    SetButton PROTO((int,char *,int));
  1253. static  void    SetSubMenuButton PROTO((int,char *,int));
  1254. static    void    CreatePopupShell PROTO((int));
  1255. extern    void    CreateSubMenuButton PROTO((int, char *, int, char*, int));
  1256. extern    void    DefaultButtons PROTO((Info *,int));
  1257. X
  1258. #include "trans.h"
  1259. X
  1260. X
  1261. extern void
  1262. CreateSubButton(data, button_no, is_icon, label)
  1263. Info    *data;
  1264. int        button_no;
  1265. int        is_icon;
  1266. char    *label;
  1267. {
  1268. X    char    w_buffer[80];
  1269. X    char    ptrans[250];
  1270. X
  1271. X    /* 
  1272. X        create translations for the button that 
  1273. X        pops up the sub menu
  1274. X    */
  1275. X    (void) sprintf(ptrans, pb_Trans, button_no, popup_menu_name);
  1276. X
  1277. X    /* create main menu button that will popup sub menu */
  1278. X    (void) sprintf(w_buffer, "action%d", button_no);
  1279. X    action[button_no] = XtVaCreateWidget(
  1280. X            w_buffer,
  1281. X            commandWidgetClass,
  1282. X            box,
  1283. X            NULL);
  1284. X
  1285. X    XtVaSetValues(action[button_no],
  1286. X            XtNtranslations,
  1287. X            XtParseTranslationTable(ptrans),
  1288. X            NULL);
  1289. X
  1290. X    SetButton(is_icon, label, button_no);
  1291. X    CreatePopupShell(button_no);
  1292. }
  1293. X
  1294. X
  1295. extern void
  1296. CreateMainMenuButton(data, button_no, is_icon, label, command)
  1297. Info    *data;
  1298. int    button_no;
  1299. int    is_icon;
  1300. char    *label;
  1301. char    *command;
  1302. {
  1303. X        char    w_buffer[80];
  1304. X
  1305. X        (void) sprintf(w_buffer, "action%d", button_no);
  1306. X
  1307. X        action[button_no] = XtVaCreateWidget(
  1308. X                w_buffer,          /* widget name */    
  1309. X                commandWidgetClass,  /* widget class */
  1310. X                box,                /* parent widget */
  1311. X                NULL);       /* terminate varargs list */
  1312. X
  1313. X        SetButton(is_icon, label, button_no);
  1314. X
  1315. X        /* add callback for this button */
  1316. X        if(data->sensitive)
  1317. X        {
  1318. X            if((is_icon == TEXT) || (is_icon == ICON))
  1319. X                XtAddCallback(action[button_no],XtNcallback, SingleAction, command);
  1320. X            else
  1321. X                XtAddCallback(action[button_no],XtNcallback,
  1322. X                    MultiAction,command);
  1323. X        } 
  1324. X        else
  1325. X        {
  1326. X            if((is_icon == TEXT) || (is_icon == ICON))
  1327. X                XtAddCallback(action[button_no],XtNcallback,
  1328. X                    MultiAction,command);
  1329. X            else
  1330. X                XtAddCallback(action[button_no],XtNcallback,
  1331. X                    SingleAction,command);
  1332. X        }
  1333. }
  1334. X
  1335. static    void
  1336. SetButton(is_icon,icon,button_num)
  1337. int    is_icon;
  1338. char    *icon;
  1339. int    button_num;
  1340. {
  1341. X
  1342. X    /* if button title is a string then */
  1343. X    if((is_icon == TEXT) || (is_icon == TEXTPLUS))
  1344. X    {
  1345. X        XtVaSetValues(
  1346. X            action[button_num],
  1347. X            XtNwidth,
  1348. X            W_WIDTH,
  1349. X            XtNheight,
  1350. X            W_HEIGHT,
  1351. X            XtNlabel,
  1352. X            icon,    /* button title */
  1353. X            NULL);
  1354. X    }
  1355. X    /* if button title is a bitmap then */
  1356. X    if((is_icon == ICON) || (is_icon == ICONPLUS))    
  1357. X    {
  1358. X        XtVaSetValues(
  1359. X            action[button_num],
  1360. X            XtNwidth,
  1361. X            W_WIDTH,
  1362. X            XtNheight,
  1363. X            W_HEIGHT,
  1364. X            XtVaTypedArg,
  1365. X            XtNbitmap,
  1366. X            XtRString,
  1367. X            icon,    /* button title (bitmap) */
  1368. X            strlen(icon) +1,
  1369. X            NULL);
  1370. X    }
  1371. }
  1372. X
  1373. static    void
  1374. SetSubMenuButton(is_icon,icon,button_num)
  1375. int    is_icon;
  1376. char    *icon;
  1377. int    button_num;
  1378. {
  1379. X
  1380. X    /* if button title is a string then */
  1381. X    if((is_icon == TEXT) || (is_icon == TEXTPLUS))
  1382. X    {
  1383. X        XtVaSetValues(
  1384. X            sub_action[button_num],
  1385. X            XtNwidth,
  1386. X            W_WIDTH,
  1387. X            XtNheight,
  1388. X            W_HEIGHT,
  1389. X            XtNlabel,
  1390. X            icon,    /* button title */
  1391. X            NULL);
  1392. X    }
  1393. X    /* if button title is a bitmap then */
  1394. X    if((is_icon == ICON) || (is_icon == ICONPLUS))    
  1395. X    {
  1396. X        XtVaSetValues(
  1397. X            sub_action[button_num],
  1398. X            XtNwidth,
  1399. X            W_WIDTH,
  1400. X            XtNheight,
  1401. X            W_HEIGHT,
  1402. X            XtVaTypedArg,
  1403. X            XtNbitmap,
  1404. X            XtRString,
  1405. X            icon,    /* button title (bitmap) */
  1406. X            strlen(icon) +1,
  1407. X            NULL);
  1408. X    }
  1409. X    if(button_num > 0)
  1410. X        XtVaSetValues(sub_action[button_num], XtNfromVert,
  1411. X                sub_action[button_num - 1],NULL);
  1412. }
  1413. X
  1414. /*
  1415. X    The function PositionButtons places each button next to the 
  1416. X    previous button one until the number of buttons equals the 
  1417. X    number of columns.  Then a new row is started.
  1418. */
  1419. extern void
  1420. PositionButtons(i,columns)
  1421. int    i;
  1422. int    columns;
  1423. {
  1424. X    int    button_no;
  1425. X    int    position = 0;
  1426. X
  1427. X    button_no = 1;
  1428. X    while((button_no < columns) && (button_no <= i))
  1429. X    {
  1430. X        XtVaSetValues(action[button_no],
  1431. X            XtNfromHoriz,action[button_no - 1], NULL);
  1432. X        button_no++;
  1433. X    }
  1434. X    position = columns;
  1435. X    while(button_no <= i)
  1436. X    {
  1437. X        if(position == columns)
  1438. X        {
  1439. X            XtVaSetValues(action[button_no],
  1440. X                XtNfromVert,action[button_no - columns],NULL);
  1441. X            position = 0;
  1442. X        }
  1443. X        else
  1444. X        {
  1445. X            XtVaSetValues(action[button_no],
  1446. X                XtNfromVert,action[button_no - columns],NULL);
  1447. X            XtVaSetValues(action[button_no],
  1448. X                XtNfromHoriz,action[button_no -1],NULL);
  1449. X        }
  1450. X        position++;
  1451. X        button_no++;
  1452. X    }
  1453. }
  1454. X
  1455. /*
  1456. X    Once all the buttons have been created then make sure they are 
  1457. X    managed.
  1458. */
  1459. extern void
  1460. ManageButtons()
  1461. {
  1462. X    WidgetList      w_list;
  1463. X    Cardinal        num_childern, i;
  1464. X
  1465. X    XtVaGetValues(box,
  1466. X        XtNchildren,
  1467. X        &w_list,
  1468. X        XtNnumChildren,
  1469. X        &num_childern,
  1470. X        NULL);
  1471. X
  1472. X    for(i = 0; i < num_childern; i++)
  1473. X        XtManageChild(w_list[i]);
  1474. }
  1475. X
  1476. static    void
  1477. CreatePopupShell(shell_no)
  1478. int    shell_no;
  1479. {
  1480. X
  1481. X    popup_shell = XtCreatePopupShell(
  1482. X            "popup_menu",
  1483. X            overrideShellWidgetClass,
  1484. X            action[shell_no],
  1485. X            NULL,
  1486. X            0);
  1487. X
  1488. X    XtVaSetValues(popup_shell,
  1489. X            XtNtranslations,
  1490. X            XtParseTranslationTable(pm_Trans),
  1491. X            NULL);
  1492. X
  1493. X    popup_layout = XtCreateManagedWidget(
  1494. X            "popup_layout",
  1495. X            formWidgetClass,
  1496. X            popup_shell,
  1497. X            NULL,
  1498. X            0);
  1499. }
  1500. X
  1501. static    void
  1502. CreateDefaultSubButton(key_word,button_name,button_num)
  1503. int     key_word;
  1504. char    *button_name;
  1505. int     button_num;
  1506. {
  1507. X        char    w_buffer[80];
  1508. X
  1509. X        (void) sprintf(w_buffer,"sub_action%d",button_num);
  1510. X        sub_action[button_num] = XtVaCreateManagedWidget(
  1511. X                        w_buffer,
  1512. X                        menuButtonWidgetClass,
  1513. X                        popup_layout,
  1514. X                        NULL);
  1515. X
  1516. X        SetSubMenuButton(key_word,button_name,button_num); 
  1517. }
  1518. X
  1519. extern    void
  1520. CreateSubMenuButton(key_word, button_name, button_num, command, sensitive)
  1521. int    key_word;
  1522. char    *button_name;
  1523. int    button_num;
  1524. char    *command;
  1525. int    sensitive;
  1526. {
  1527. X    char    w_buffer[80];
  1528. X
  1529. X    (void) sprintf(w_buffer,"sub_action%d", button_num);
  1530. X    sub_action[button_num] = XtVaCreateManagedWidget(
  1531. X            w_buffer,
  1532. X            menuButtonWidgetClass,
  1533. X            popup_layout,
  1534. X            NULL);
  1535. X
  1536. X    SetSubMenuButton(key_word, button_name, button_num); 
  1537. X
  1538. X    if(sensitive)
  1539. X    {
  1540. X        if((key_word == TEXT) || (key_word == ICON))
  1541. X            XtAddCallback(sub_action[button_num],
  1542. X            XtNcallback,SingleAction,command);
  1543. X        else
  1544. X            XtAddCallback(sub_action[button_num],
  1545. X            XtNcallback,MultiAction,command);
  1546. X    }
  1547. X    else
  1548. X    {
  1549. X        if((key_word == TEXT) || (key_word == ICON))
  1550. X            XtAddCallback(sub_action[button_num],
  1551. X            XtNcallback,MultiAction,command);
  1552. X        else
  1553. X            XtAddCallback(sub_action[button_num],
  1554. X            XtNcallback,SingleAction,command);
  1555. X    }
  1556. X
  1557. X    XtVaSetValues(sub_action[button_num],
  1558. X            XtNtranslations,
  1559. X            XtParseTranslationTable(cb_Trans),
  1560. X            NULL);
  1561. }
  1562. X
  1563. extern    void
  1564. set_popup(w,event,params,num_params)
  1565. Widget    w;
  1566. XXEvent    *event;    /* unused */
  1567. String    *params;
  1568. Cardinal    *num_params;
  1569. {
  1570. X    /*
  1571. X        position the menu, whose name was passed as the first and
  1572. X        only parameter at position (20,5) relative to the widget w.
  1573. X    */
  1574. X    Widget    a_shell;
  1575. X    Position    x,y;
  1576. X
  1577. X    if(*num_params != 1)
  1578. X        XtError("Wrong parameter count passed to set_popup()");
  1579. X    
  1580. X    /* get the internal Widget id of the named shell */
  1581. X    a_shell = XtNameToWidget(toplevel,params[0]);
  1582. X    if(a_shell == NULL)
  1583. X        XtError("FATAL ERROR: Wrong shell name passed to set_popup()\n\
  1584. X            please check icon file is correct");
  1585. X    XtTranslateCoords(w,(Position) 5,(Position) 5, &x,&y);
  1586. X    XtVaSetValues(a_shell,XtNx,x,XtNy,y,NULL);
  1587. }
  1588. X
  1589. extern    void
  1590. delay(w,event,params,num_params)
  1591. Widget  w;
  1592. XXEvent  *event; /* unused */
  1593. String  *params;
  1594. Cardinal        *num_params;
  1595. {
  1596. X    (void) sleep(1);
  1597. }
  1598. X
  1599. extern    void
  1600. DefaultButtons(data,last_button)
  1601. Info    *data;
  1602. int    last_button;
  1603. {
  1604. X    int    string_length;
  1605. X    char    w_buffer[80];
  1606. X    char    ptrans[250];
  1607. X    char    *edit_file, *h_file;
  1608. X
  1609. X    /* create default sub menu which will contain source, edit & quit */
  1610. X    /* buttons.  Default menu button is called Manage  */
  1611. X
  1612. X    /* create main menu button */
  1613. X    (void) sprintf(ptrans,pb_Trans,last_button,popup_menu_name);
  1614. X
  1615. X    (void) sprintf(w_buffer,"action%d",last_button);
  1616. X    action[last_button] = XtVaCreateWidget(
  1617. X            w_buffer,
  1618. X            commandWidgetClass,
  1619. X            box,
  1620. X            NULL);
  1621. X
  1622. X    XtVaSetValues(action[last_button],XtNtranslations,
  1623. X            XtParseTranslationTable(ptrans),NULL);
  1624. X
  1625. X    SetButton(TEXT,"Edit\nIcons",last_button);
  1626. X
  1627. X    /* create popup shell */
  1628. X    CreatePopupShell(last_button);
  1629. X
  1630. X    CreateDefaultSubButton(TEXT,"Source",0);
  1631. X
  1632. X    XtAddCallback(sub_action[0],XtNcallback,Source,data);
  1633. X
  1634. X    XtVaSetValues(sub_action[0],XtNtranslations,
  1635. X                XtParseTranslationTable(cb_Trans),NULL);
  1636. X
  1637. X    CreateDefaultSubButton(TEXT,"Edit",1);
  1638. X
  1639. X    string_length = strlen(EDITOR);
  1640. X    string_length += strlen(data->icon_file);
  1641. X    if((edit_file = malloc(string_length +1)) == NULL)
  1642. X    {
  1643. X        (void) fprintf(stderr,"ERROR: out of memory for string edit_file.  In function CreateButtons.\n");
  1644. X        exit(1);
  1645. X    }
  1646. X    strcpy(edit_file,EDITOR);
  1647. X    strcat(edit_file,data->icon_file);
  1648. X
  1649. X    XtAddCallback(sub_action[1],XtNcallback,SingleAction,edit_file);
  1650. X
  1651. X    XtVaSetValues(sub_action[1],XtNtranslations,
  1652. X                XtParseTranslationTable(cb_Trans),NULL);
  1653. X
  1654. X    CreateDefaultSubButton(TEXT,"Help",2);
  1655. X
  1656. X    string_length = 0;
  1657. X    string_length = strlen(FORMATTER);
  1658. X    string_length += strlen(HELP_VIEWER);
  1659. X    string_length += strlen(data->help_file);
  1660. X    if((h_file = malloc(string_length +1)) == NULL)
  1661. X    {
  1662. X        (void) fprintf(stderr,"ERROR: out of memory for string edit_file.  In function CreateButtons.\n");
  1663. X        exit(1);
  1664. X    }
  1665. X    strcpy(h_file,FORMATTER);
  1666. X    strcat(h_file,data->help_file);
  1667. X    strcat(h_file,HELP_VIEWER);
  1668. X    XtAddCallback(sub_action[2],XtNcallback,SingleAction,h_file);
  1669. X
  1670. X    XtVaSetValues(sub_action[2],XtNtranslations,
  1671. X                XtParseTranslationTable(cb_Trans),NULL);
  1672. X
  1673. X    CreateDefaultSubButton(TEXT,"Quit",3);
  1674. X
  1675. X    XtAddCallback(sub_action[3],XtNcallback,Quit,NULL);
  1676. X
  1677. X    XtVaSetValues(sub_action[3],XtNtranslations,
  1678. X                XtParseTranslationTable(cb_Trans),NULL);
  1679. }
  1680. X
  1681. SHAR_EOF
  1682. chmod 0644 buttons.c ||
  1683. echo 'restore of buttons.c failed'
  1684. Wc_c="`wc -c < 'buttons.c'`"
  1685. test 10097 -eq "$Wc_c" ||
  1686.     echo 'buttons.c: original size 10097, current size' "$Wc_c"
  1687. rm -f _shar_wnt_.tmp
  1688. fi
  1689. # ============= gen.c ==============
  1690. if test -f 'gen.c' -a X"$1" != X"-c"; then
  1691.     echo 'x - skipping gen.c (File already exists)'
  1692.     rm -f _shar_wnt_.tmp
  1693. else
  1694. > _shar_wnt_.tmp
  1695. echo 'x - extracting gen.c (Text)'
  1696. sed 's/^X//' << 'SHAR_EOF' > 'gen.c' &&
  1697. static char* sccs_gen_c = "%W%%G%";
  1698. X
  1699. #include "gen.h"
  1700. #include <stdio.h>
  1701. X
  1702. static    int    IsExecutable PROTO((char *,char *)), 
  1703. X        Executable PROTO((char *));
  1704. extern    int    GetCommand PROTO((char*, char*, char*, char*, int));
  1705. extern    void    GetPath PROTO((char*));
  1706. X
  1707. /*
  1708. X    IsExecutable function searches along the users path trying to
  1709. X    locate the file program.  If found a check is made to see if it
  1710. X    is executable.  If it is TRUE is returned, otherwise FALSE is
  1711. X    returned.
  1712. */
  1713. static int
  1714. IsExecutable(path,program)
  1715. char    *path;
  1716. char    *program;
  1717. {
  1718. X    int i, j;
  1719. X    char    pathname[MAXPATHLEN];
  1720. X
  1721. X    i = 0;
  1722. X    if(*program == '/')
  1723. X    {
  1724. X        if(Executable(program))
  1725. X            return(TRUE);
  1726. X        else
  1727. X            return(FALSE);
  1728. X    }
  1729. X    while (path[i] != '\0')
  1730. X    {
  1731. X        if (path[i] == ' ')
  1732. X            ++i;
  1733. X        for (j = 0; path[i] != ' ' && path[i] != '\0'; ++i, ++j)
  1734. X            pathname[j] = path[i];
  1735. X        pathname[j++] = '/';
  1736. X        strcpy(&pathname[j], program);
  1737. X        if(Executable(pathname)) 
  1738. X            return(TRUE);
  1739. X    }
  1740. X    return(FALSE);
  1741. }
  1742. X
  1743. X
  1744. /*
  1745. X    GetCommand reads a line of text from the file pointed at by file
  1746. X    pointer fp.  It then checks if the first word is a valid command.
  1747. */
  1748. extern int
  1749. GetCommand(path, command, source_file, exe_name, line_no)
  1750. char    *path;
  1751. char    *command;
  1752. char    *source_file;
  1753. char    *exe_name;
  1754. int    line_no;
  1755. {
  1756. X    int    i = 0;
  1757. X    int    is_binary = FALSE;
  1758. X    char    prog_name[MAXPATHLEN];
  1759. X    char    *c_ptr;
  1760. X
  1761. X    prog_name[0] = '\0';
  1762. X    if(*command != NULL)
  1763. X    {
  1764. X        c_ptr = command;
  1765. X        /* get first word from line of text */
  1766. X        while((*c_ptr != ' ') && (*c_ptr != '\0') && (*c_ptr != ';') &&
  1767. X                (*c_ptr != '\n'))
  1768. X        {
  1769. X            if(*c_ptr == '`')
  1770. X                c_ptr++;
  1771. X            prog_name[i++] = *c_ptr++;
  1772. X        }
  1773. X        prog_name[i] = '\0';
  1774. X        if(IsExecutable(path,prog_name))
  1775. X            is_binary = TRUE;
  1776. X        else
  1777. X        {
  1778. X            (void) fprintf(stderr,"%s: Errr... in ", exe_name);
  1779. X            (void) fprintf(stderr,"\"%s\" file\nline: %d cannot execute [%s] (not on path?).\n", source_file, line_no, prog_name);
  1780. X        }
  1781. X    }
  1782. X    return(is_binary);
  1783. }
  1784. X
  1785. X
  1786. X
  1787. /*
  1788. X    The function GetPath fills in the given char array with the value of 
  1789. X    the environmental variable PATH, with spaces instead of colons, and a 
  1790. X    '.' in the appropriate place.
  1791. */
  1792. extern void
  1793. GetPath(p)
  1794. char *p;
  1795. {
  1796. X        char *path;
  1797. X
  1798. X        path = getenv("PATH");
  1799. X        if (*path == ':')
  1800. X                *p++ = '.';
  1801. X        while (*path != '\0') {
  1802. X                if (*path == ':')
  1803. X                        *p++ = ' ';
  1804. X                else
  1805. X                        *p++ = *path;
  1806. X                ++path;
  1807. X        }
  1808. X        if (*--path == ':')
  1809. X                *p++ = '.';
  1810. X        *p = '\0';
  1811. }
  1812. X
  1813. X
  1814. /*
  1815. X    The Executable  function returns True if file exists and is a directly 
  1816. X    executable Regular file. Otherwise False is returned.
  1817. X */
  1818. static int
  1819. Executable(file)
  1820. char *file;
  1821. {
  1822. X        struct stat st_buf;
  1823. X
  1824. X        if ( stat(file, &st_buf) != 0 )
  1825. X           return (FALSE); 
  1826. X        else 
  1827. X           return (S_IFREG & st_buf.st_mode) && (access(file,1)==0) && 
  1828. X        ( !(S_IFDIR & st_buf.st_mode) ) ; 
  1829. }
  1830. SHAR_EOF
  1831. chmod 0644 gen.c ||
  1832. echo 'restore of gen.c failed'
  1833. Wc_c="`wc -c < 'gen.c'`"
  1834. test 2863 -eq "$Wc_c" ||
  1835.     echo 'gen.c: original size 2863, current size' "$Wc_c"
  1836. rm -f _shar_wnt_.tmp
  1837. fi
  1838. # ============= main.c ==============
  1839. if test -f 'main.c' -a X"$1" != X"-c"; then
  1840.     echo 'x - skipping main.c (File already exists)'
  1841.     rm -f _shar_wnt_.tmp
  1842. else
  1843. > _shar_wnt_.tmp
  1844. echo 'x - extracting main.c (Text)'
  1845. sed 's/^X//' << 'SHAR_EOF' > 'main.c' &&
  1846. static char* sccs_main_c = "%W%%G%"; 
  1847. X
  1848. /* 
  1849. X * Copyright 1992 Bruce. R. Ingram.
  1850. X * University of Kent at Canterbury, UK
  1851. X *
  1852. X * Permission  to   use, copy, modify  and  distribute  this  software  and its
  1853. X * documentation   for any purpose is hereby granted without fee, provided that
  1854. X * the   above  copyright  notice  appear  in  all  copies  and  that both that
  1855. X * copyright  notice   and  this   permission   notice  appear  in   supporting
  1856. X * documentation,  and  that  the name  of the author and The University  of
  1857. X * Kent  at  Canterbury  not be  used in advertising or publicity pertaining to
  1858. X * distribution  of  the  software  without specific, written prior permission.
  1859. X * The   author  and   The   University   of   Kent at   Canterbury   make  no
  1860. X * representations  about  the  suitability  of this  software for any purpose.
  1861. X * It is provided "as is" without express or implied warranty.
  1862. X *
  1863. X * THE   AUTHOR  AND  THE  UNIVERSITY  OF KENT  AT   CANTERBURY  DISCLAIMS ALL
  1864. X * WARRANTIES  WITH  REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED  WARRANTIES
  1865. X * OF   MERCHANTABILITY  AND  FITNESS,  IN NO  EVENT  SHALL THE AUTHOR  OR THE
  1866. X * UNIVERSITY  OF KENT  AT  CANTERBURY  BE LIABLE FOR ANY SPECIAL, INDIRECT  OR
  1867. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS  OF USE,
  1868. X * DATA  OR  PROFITS,  WHETHER  IN  AN ACTION OF CONTRACT, NEGLIGENCE  OR OTHER
  1869. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  1870. X * OF THIS SOFTWARE.
  1871. X *
  1872. X * Author:
  1873. X *
  1874. X * Mr  B. R. Ingram email bri@ukc.ac.uk
  1875. */
  1876. X
  1877. #include "gen.h"
  1878. #include "widgets.h"
  1879. X
  1880. X
  1881. /*  Forward  references  */
  1882. X
  1883. extern    void    GetPath PROTO((char *));
  1884. extern    void    PositionButtons PROTO((int,int)), ManageButtons();
  1885. extern  void    set_popup PROTO((Widget,XEvent *,String *,Cardinal *));
  1886. extern    void    delay PROTO((Widget,XEvent *,String *,Cardinal *));
  1887. extern    void    Quit PROTO((Widget,XtPointer,XtPointer));
  1888. static    void    AddResource PROTO((char *, char *, int));
  1889. extern    int    ProcessFile PROTO((Info*, char*));
  1890. X
  1891. #include "trans.h"
  1892. X
  1893. /*
  1894. X    We set various default resources for the various widgets.
  1895. */
  1896. String fallback_resources[] = {
  1897. "*borderColor:        black",
  1898. SHAR_EOF
  1899. true || echo 'restore of main.c failed'
  1900. fi
  1901. echo 'End of  part 1'
  1902. echo 'File main.c is continued in part 2'
  1903. echo 2 > _shar_seq_.tmp
  1904. exit 0
  1905. -- 
  1906. Senior Systems Scientist        mail: dcmartin@msi.com
  1907. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1908. 796 North Pastoria Avenue        at&t: 408/522-9236
  1909. Sunnyvale, California 94086        fax: 408/732-0831
  1910.