home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sources / x / 432 < prev    next >
Encoding:
Text File  |  1992-07-29  |  50.1 KB  |  1,810 lines

  1. Newsgroups: comp.sources.x
  2. Path: sparky!uunet!darwin.sura.net!mips!msi!dcmartin
  3. From: jipping@cs.hope.edu (Mike Jipping)
  4. Subject: v18i063: XVTDL 3.0, Part02/06
  5. Message-ID: <1992Jul29.175029.14890@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-18i062-xvtdl-3.0@uunet.UU.NET>
  10. Date: Wed, 29 Jul 1992 17:50:29 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1796
  13.  
  14. Submitted-by: jipping@cs.hope.edu (Mike Jipping)
  15. Posting-number: Volume 18, Issue 63
  16. Archive-name: xvtdl-3.0/part02
  17.  
  18. #!/bin/sh
  19. # this is part.02 (part 2 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file bitmaps/tdl.pr continued
  22. #
  23. if test ! -r _shar_seq_.tmp; then
  24.     echo 'Please unpack part 1 first!'
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 2; then
  29.     echo Please unpack part "$Scheck" next!
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < _shar_seq_.tmp || exit 1
  35. if test ! -f _shar_wnt_.tmp; then
  36.     echo 'x - still skipping bitmaps/tdl.pr'
  37. else
  38. echo 'x - continuing file bitmaps/tdl.pr'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'bitmaps/tdl.pr' &&
  40. X    0xC000,0x0800,0x0000,0x1800,
  41. X    0xC000,0x0000,0x0000,0x1800,
  42. X    0xC000,0x0000,0x0000,0x1800,
  43. X    0xC000,0x0000,0x0000,0x1800,
  44. X    0xC000,0x0000,0x0000,0x1800,
  45. X    0xC000,0x0000,0x0000,0x1800,
  46. X    0xC000,0x0000,0x0000,0x1800,
  47. X    0xC000,0x0000,0x0000,0x1800,
  48. X    0xC000,0x0000,0x0000,0x1800,
  49. X    0xC000,0x0000,0x0000,0x1800,
  50. X    0xC000,0x0000,0x0000,0x1800,
  51. X    0xC000,0x0000,0x0000,0x1800,
  52. X    0xC000,0x0000,0x0000,0x1800,
  53. X    0xC000,0x0000,0x0000,0x1800,
  54. X    0xC000,0x0000,0x0000,0x1800,
  55. X    0xC000,0x0000,0x0000,0x1800,
  56. X    0xC000,0x0000,0x0000,0x1800,
  57. X    0xC000,0x0000,0x0000,0x1800,
  58. X    0xC000,0x0000,0x0000,0x1800,
  59. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  60. X    0xFFFF,0xFFFF,0xFFFF,0xF800
  61. SHAR_EOF
  62. echo 'File bitmaps/tdl.pr is complete' &&
  63. chmod 0644 bitmaps/tdl.pr ||
  64. echo 'restore of bitmaps/tdl.pr failed'
  65. Wc_c="`wc -c < 'bitmaps/tdl.pr'`"
  66. test 1997 -eq "$Wc_c" ||
  67.     echo 'bitmaps/tdl.pr: original size 1997, current size' "$Wc_c"
  68. rm -f _shar_wnt_.tmp
  69. fi
  70. # ============= bitmaps/tdl_empty.pr ==============
  71. if test -f 'bitmaps/tdl_empty.pr' -a X"$1" != X"-c"; then
  72.     echo 'x - skipping bitmaps/tdl_empty.pr (File already exists)'
  73.     rm -f _shar_wnt_.tmp
  74. else
  75. > _shar_wnt_.tmp
  76. echo 'x - extracting bitmaps/tdl_empty.pr (Text)'
  77. sed 's/^X//' << 'SHAR_EOF' > 'bitmaps/tdl_empty.pr' &&
  78. /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  79. X */
  80. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF800,
  81. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF800,
  82. X    0xC000,    0x0000,    0x0000,    0x18F8,
  83. X    0xC000,    0x0000,    0x0000,    0x19FC,
  84. X    0xC000,    0x0000,    0x0000,    0x19FC,
  85. X    0xC003,    0xE01F,    0x0000,    0x19FC,
  86. X    0xC002,    0xA009,    0x8000,    0x19FC,
  87. X    0xC000,    0x8608,    0x9800,    0x1904,
  88. X    0xC000,    0x8908,    0xA400,    0x1904,
  89. X    0xC000,    0x8908,    0xA400,    0x1904,
  90. X    0xC000,    0x8909,    0xA400,    0x19FC,
  91. X    0xC001,    0xC61F,    0x1800,    0x1904,
  92. X    0xC000,    0x0000,    0x0000,    0x1904,
  93. X    0xC000,    0x0000,    0x0000,    0x1904,
  94. X    0xC000,    0x0000,    0x0000,    0x19FC,
  95. X    0xC000,    0x0000,    0x0000,    0x19FC,
  96. X    0xC000,    0x0000,    0x0000,    0x1954,
  97. X    0xC000,    0x0000,    0x0000,    0x1954,
  98. X    0xC000,    0x0000,    0x0000,    0x1954,
  99. X    0xC000,    0x0000,    0x0000,    0x1954,
  100. X    0xC000,    0x0000,    0x0000,    0x1954,
  101. X    0xC000,    0x0000,    0x0000,    0x1954,
  102. X    0xC000,    0x0000,    0x0000,    0x1954,
  103. X    0xC000,    0x0000,    0x0000,    0x1954,
  104. X    0xC000,    0x0000,    0x0000,    0x1954,
  105. X    0xC000,    0x0000,    0x0000,    0x1954,
  106. X    0xC000,    0x0000,    0x0000,    0x1954,
  107. X    0xC000,    0x0000,    0x0000,    0x1954,
  108. X    0xC000,    0x0000,    0x0000,    0x1954,
  109. X    0xC000,    0x0000,    0x0000,    0x1954,
  110. X    0xC000,    0x0000,    0x0000,    0x1954,
  111. X    0xC000,    0x0000,    0x0000,    0x1954,
  112. X    0xC000,    0x0000,    0x0000,    0x1954,
  113. X    0xC000,    0x0000,    0x0000,    0x1954,
  114. X    0xC000,    0x0000,    0x0000,    0x1954,
  115. X    0xC000,    0x0000,    0x0000,    0x1954,
  116. X    0xC000,    0x0000,    0x0000,    0x1954,
  117. X    0xC000,    0x0000,    0x0000,    0x1954,
  118. X    0xC000,    0x0000,    0x0000,    0x1954,
  119. X    0xC000,    0x0000,    0x0000,    0x1954,
  120. X    0xC000,    0x0000,    0x0000,    0x1954,
  121. X    0xC000,    0x0000,    0x0000,    0x1954,
  122. X    0xC000,    0x0000,    0x0000,    0x1954,
  123. X    0xC000,    0x0000,    0x0000,    0x1954,
  124. X    0xC000,    0x0000,    0x0000,    0x1954,
  125. X    0xC000,    0x0000,    0x0000,    0x1954,
  126. X    0xC000,    0x0000,    0x0000,    0x1954,
  127. X    0xC000,    0x0000,    0x0000,    0x1954,
  128. X    0xC000,    0x0000,    0x0000,    0x1954,
  129. X    0xC000,    0x0000,    0x0000,    0x1954,
  130. X    0xC000,    0x0000,    0x0000,    0x1954,
  131. X    0xC000,    0x0000,    0x0000,    0x1954,
  132. X    0xC000,    0x0000,    0x0000,    0x1954,
  133. X    0xC000,    0x0000,    0x0000,    0x1954,
  134. X    0xC000,    0x0000,    0x0000,    0x19FC,
  135. X    0xC000,    0x0000,    0x0000,    0x1904,
  136. X    0xC000,    0x0000,    0x0000,    0x1904,
  137. X    0xC000,    0x0000,    0x0000,    0x1888,
  138. X    0xC000,    0x0000,    0x0000,    0x1888,
  139. X    0xC000,    0x0000,    0x0000,    0x1888,
  140. X    0xC000,    0x0000,    0x0000,    0x18F8,
  141. X    0xC000,    0x0000,    0x0000,    0x1870,
  142. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF870,
  143. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF820,
  144. SHAR_EOF
  145. chmod 0644 bitmaps/tdl_empty.pr ||
  146. echo 'restore of bitmaps/tdl_empty.pr failed'
  147. Wc_c="`wc -c < 'bitmaps/tdl_empty.pr'`"
  148. test 2190 -eq "$Wc_c" ||
  149.     echo 'bitmaps/tdl_empty.pr: original size 2190, current size' "$Wc_c"
  150. rm -f _shar_wnt_.tmp
  151. fi
  152. # ============= bitmaps/tdl_full.pr ==============
  153. if test -f 'bitmaps/tdl_full.pr' -a X"$1" != X"-c"; then
  154.     echo 'x - skipping bitmaps/tdl_full.pr (File already exists)'
  155.     rm -f _shar_wnt_.tmp
  156. else
  157. > _shar_wnt_.tmp
  158. echo 'x - extracting bitmaps/tdl_full.pr (Text)'
  159. sed 's/^X//' << 'SHAR_EOF' > 'bitmaps/tdl_full.pr' &&
  160. /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  161. X */
  162. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF81C,
  163. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF83E,
  164. X    0xC000,    0x0000,    0x0000,    0x187F,
  165. X    0xC000,    0x0000,    0x0000,    0x189F,
  166. X    0xC000,    0x0000,    0x0000,    0x198F,
  167. X    0xC003,    0xE01F,    0x0000,    0x1A46,
  168. X    0xC002,    0xA009,    0x8000,    0x1E24,
  169. X    0xC000,    0x8608,    0x9800,    0x1B18,
  170. X    0xC000,    0x8908,    0xA400,    0x1490,
  171. X    0xC000,    0x8908,    0xA400,    0x2960,
  172. X    0xC000,    0x8909,    0xA400,    0x5240,
  173. X    0xC001,    0xC61F,    0x1800,    0xA480,
  174. X    0xC000,    0x0000,    0x0001,    0x4900,
  175. X    0xFFFF,    0xFFFF,    0xFFFE,    0x9200,
  176. X    0xC000,    0x0000,    0x0005,    0x2400,
  177. X    0xC000,    0x0000,    0x000A,    0x4800,
  178. X    0xC000,    0x0000,    0x0014,    0x9800,
  179. X    0xC007,    0xCC06,    0x0029,    0x3800,
  180. X    0xC102,    0x2402,    0x0052,    0x5800,
  181. X    0xC302,    0x2402,    0x00A4,    0x9800,
  182. X    0xC103,    0xC463,    0x8149,    0x1800,
  183. X    0xC102,    0x2492,    0x4292,    0x1800,
  184. X    0xC102,    0x2472,    0x4524,    0x1800,
  185. X    0xC102,    0x2492,    0x4A48,    0x1800,
  186. X    0xC3A7,    0xCEFB,    0x5490,    0x1800,
  187. X    0xC000,    0x0000,    0x2920,    0x1800,
  188. X    0xC000,    0x0000,    0x5240,    0x1800,
  189. X    0xC000,    0x0000,    0xA480,    0x1800,
  190. X    0xC000,    0x0001,    0x4900,    0x1800,
  191. X    0xC000,    0x0002,    0x9200,    0x1800,
  192. X    0xC180,    0x7CC5,    0x2400,    0x1800,
  193. X    0xC240,    0x224A,    0x4800,    0x1800,
  194. X    0xC240,    0x2254,    0x9000,    0x1800,
  195. X    0xC040,    0x3C29,    0x2000,    0x1800,
  196. X    0xC080,    0x2252,    0x4000,    0x1800,
  197. X    0xC100,    0x22E4,    0x8000,    0x1800,
  198. X    0xC208,    0x2329,    0x0000,    0x1800,
  199. X    0xC3C8,    0x7D12,    0x0000,    0x1800,
  200. X    0xC000,    0x020C,    0x0000,    0x1800,
  201. X    0xC000,    0x0218,    0x0000,    0x1800,
  202. X    0xC000,    0x0660,    0x0000,    0x1800,
  203. X    0xC000,    0x0780,    0x0000,    0x1800,
  204. X    0xC000,    0x0E00,    0x0000,    0x1800,
  205. X    0xC180,    0x7CC0,    0x6000,    0x1800,
  206. X    0xC240,    0x2240,    0x2000,    0x1800,
  207. X    0xC040,    0x2240,    0x2000,    0x1800,
  208. X    0xC180,    0x3C46,    0x3800,    0x1800,
  209. X    0xC040,    0x2249,    0x2400,    0x1800,
  210. X    0xC240,    0x2247,    0x2400,    0x1800,
  211. X    0xC248,    0x2249,    0x2400,    0x1800,
  212. X    0xC188,    0x7CEF,    0xB600,    0x1800,
  213. X    0xC000,    0x0000,    0x0000,    0x1800,
  214. X    0xC000,    0x0000,    0x0000,    0x1800,
  215. X    0xC000,    0x0000,    0x0000,    0x1800,
  216. X    0xC000,    0x0000,    0x0000,    0x1800,
  217. X    0xC000,    0x0000,    0x0000,    0x1800,
  218. X    0xC000,    0x0000,    0x0000,    0x1800,
  219. X    0xC000,    0x0000,    0x0000,    0x1800,
  220. X    0xC000,    0x0000,    0x0000,    0x1800,
  221. X    0xC000,    0x0000,    0x0000,    0x1800,
  222. X    0xC000,    0x0000,    0x0000,    0x1800,
  223. X    0xC000,    0x0000,    0x0000,    0x1800,
  224. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF800,
  225. X    0xFFFF,    0xFFFF,    0xFFFF,    0xF800,
  226. SHAR_EOF
  227. chmod 0644 bitmaps/tdl_full.pr ||
  228. echo 'restore of bitmaps/tdl_full.pr failed'
  229. Wc_c="`wc -c < 'bitmaps/tdl_full.pr'`"
  230. test 2190 -eq "$Wc_c" ||
  231.     echo 'bitmaps/tdl_full.pr: original size 2190, current size' "$Wc_c"
  232. rm -f _shar_wnt_.tmp
  233. fi
  234. # ============= bitmaps/tdl_mask.pr ==============
  235. if test -f 'bitmaps/tdl_mask.pr' -a X"$1" != X"-c"; then
  236.     echo 'x - skipping bitmaps/tdl_mask.pr (File already exists)'
  237.     rm -f _shar_wnt_.tmp
  238. else
  239. > _shar_wnt_.tmp
  240. echo 'x - extracting bitmaps/tdl_mask.pr (Text)'
  241. sed 's/^X//' << 'SHAR_EOF' > 'bitmaps/tdl_mask.pr' &&
  242. /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  243. X */
  244. X    0xFFFF,0xFFFF,0xFFFF,0xF81C,
  245. X    0xFFFF,0xFFFF,0xFFFF,0xF83E,
  246. X    0xFFFF,0xFFFF,0xFFFF,0xF87F,
  247. X    0xFFFF,0xFFFF,0xFFFF,0xF8FF,
  248. X    0xFFFF,0xFFFF,0xFFFF,0xF9FF,
  249. X    0xFFFF,0xFFFF,0xFFFF,0xFBFE,
  250. X    0xFFFF,0xFFFF,0xFFFF,0xFFFC,
  251. X    0xFFFF,0xFFFF,0xFFFF,0xFFF8,
  252. X    0xFFFF,0xFFFF,0xFFFF,0xFFF0,
  253. X    0xFFFF,0xFFFF,0xFFFF,0xFFE0,
  254. X    0xFFFF,0xFFFF,0xFFFF,0xFFC0,
  255. X    0xFFFF,0xFFFF,0xFFFF,0xFF80,
  256. X    0xFFFF,0xFFFF,0xFFFF,0xFF00,
  257. X    0xFFFF,0xFFFF,0xFFFF,0xFE00,
  258. X    0xFFFF,0xFFFF,0xFFFF,0xFC00,
  259. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  260. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  261. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  262. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  263. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  264. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  265. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  266. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  267. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  268. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  269. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  270. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  271. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  272. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  273. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  274. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  275. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  276. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  277. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  278. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  279. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  280. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  281. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  282. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  283. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  284. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  285. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  286. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  287. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  288. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  289. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  290. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  291. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  292. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  293. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  294. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  295. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  296. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  297. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  298. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  299. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  300. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  301. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  302. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  303. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  304. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  305. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  306. X    0xFFFF,0xFFFF,0xFFFF,0xF800,
  307. X    0xFFFF,0xFFFF,0xFFFF,0xF800
  308. SHAR_EOF
  309. chmod 0644 bitmaps/tdl_mask.pr ||
  310. echo 'restore of bitmaps/tdl_mask.pr failed'
  311. Wc_c="`wc -c < 'bitmaps/tdl_mask.pr'`"
  312. test 1997 -eq "$Wc_c" ||
  313.     echo 'bitmaps/tdl_mask.pr: original size 1997, current size' "$Wc_c"
  314. rm -f _shar_wnt_.tmp
  315. fi
  316. # ============= cursor.c ==============
  317. if test -f 'cursor.c' -a X"$1" != X"-c"; then
  318.     echo 'x - skipping cursor.c (File already exists)'
  319.     rm -f _shar_wnt_.tmp
  320. else
  321. > _shar_wnt_.tmp
  322. echo 'x - extracting cursor.c (Text)'
  323. sed 's/^X//' << 'SHAR_EOF' > 'cursor.c' &&
  324. /*
  325. X * $Id: cursor.c,v 2.2 1992/07/13 14:23:29 jipping Exp $
  326. X * **********************************************************************
  327. X *
  328. X * Cursor.c --> Routines for manipulating the cursors.
  329. X *
  330. X * Just a few routines to make cursor changing easy: a creation routine
  331. X * and a changer.
  332. X *
  333. X * ----------------------------------------------------------------------
  334. X * Copyright (c) 1992 by Mike Jipping and Hope College
  335. X *
  336. X * Permission is granted to copy and distribute this file in modified or
  337. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  338. X * is preserved, (b) no attempt is made to restrict redistribution of this
  339. X * file, and (c) this file is not distributed as part of any collection whose
  340. X * redistribution is restricted by a compilation copyright.
  341. X * ----------------------------------------------------------------------
  342. X *
  343. X * Revision History:
  344. X *
  345. X * $Log: cursor.c,v $
  346. X * Revision 2.2  1992/07/13  14:23:29  jipping
  347. X * Added "tdl_list" to cursors to change -- so list will change too.
  348. X *
  349. X * Revision 2.1  1992/07/13  13:53:22  jipping
  350. X * Placed all cursor bitmaps in subdirectory.
  351. X *
  352. X * Revision 2.0  1992/07/06  12:49:13  jipping
  353. X * Initial release.
  354. X *
  355. X */
  356. X
  357. #include "globaldefs.h"
  358. X
  359. short edit_bits[] = {
  360. #include "bitmaps/edit.pr"
  361. };
  362. Server_image edit_glyph = NULL;
  363. XXv_cursor edit_cursor;
  364. X
  365. short cut_bits[] = {
  366. #include "bitmaps/cut.pr"
  367. };
  368. Server_image cut_glyph = NULL;
  369. XXv_cursor cut_cursor;
  370. X
  371. XXv_cursor copy_cursor;
  372. XXv_cursor basic_cursor;
  373. X
  374. void create_cursors ()
  375. {
  376. X    basic_cursor = xv_create(NULL, CURSOR,
  377. X                                     CURSOR_SRC_CHAR, OLC_BASIC_PTR,
  378. X                                     0);
  379. X
  380. X    copy_cursor = xv_create(NULL, CURSOR,
  381. X                                    CURSOR_SRC_CHAR, OLC_MOVE_PTR,
  382. X                                    0);
  383. X
  384. X    edit_glyph = (Server_image)xv_create(NULL, SERVER_IMAGE,
  385. X                                                         XV_WIDTH, 16,
  386. X                                                         XV_HEIGHT, 16,
  387. X                                                         SERVER_IMAGE_BITS, edit_bits,
  388. X                                                         0);
  389. X    edit_cursor = (Xv_Cursor) xv_create(NULL, CURSOR,
  390. X                                                        CURSOR_IMAGE,  edit_glyph,
  391. X                                                        CURSOR_XHOT, 8,
  392. X                                                        CURSOR_YHOT,  8,
  393. X                                                        0);
  394. X
  395. X    cut_glyph = (Server_image)xv_create(NULL, SERVER_IMAGE,
  396. X                                                              XV_WIDTH, 16,
  397. X                                                              XV_HEIGHT, 16,
  398. X                                                              SERVER_IMAGE_BITS, cut_bits,
  399. X                                                              0);
  400. X    cut_cursor = (Xv_Cursor) xv_create(NULL, CURSOR,
  401. X                                                             CURSOR_IMAGE,  cut_glyph,
  402. X                                                             CURSOR_XHOT, 8,
  403. X                                                             CURSOR_YHOT,  8,
  404. X                                                             0);
  405. X    
  406. }
  407. X
  408. extern Panel tdl_control, tdl_title, tdl_list;
  409. X
  410. /*
  411. X *  Change the cursor.  Note that this has a bug: this does not change the
  412. X *  cursor over all parts of the todo list window.
  413. X */
  414. void set_cursor (cursor)
  415. XXv_cursor cursor;
  416. {
  417. X    xv_set(xv_get(tdl_title, CANVAS_NTH_PAINT_WINDOW, 0),
  418. X             WIN_CURSOR, cursor,
  419. X             0);
  420. X    xv_set(xv_get(tdl_control, CANVAS_NTH_PAINT_WINDOW, 0),
  421. X             WIN_CURSOR, cursor,
  422. X             0);
  423. X    xv_set(xv_get(tdl_list, CANVAS_NTH_PAINT_WINDOW, 0),
  424. X             WIN_CURSOR, cursor,
  425. X             0);
  426. }
  427. SHAR_EOF
  428. chmod 0644 cursor.c ||
  429. echo 'restore of cursor.c failed'
  430. Wc_c="`wc -c < 'cursor.c'`"
  431. test 2909 -eq "$Wc_c" ||
  432.     echo 'cursor.c: original size 2909, current size' "$Wc_c"
  433. rm -f _shar_wnt_.tmp
  434. fi
  435. # ============= entry_ui.h ==============
  436. if test -f 'entry_ui.h' -a X"$1" != X"-c"; then
  437.     echo 'x - skipping entry_ui.h (File already exists)'
  438.     rm -f _shar_wnt_.tmp
  439. else
  440. > _shar_wnt_.tmp
  441. echo 'x - extracting entry_ui.h (Text)'
  442. sed 's/^X//' << 'SHAR_EOF' > 'entry_ui.h' &&
  443. #ifndef    entry_HEADER
  444. #define    entry_HEADER
  445. X
  446. /*
  447. X * entry_ui.h - User interface object and function declarations.
  448. X * This file was generated by `gxv' from `entry.G'.
  449. X * DO NOT EDIT BY HAND.
  450. X */
  451. X
  452. extern Attr_attribute    INSTANCE;
  453. X
  454. X
  455. typedef struct {
  456. X    Xv_opaque    entry_frame;
  457. X    Xv_opaque    entry_panel;
  458. X    Xv_opaque    entry_type;
  459. X    Xv_opaque    entry_category;
  460. X    Xv_opaque    recurring;
  461. X    Xv_opaque    entry_text;
  462. X    Xv_opaque    entry_priority;
  463. X    Xv_opaque    entry_cancel;
  464. X    Xv_opaque    entry_done;
  465. } entry_entry_frame_objects;
  466. X
  467. extern entry_entry_frame_objects    *entry_entry_frame_objects_initialize();
  468. X
  469. extern Xv_opaque    entry_entry_frame_entry_frame_create();
  470. extern Xv_opaque    entry_entry_frame_entry_panel_create();
  471. extern Xv_opaque    entry_entry_frame_entry_type_create();
  472. extern Xv_opaque    entry_entry_frame_entry_category_create();
  473. extern Xv_opaque    entry_entry_frame_recurring_create();
  474. extern Xv_opaque    entry_entry_frame_entry_text_create();
  475. extern Xv_opaque    entry_entry_frame_entry_priority_create();
  476. extern Xv_opaque    entry_entry_frame_entry_cancel_create();
  477. extern Xv_opaque    entry_entry_frame_entry_done_create();
  478. #endif
  479. SHAR_EOF
  480. chmod 0644 entry_ui.h ||
  481. echo 'restore of entry_ui.h failed'
  482. Wc_c="`wc -c < 'entry_ui.h'`"
  483. test 1088 -eq "$Wc_c" ||
  484.     echo 'entry_ui.h: original size 1088, current size' "$Wc_c"
  485. rm -f _shar_wnt_.tmp
  486. fi
  487. # ============= globaldefs.h ==============
  488. if test -f 'globaldefs.h' -a X"$1" != X"-c"; then
  489.     echo 'x - skipping globaldefs.h (File already exists)'
  490.     rm -f _shar_wnt_.tmp
  491. else
  492. > _shar_wnt_.tmp
  493. echo 'x - extracting globaldefs.h (Text)'
  494. sed 's/^X//' << 'SHAR_EOF' > 'globaldefs.h' &&
  495. /*
  496. X *  Global (external) definitions for the XVTDL software
  497. X */
  498. X
  499. #include <stdio.h>
  500. #include <string.h>
  501. #include <fcntl.h>
  502. #include <time.h>
  503. #include <pwd.h>
  504. #include <sys/types.h>
  505. #include <sys/file.h>
  506. #include <errno.h>
  507. X
  508. #include <X11/X.h>
  509. #include <X11/Xlib.h>
  510. X
  511. #include <xview/xview.h>
  512. #include <xview/panel.h>
  513. #include <xview/textsw.h>
  514. #include <xview/svrimage.h>
  515. #include <xview/font.h>
  516. #include <xview/icon.h>
  517. #include <xview/xv_xrect.h>
  518. #include <xview/openmenu.h>
  519. #include <xview/notify.h>
  520. #include <xview/notice.h>
  521. #include <xview/cursor.h>
  522. X
  523. #include "print_ui.h"
  524. #include "entry_ui.h"
  525. #include "props_ui.h"
  526. X
  527. #define PRINT_PROLOG1 "/home/hydra/jipping/misc/tdl/prolog1.ps"
  528. #define PRINT_PROLOG2 "/home/hydra/jipping/misc/tdl/prolog2.ps"
  529. X
  530. #if !defined(XVIEW2) && !defined(XVIEW3)
  531. #       ifdef FRAME_FOCUS_UP_WIDTH
  532. #       define XVIEW3
  533. #       else
  534. #       define XVIEW2
  535. #       endif
  536. #endif
  537. X
  538. #if defined(XVIEW2)
  539. #undef XVIEW3
  540. #endif
  541. #if defined(XVIEW3)
  542. #undef XVIEW2
  543. #endif
  544. X
  545. #define NEW(A) ((A *) malloc(sizeof(A)))
  546. #define EQUAL(s1,s2) strcmp(s1, s2) == 0
  547. X
  548. #define MASK(n)          ((unsigned long)(1 << (n)))
  549. #define BIT_IS_SET(x,n)  ((x) & MASK(n))
  550. #define SET_BIT(x,n)     x |= MASK(n)
  551. #define UNSET_BIT(x,n)   x &= ~MASK(n)
  552. X
  553. #define FILENAMESIZ 200
  554. #define LINESIZ     200
  555. #define BIG        1000
  556. X
  557. #define LOG_AT_CHECKED 0
  558. #define LOG_AT_QUIT    1
  559. #define LOG_NEVER      2
  560. #define LOG_TIMESTAMP  0
  561. #define LOG_USER_SPEC  1
  562. X
  563. extern int debug;
  564. extern int verbose;
  565. extern int editing, copying, cutting;
  566. X
  567. entry_entry_frame_objects    *entry_editor;
  568. print_print_base_objects   *print_print_base;
  569. X
  570. extern char fname[FILENAMESIZ];
  571. char default_printer[25], log_preference[10], log_file[LINESIZ];
  572. char priority_listing[13], log_info_pref[25];
  573. int postscriptmode,logging;
  574. X
  575. extern Frame tdlist, entry_frame, recurring_frame;
  576. X
  577. extern struct tm current, *tm, today, *localtime();
  578. extern int curr_month, curr_day, curr_year;
  579. X
  580. extern Server_image checked_on, checked_off;
  581. extern Server_image checks[10];
  582. X
  583. extern Xv_cursor basic_cursor, copy_cursor, cut_cursor, edit_cursor;
  584. X
  585. extern Canvas calendar;
  586. extern Panel_item todo, entry_text, entry_done, categories, recurring;
  587. extern Panel_item entry_type, entry_category;
  588. extern Panel_item freq, day_of_week, day_of_week2, weeks, week_of_month;
  589. X
  590. extern int zeller(), daysinmonth();
  591. extern int changed;
  592. X
  593. extern int log_level, log_info_level;
  594. X
  595. struct recurrence_list {
  596. X    int starting_day_code;
  597. X    char text[LINESIZ];
  598. X    int priority;
  599. X    int daily, weekly, biweekly, monthly, yearly;
  600. X    int dow;
  601. X    int mwf, tt;
  602. X    int week_number, number_of_weeks;
  603. X    struct recurrence_list *next;
  604. };
  605. X
  606. struct day_entry {
  607. X    char text[LINESIZ];
  608. X    int checked, recurring_entry;
  609. X    int priority;
  610. X    struct day_entry *prev, *next;
  611. };
  612. X
  613. extern struct day_entry *cut_buffer;
  614. X
  615. struct entry_list {
  616. X    int day_code;
  617. X    int recurring_checked;
  618. X    struct day_entry *first, *last, *rl_first, *rl_last;
  619. X    struct entry_list *next;
  620. };
  621. X
  622. extern struct entry_list *entry_head, *entry_tail;
  623. X
  624. extern struct recurrence_list *rl_head, *rl_tail;
  625. X
  626. struct category_rec {
  627. X    char name[LINESIZ];
  628. X    struct entry_list *entry_head, *entry_tail;
  629. X    struct recurrence_list *rl_head, *rl_tail;
  630. X    struct category_rec *next;
  631. };
  632. X
  633. extern struct category_rec *category_head;
  634. SHAR_EOF
  635. chmod 0644 globaldefs.h ||
  636. echo 'restore of globaldefs.h failed'
  637. Wc_c="`wc -c < 'globaldefs.h'`"
  638. test 3226 -eq "$Wc_c" ||
  639.     echo 'globaldefs.h: original size 3226, current size' "$Wc_c"
  640. rm -f _shar_wnt_.tmp
  641. fi
  642. # ============= logedit_ui.h ==============
  643. if test -f 'logedit_ui.h' -a X"$1" != X"-c"; then
  644.     echo 'x - skipping logedit_ui.h (File already exists)'
  645.     rm -f _shar_wnt_.tmp
  646. else
  647. > _shar_wnt_.tmp
  648. echo 'x - extracting logedit_ui.h (Text)'
  649. sed 's/^X//' << 'SHAR_EOF' > 'logedit_ui.h' &&
  650. #ifndef    logedit_HEADER
  651. #define    logedit_HEADER
  652. X
  653. /*
  654. X * logedit_ui.h - User interface object and function declarations.
  655. X * This file was generated by `gxv' from `logedit.G'.
  656. X * DO NOT EDIT BY HAND.
  657. X */
  658. X
  659. extern Attr_attribute    INSTANCE;
  660. X
  661. X
  662. typedef struct {
  663. X    Xv_opaque    log_edit;
  664. X    Xv_opaque    log_editor;
  665. X    Xv_opaque    controls1;
  666. X    Xv_opaque    log_editor_cancel;
  667. X    Xv_opaque    log_editor_done;
  668. } logedit_log_edit_objects;
  669. X
  670. extern logedit_log_edit_objects    *logedit_log_edit_objects_initialize();
  671. X
  672. extern Xv_opaque    logedit_log_edit_log_edit_create();
  673. extern Xv_opaque    logedit_log_edit_log_editor_create();
  674. extern Xv_opaque    logedit_log_edit_controls1_create();
  675. extern Xv_opaque    logedit_log_edit_log_editor_cancel_create();
  676. extern Xv_opaque    logedit_log_edit_log_editor_done_create();
  677. #endif
  678. SHAR_EOF
  679. chmod 0644 logedit_ui.h ||
  680. echo 'restore of logedit_ui.h failed'
  681. Wc_c="`wc -c < 'logedit_ui.h'`"
  682. test 768 -eq "$Wc_c" ||
  683.     echo 'logedit_ui.h: original size 768, current size' "$Wc_c"
  684. rm -f _shar_wnt_.tmp
  685. fi
  686. # ============= patchlevel.h ==============
  687. if test -f 'patchlevel.h' -a X"$1" != X"-c"; then
  688.     echo 'x - skipping patchlevel.h (File already exists)'
  689.     rm -f _shar_wnt_.tmp
  690. else
  691. > _shar_wnt_.tmp
  692. echo 'x - extracting patchlevel.h (Text)'
  693. sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
  694. /*  Version number... */
  695. X
  696. #define VERSION 3
  697. #define PATCHLEVEL 0
  698. SHAR_EOF
  699. chmod 0644 patchlevel.h ||
  700. echo 'restore of patchlevel.h failed'
  701. Wc_c="`wc -c < 'patchlevel.h'`"
  702. test 65 -eq "$Wc_c" ||
  703.     echo 'patchlevel.h: original size 65, current size' "$Wc_c"
  704. rm -f _shar_wnt_.tmp
  705. fi
  706. # ============= print_ui.h ==============
  707. if test -f 'print_ui.h' -a X"$1" != X"-c"; then
  708.     echo 'x - skipping print_ui.h (File already exists)'
  709.     rm -f _shar_wnt_.tmp
  710. else
  711. > _shar_wnt_.tmp
  712. echo 'x - extracting print_ui.h (Text)'
  713. sed 's/^X//' << 'SHAR_EOF' > 'print_ui.h' &&
  714. #ifndef    print_HEADER
  715. #define    print_HEADER
  716. X
  717. /*
  718. X * print_ui.h - User interface object and function declarations.
  719. X * This file was generated by `gxv' from `print.G'.
  720. X * DO NOT EDIT BY HAND.
  721. X */
  722. X
  723. extern Attr_attribute    INSTANCE;
  724. X
  725. X
  726. typedef struct {
  727. X    Xv_opaque    print_base;
  728. X    Xv_opaque    controls1;
  729. X    Xv_opaque    postscript;
  730. X    Xv_opaque    printer;
  731. X    Xv_opaque    scale;
  732. X    Xv_opaque    categories;
  733. X    Xv_opaque    incl_checked_items;
  734. X    Xv_opaque    cancel_print;
  735. X    Xv_opaque    exec_print;
  736. } print_print_base_objects;
  737. X
  738. extern print_print_base_objects    *print_print_base_objects_initialize();
  739. X
  740. extern Xv_opaque    print_print_base_print_base_create();
  741. extern Xv_opaque    print_print_base_controls1_create();
  742. extern Xv_opaque    print_print_base_postscript_create();
  743. extern Xv_opaque    print_print_base_printer_create();
  744. extern Xv_opaque    print_print_base_scale_create();
  745. extern Xv_opaque    print_print_base_categories_create();
  746. extern Xv_opaque    print_print_base_incl_checked_items_create();
  747. extern Xv_opaque    print_print_base_cancel_print_create();
  748. extern Xv_opaque    print_print_base_exec_print_create();
  749. #endif
  750. SHAR_EOF
  751. chmod 0644 print_ui.h ||
  752. echo 'restore of print_ui.h failed'
  753. Wc_c="`wc -c < 'print_ui.h'`"
  754. test 1056 -eq "$Wc_c" ||
  755.     echo 'print_ui.h: original size 1056, current size' "$Wc_c"
  756. rm -f _shar_wnt_.tmp
  757. fi
  758. # ============= prolog2.ps ==============
  759. if test -f 'prolog2.ps' -a X"$1" != X"-c"; then
  760.     echo 'x - skipping prolog2.ps (File already exists)'
  761.     rm -f _shar_wnt_.tmp
  762. else
  763. > _shar_wnt_.tmp
  764. echo 'x - extracting prolog2.ps (Text)'
  765. sed 's/^X//' << 'SHAR_EOF' > 'prolog2.ps' &&
  766. 62.08 703.39 M
  767. X 63.16 705.19 63.16 705.19 65.46 708 D
  768. X 67.77 710.81 67.77 710.81 69.5 709.3 D
  769. X 71.22 707.78 71.22 707.78 72.95 705.05 D
  770. X 74.75 702.31 74.75 702.31 75.33 700.08 D
  771. X 75.83 697.85 75.83 697.85 83.61 716.42 D
  772. X 91.31 735 91.31 735 93.83 732.19 D
  773. X 96.28 729.38 96.28 729.38 96.35 730.25 D
  774. X 96.42 731.04 96.42 731.04 98.22 729.02 D
  775. X 100.02 726.94 100.02 726.94 87.21 706.42 D
  776. X 74.46 685.82 74.46 685.82 73.38 689.71 D
  777. X 72.3 693.53 72.3 693.53 69.71 696.34 D
  778. X 67.19 699.14 67.19 699.14 64.1 700.37 D
  779. X 61 701.59 61 701.59 62.08 703.39 D
  780. O
  781. V
  782. 0.2 H
  783. 0 Z
  784. N
  785. 65.9 690.79 88.29 712.9 R
  786. N
  787. 90 642 558 642 2 L
  788. 0.5 H
  789. 2 Z
  790. N
  791. X
  792. SHAR_EOF
  793. chmod 0644 prolog2.ps ||
  794. echo 'restore of prolog2.ps failed'
  795. Wc_c="`wc -c < 'prolog2.ps'`"
  796. test 619 -eq "$Wc_c" ||
  797.     echo 'prolog2.ps: original size 619, current size' "$Wc_c"
  798. rm -f _shar_wnt_.tmp
  799. fi
  800. # ============= props_ui.h ==============
  801. if test -f 'props_ui.h' -a X"$1" != X"-c"; then
  802.     echo 'x - skipping props_ui.h (File already exists)'
  803.     rm -f _shar_wnt_.tmp
  804. else
  805. > _shar_wnt_.tmp
  806. echo 'x - extracting props_ui.h (Text)'
  807. sed 's/^X//' << 'SHAR_EOF' > 'props_ui.h' &&
  808. #ifndef    props_HEADER
  809. #define    props_HEADER
  810. X
  811. /*
  812. X * props_ui.h - User interface object and function declarations.
  813. X * This file was generated by `gxv' from `props.G'.
  814. X * DO NOT EDIT BY HAND.
  815. X */
  816. X
  817. extern Attr_attribute    INSTANCE;
  818. X
  819. X
  820. typedef struct {
  821. X    Xv_opaque    props_frame;
  822. X    Xv_opaque    logging_panel;
  823. X    Xv_opaque    logging_msg;
  824. X    Xv_opaque    log_preference;
  825. X    Xv_opaque    log_info;
  826. X    Xv_opaque    log_filename;
  827. X    Xv_opaque    other_panel;
  828. X    Xv_opaque    other_msg;
  829. X    Xv_opaque    priority_direction;
  830. X    Xv_opaque    def_printer;
  831. X    Xv_opaque    def_print_mode;
  832. X    Xv_opaque    controls1;
  833. X    Xv_opaque    done_button;
  834. X    Xv_opaque    reset_button;
  835. } props_props_frame_objects;
  836. X
  837. extern props_props_frame_objects    *props_props_frame_objects_initialize();
  838. X
  839. extern Xv_opaque    props_props_frame_props_frame_create();
  840. extern Xv_opaque    props_props_frame_logging_panel_create();
  841. extern Xv_opaque    props_props_frame_logging_msg_create();
  842. extern Xv_opaque    props_props_frame_log_preference_create();
  843. extern Xv_opaque    props_props_frame_log_info_create();
  844. extern Xv_opaque    props_props_frame_log_filename_create();
  845. extern Xv_opaque    props_props_frame_other_panel_create();
  846. extern Xv_opaque    props_props_frame_other_msg_create();
  847. extern Xv_opaque    props_props_frame_priority_direction_create();
  848. extern Xv_opaque    props_props_frame_def_printer_create();
  849. extern Xv_opaque    props_props_frame_def_print_mode_create();
  850. extern Xv_opaque    props_props_frame_controls1_create();
  851. extern Xv_opaque    props_props_frame_done_button_create();
  852. extern Xv_opaque    props_props_frame_reset_button_create();
  853. #endif
  854. SHAR_EOF
  855. chmod 0644 props_ui.h ||
  856. echo 'restore of props_ui.h failed'
  857. Wc_c="`wc -c < 'props_ui.h'`"
  858. test 1509 -eq "$Wc_c" ||
  859.     echo 'props_ui.h: original size 1509, current size' "$Wc_c"
  860. rm -f _shar_wnt_.tmp
  861. fi
  862. # ============= todo.l ==============
  863. if test -f 'todo.l' -a X"$1" != X"-c"; then
  864.     echo 'x - skipping todo.l (File already exists)'
  865.     rm -f _shar_wnt_.tmp
  866. else
  867. > _shar_wnt_.tmp
  868. echo 'x - extracting todo.l (Text)'
  869. sed 's/^X//' << 'SHAR_EOF' > 'todo.l' &&
  870. X
  871. number        [0-9]+(\.[0-9]+)?
  872. string        \".*\"
  873. comment         #.*
  874. X
  875. whitespace    [ \n\r\t]
  876. X
  877. %%
  878. {whitespace}    {/* do nothing for now */}
  879. X
  880. category        {return CATEGORY;}
  881. {number}    {number_value = atoi(yytext); return NUMBER;}
  882. {comment}       {/* do nothing with comments */}
  883. {string}    {return STRING;}
  884. \/              {return SLASH;}
  885. \:        {return COLON;}
  886. \|              {return BAR;}
  887. D               {return BIGD;}
  888. N               {return BIGN;}
  889. W               {return BIGW;}
  890. M               {return BIGM;}
  891. T               {return BIGT;}
  892. d               {return LITTLED;}
  893. w               {return LITTLEW;}
  894. b               {return LITTLEB;}
  895. m               {return LITTLEM;}
  896. y               {return LITTLEY;}
  897. X
  898. SHAR_EOF
  899. chmod 0644 todo.l ||
  900. echo 'restore of todo.l failed'
  901. Wc_c="`wc -c < 'todo.l'`"
  902. test 702 -eq "$Wc_c" ||
  903.     echo 'todo.l: original size 702, current size' "$Wc_c"
  904. rm -f _shar_wnt_.tmp
  905. fi
  906. # ============= calendar.c ==============
  907. if test -f 'calendar.c' -a X"$1" != X"-c"; then
  908.     echo 'x - skipping calendar.c (File already exists)'
  909.     rm -f _shar_wnt_.tmp
  910. else
  911. > _shar_wnt_.tmp
  912. echo 'x - extracting calendar.c (Text)'
  913. sed 's/^X//' << 'SHAR_EOF' > 'calendar.c' &&
  914. /* $Id: calendar.c,v 2.0 1992/07/01 19:02:35 jipping Exp $
  915. X *
  916. X * **********************************************************************
  917. X *
  918. X *    Calendar.c ==> Calendar-related routines.
  919. X *
  920. X *    This set of routines implements the calendar in the upper left of
  921. X *    the todo list.  It stops short of implementing a calendar widget 
  922. X *    for XView.
  923. X *
  924. X *    Copyright (C) 1991 by Mike Jipping and Hope College
  925. X *
  926. X * Revision History:
  927. X *
  928. X * $Log: calendar.c,v $
  929. X * Revision 2.0  1992/07/01  19:02:35  jipping
  930. X * Initial release version.
  931. X *
  932. X * Revision 1.0  1991/07/02  12:02:21  jipping
  933. X * Initial revision
  934. X *
  935. X *
  936. X * **********************************************************************
  937. X */
  938. X
  939. #include "globaldefs.h"
  940. X
  941. char *monthname[12] = {
  942. X   "January", "February", "March", "April", "May", "June", "July",
  943. X   "August", "September", "October", "November", "December"
  944. };
  945. X
  946. /*
  947. X * Determines whether a given year is a leap year
  948. X */
  949. X
  950. int leapyear (year)
  951. int year;
  952. {
  953. X  if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
  954. X     return (1);
  955. X  else
  956. X     return (0);
  957. }
  958. X
  959. /*
  960. X *  Returns #days in month given month and year, taking
  961. X *    leap years into account for February.
  962. X */
  963. X
  964. int daysinmonth (month, year)
  965. int month, year;
  966. {
  967. X  if (month == 2)          /* Is it February?             */
  968. X     if (leapyear (year))  /* If so, is it a leap year?   */
  969. X        return (29);       /* 29 days in Feb in leap year */
  970. X     else
  971. X        return (28);       /* 28 days if not              */
  972. X  else{
  973. X     if (month > 7)        /* Is it August -> December?   */
  974. X        month++;           /* Invert even/odd state if so */
  975. X     if (month & 1)        /* Odd months have 31 days     */
  976. X        return (31);
  977. X     else
  978. X        return (30);       /* Even months have 30 days    */
  979. X  }
  980. }
  981. X
  982. /*  Determines whether a given date is valid
  983. X */
  984. X
  985. int validdate (month, day, year)
  986. int month, day, year;
  987. {
  988. X  if (month < 1 || month > 12 || day < 1 ||
  989. X     day > daysinmonth (month, year) ||
  990. X     year < 1583 || year > 9999)
  991. X        return (0);
  992. X  else
  993. X        return (1);
  994. }
  995. X
  996. /*  Given a valid date (month, day, and year) Zeller will
  997. X *    return an integer representing the day of week that
  998. X *    date will fall on. 0 = Sunday, 6 = Saturday.
  999. X */
  1000. X
  1001. int zeller (month, day, year)
  1002. int month, day, year;
  1003. {
  1004. X  int century;
  1005. X  month -= 2;       /* Years start on March 1 so adjust standard date */
  1006. X  if (month < 1) {
  1007. X     month += 12;
  1008. X     year--;
  1009. X  }
  1010. X  century = year / 100;
  1011. X  year = (int)year % (int)100;
  1012. X  return ((int)((2.6 * month - 0.1) + day + year + year / 4  + century / 4 - century * 2) % 7);
  1013. }
  1014. X
  1015. /*
  1016. X * print_header: prints the name of the month and the year
  1017. X */
  1018. X
  1019. print_header(month, year)
  1020. int month, year;
  1021. {
  1022. X   Xv_font font;
  1023. X   Display *dpy = (Display *)xv_get(calendar, XV_DISPLAY);
  1024. X   XGCValues gcvalues;
  1025. X   GC gc;
  1026. X   Window xwin = xv_get(canvas_paint_window(calendar), XV_XID);
  1027. X   char title[15];
  1028. X
  1029. X   font = xv_find(calendar, FONT,
  1030. X                  FONT_FAMILY,  FONT_FAMILY_LUCIDA,
  1031. X                  FONT_STYLE,   FONT_STYLE_BOLD_ITALIC,
  1032. X                  FONT_SCALE,   WIN_SCALE_LARGE,
  1033. X                  0);
  1034. X   gcvalues.font = xv_get(font, XV_XID);
  1035. X   gcvalues.foreground = BlackPixel(dpy, DefaultScreen(dpy));
  1036. X   gcvalues.background = WhitePixel(dpy, DefaultScreen(dpy));
  1037. X   gcvalues.graphics_exposures = False;
  1038. X   gc = XCreateGC(dpy, RootWindow(dpy, DefaultScreen(dpy)),
  1039. X                  GCForeground | GCBackground | GCFont | GCGraphicsExposures,
  1040. X                  &gcvalues);
  1041. X      
  1042. X   XClearWindow(dpy, xwin);
  1043. X   sprintf(title, "%s %4d", monthname[month-1], year);
  1044. X   XDrawString(dpy, xwin, gc, 10, 10, title, strlen(title));
  1045. }
  1046. X
  1047. /*
  1048. X * Given the day of the week, and the week number, this routine prints
  1049. X * the "day" (date) at comuted coordinates in the calendar.
  1050. X */
  1051. X
  1052. print_day(week, dow, day)
  1053. int week, dow, day;
  1054. {
  1055. X   Display *dpy = (Display *)xv_get(calendar, XV_DISPLAY);
  1056. X   GC gc = DefaultGC(dpy, DefaultScreen(dpy));
  1057. X   Window xwin = xv_get(canvas_paint_window(calendar), XV_XID);
  1058. X   char daystr[3];
  1059. X   
  1060. X   sprintf(daystr, "%2d", day);
  1061. X   XDrawString(dpy, xwin, gc,
  1062. X               24*dow, 30+12*(week-1),
  1063. X               daystr, strlen(daystr));
  1064. X
  1065. }
  1066. X
  1067. /*
  1068. X * This routine adds a "highlight" (rectangle) on the current day. 
  1069. X */
  1070. X
  1071. highlite (week, dow)
  1072. int week, dow;
  1073. {
  1074. X   Display *dpy = (Display *)xv_get(calendar, XV_DISPLAY);
  1075. X   GC gc = DefaultGC(dpy, DefaultScreen(dpy));
  1076. X   Window xwin = xv_get(canvas_paint_window(calendar), XV_XID);
  1077. X
  1078. X   XDrawRectangle(dpy, xwin, gc,
  1079. X                  24*dow-4, 30+12*(week-2)+1,
  1080. X                  20, 12);
  1081. }
  1082. X
  1083. /*
  1084. X * Here we control the actual calendar generation --> calling
  1085. X * print_header and print_day as needed.
  1086. X */
  1087. X
  1088. print_calendar(month, year)
  1089. int month, year;
  1090. {
  1091. X   int start, days, dow, week, day;
  1092. X
  1093. X   start = zeller(month, 1, year);
  1094. X   days = daysinmonth(month, year);
  1095. X
  1096. X   print_header(month, year);
  1097. X   week = 1;
  1098. X   dow = start;
  1099. X   for (day=1; day <= days; day++) {
  1100. X      dow = dow % 7;
  1101. X      if ( (dow == 0) && (day != 1) ) week++;
  1102. X      print_day(week, dow, day);
  1103. X      if (day == curr_day) highlite(week, dow);
  1104. X      dow++;
  1105. X   }
  1106. }
  1107. X
  1108. /*
  1109. X * event_proc()
  1110. X *      Called when an event is received in the canvas window.
  1111. X *      Only button events are monitored in this window, and any button
  1112. X *      event will cause a move to the day the event was on.  We first
  1113. X *      compute the day the button event occured over, then we move to
  1114. X *      that day.
  1115. X */
  1116. void
  1117. calendar_event_proc(window, event)
  1118. XXv_Window window;
  1119. Event    *event;
  1120. {
  1121. X   int dow, week, first, date;
  1122. X
  1123. X    if (! event_is_button(event)) return;
  1124. X   if (event_is_up(event)) return;   /* only react on button-down events */
  1125. X
  1126. X   /* Compute the date the event occured over */
  1127. X   dow = event_x(event) / 24;
  1128. X   week = (event_y(event) - 18) / 12 + 1;
  1129. X   first = zeller(curr_month, 1, curr_year);
  1130. X   date = 1 + (dow - first) + 7*(week-1);
  1131. X
  1132. X   /*
  1133. X    * The date is in terms of the current month.  If it is between 1 and
  1134. X    * the number of days in the month, we only need to move in the
  1135. X    * current month.  However, "date" could be negative, meaning we need
  1136. X    * to move to last month, or > the days in the current month, meaning
  1137. X    * we need to move to next month.
  1138. X    */
  1139. X   if ((date > 0) & (date <= daysinmonth(curr_month, curr_year))) {
  1140. X      curr_day = date;
  1141. X   } else if (date > daysinmonth(curr_month, curr_year)) {
  1142. X      curr_day = date - daysinmonth(curr_month, curr_year);
  1143. X      curr_month = (curr_month+1) % 12;
  1144. X      if (curr_month == 0) curr_month = 12;
  1145. X      if (curr_month == 1) curr_year++;
  1146. X   } else {
  1147. X      curr_month = (curr_month-1) % 12;
  1148. X      if (curr_month == 0) {
  1149. X         curr_month = 12;
  1150. X         curr_year --;
  1151. X      }
  1152. X      curr_day = daysinmonth(curr_month, curr_year) + date;
  1153. X   }
  1154. X
  1155. X   /* Move to the date specified. */
  1156. X   print_calendar(curr_month, curr_year);
  1157. X   reset_date_message();
  1158. X   display_list(curr_month, curr_day, curr_year);  
  1159. }
  1160. X
  1161. SHAR_EOF
  1162. chmod 0644 calendar.c ||
  1163. echo 'restore of calendar.c failed'
  1164. Wc_c="`wc -c < 'calendar.c'`"
  1165. test 6846 -eq "$Wc_c" ||
  1166.     echo 'calendar.c: original size 6846, current size' "$Wc_c"
  1167. rm -f _shar_wnt_.tmp
  1168. fi
  1169. # ============= entry_ui.c ==============
  1170. if test -f 'entry_ui.c' -a X"$1" != X"-c"; then
  1171.     echo 'x - skipping entry_ui.c (File already exists)'
  1172.     rm -f _shar_wnt_.tmp
  1173. else
  1174. > _shar_wnt_.tmp
  1175. echo 'x - extracting entry_ui.c (Text)'
  1176. sed 's/^X//' << 'SHAR_EOF' > 'entry_ui.c' &&
  1177. /*
  1178. X * entry_ui.c - User interface object initialization functions.
  1179. X * This file was generated by `gxv' from `entry.G'.
  1180. X * DO NOT EDIT BY HAND.
  1181. X */
  1182. X
  1183. #include <stdio.h>
  1184. #include <sys/param.h>
  1185. #include <sys/types.h>
  1186. #include <xview/xview.h>
  1187. #include <xview/canvas.h>
  1188. #include <xview/panel.h>
  1189. #include <xview/scrollbar.h>
  1190. #include <xview/svrimage.h>
  1191. #include <xview/termsw.h>
  1192. #include <xview/text.h>
  1193. #include <xview/tty.h>
  1194. #include <xview/xv_xrect.h>
  1195. #include "entry_ui.h"
  1196. X
  1197. /*
  1198. X * Initialize an instance of object `entry_frame'.
  1199. X */
  1200. entry_entry_frame_objects *
  1201. entry_entry_frame_objects_initialize(ip, owner)
  1202. X    entry_entry_frame_objects    *ip;
  1203. X    Xv_opaque    owner;
  1204. {
  1205. X    if (!ip && !(ip = (entry_entry_frame_objects *) calloc(1, sizeof (entry_entry_frame_objects))))
  1206. X        return (entry_entry_frame_objects *) NULL;
  1207. X    if (!ip->entry_frame)
  1208. X        ip->entry_frame = entry_entry_frame_entry_frame_create(ip, owner);
  1209. X    if (!ip->entry_panel)
  1210. X        ip->entry_panel = entry_entry_frame_entry_panel_create(ip, ip->entry_frame);
  1211. X    if (!ip->entry_type)
  1212. X        ip->entry_type = entry_entry_frame_entry_type_create(ip, ip->entry_panel);
  1213. X    if (!ip->entry_category)
  1214. X        ip->entry_category = entry_entry_frame_entry_category_create(ip, ip->entry_panel);
  1215. X    if (!ip->recurring)
  1216. X        ip->recurring = entry_entry_frame_recurring_create(ip, ip->entry_panel);
  1217. X    if (!ip->entry_text)
  1218. X        ip->entry_text = entry_entry_frame_entry_text_create(ip, ip->entry_panel);
  1219. X    if (!ip->entry_priority)
  1220. X        ip->entry_priority = entry_entry_frame_entry_priority_create(ip, ip->entry_panel);
  1221. X    if (!ip->entry_cancel)
  1222. X        ip->entry_cancel = entry_entry_frame_entry_cancel_create(ip, ip->entry_panel);
  1223. X    if (!ip->entry_done)
  1224. X        ip->entry_done = entry_entry_frame_entry_done_create(ip, ip->entry_panel);
  1225. X    return ip;
  1226. }
  1227. X
  1228. /*
  1229. X * Create object `entry_frame' in the specified instance.
  1230. X */
  1231. XXv_opaque
  1232. entry_entry_frame_entry_frame_create(ip, owner)
  1233. X    entry_entry_frame_objects    *ip;
  1234. X    Xv_opaque    owner;
  1235. {
  1236. X    Xv_opaque    obj;
  1237. X    
  1238. X    obj = xv_create(owner, FRAME_CMD,
  1239. X        XV_KEY_DATA, INSTANCE, ip,
  1240. X        XV_WIDTH, 545,
  1241. X        XV_HEIGHT, 165,
  1242. X        XV_LABEL, "Entry Editor",
  1243. X        FRAME_SHOW_FOOTER, TRUE,
  1244. X        FRAME_SHOW_RESIZE_CORNER, TRUE,
  1245. X        FRAME_CMD_PUSHPIN_IN, FALSE,
  1246. X        NULL);
  1247. X    xv_set(xv_get(obj, FRAME_CMD_PANEL), WIN_SHOW, FALSE, NULL);
  1248. X    return obj;
  1249. }
  1250. X
  1251. /*
  1252. X * Create object `entry_panel' in the specified instance.
  1253. X */
  1254. XXv_opaque
  1255. entry_entry_frame_entry_panel_create(ip, owner)
  1256. X    entry_entry_frame_objects    *ip;
  1257. X    Xv_opaque    owner;
  1258. {
  1259. X    Xv_opaque    obj;
  1260. X    
  1261. X    obj = xv_create(owner, PANEL,
  1262. X        XV_KEY_DATA, INSTANCE, ip,
  1263. X        XV_X, 0,
  1264. X        XV_Y, 0,
  1265. X        XV_WIDTH, WIN_EXTEND_TO_EDGE,
  1266. X        XV_HEIGHT, WIN_EXTEND_TO_EDGE,
  1267. X        WIN_BORDER, FALSE,
  1268. X        NULL);
  1269. X    return obj;
  1270. }
  1271. X
  1272. /*
  1273. X * Create object `entry_type' in the specified instance.
  1274. X */
  1275. XXv_opaque
  1276. entry_entry_frame_entry_type_create(ip, owner)
  1277. X    entry_entry_frame_objects    *ip;
  1278. X    Xv_opaque    owner;
  1279. {
  1280. X    extern void        change_entry_type();
  1281. X    Xv_opaque    obj;
  1282. X    
  1283. X    obj = xv_create(owner, PANEL_CHOICE,
  1284. X        XV_KEY_DATA, INSTANCE, ip,
  1285. X        XV_X, 42,
  1286. X        XV_Y, 13,
  1287. X        PANEL_CHOICE_NROWS, 1,
  1288. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  1289. X        PANEL_CHOOSE_NONE, FALSE,
  1290. X        PANEL_NOTIFY_PROC, change_entry_type,
  1291. X        PANEL_CHOICE_STRINGS,
  1292. X            "List Item",
  1293. X            "Category",
  1294. X            NULL,
  1295. X        NULL);
  1296. X    return obj;
  1297. }
  1298. X
  1299. /*
  1300. X * Create object `entry_category' in the specified instance.
  1301. X */
  1302. XXv_opaque
  1303. entry_entry_frame_entry_category_create(ip, owner)
  1304. X    entry_entry_frame_objects    *ip;
  1305. X    Xv_opaque    owner;
  1306. {
  1307. X    Xv_opaque    obj;
  1308. X    
  1309. X    obj = xv_create(owner, PANEL_CHOICE, PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  1310. X        XV_KEY_DATA, INSTANCE, ip,
  1311. X        XV_X, 206,
  1312. X        XV_Y, 13,
  1313. X        PANEL_CHOICE_NROWS, 1,
  1314. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  1315. X        PANEL_LABEL_STRING, "Category:",
  1316. X        NULL);
  1317. X    return obj;
  1318. }
  1319. X
  1320. /*
  1321. X * Create object `recurring' in the specified instance.
  1322. X */
  1323. XXv_opaque
  1324. entry_entry_frame_recurring_create(ip, owner)
  1325. X    entry_entry_frame_objects    *ip;
  1326. X    Xv_opaque    owner;
  1327. {
  1328. X    extern void        create_recurring();
  1329. X    Xv_opaque    obj;
  1330. X    
  1331. X    obj = xv_create(owner, PANEL_BUTTON,
  1332. X        XV_KEY_DATA, INSTANCE, ip,
  1333. X        XV_X, 429,
  1334. X        XV_Y, 15,
  1335. X        PANEL_LABEL_STRING, "Recurring...",
  1336. X        PANEL_NOTIFY_PROC, create_recurring,
  1337. X        NULL);
  1338. X    return obj;
  1339. }
  1340. X
  1341. /*
  1342. X * Create object `entry_text' in the specified instance.
  1343. X */
  1344. XXv_opaque
  1345. entry_entry_frame_entry_text_create(ip, owner)
  1346. X    entry_entry_frame_objects    *ip;
  1347. X    Xv_opaque    owner;
  1348. {
  1349. X    Xv_opaque    obj;
  1350. X    
  1351. X    obj = xv_create(owner, PANEL_TEXT,
  1352. X        XV_KEY_DATA, INSTANCE, ip,
  1353. X        XV_X, 100,
  1354. X        XV_Y, 58,
  1355. X        PANEL_VALUE_DISPLAY_LENGTH, 40,
  1356. X        PANEL_VALUE_STORED_LENGTH, 80,
  1357. X        PANEL_LABEL_STRING, "Text:",
  1358. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  1359. X        PANEL_READ_ONLY, FALSE,
  1360. X        NULL);
  1361. X    return obj;
  1362. }
  1363. X
  1364. /*
  1365. X * Create object `entry_priority' in the specified instance.
  1366. X */
  1367. XXv_opaque
  1368. entry_entry_frame_entry_priority_create(ip, owner)
  1369. X    entry_entry_frame_objects    *ip;
  1370. X    Xv_opaque    owner;
  1371. {
  1372. X    Xv_opaque    obj;
  1373. X    
  1374. X    obj = xv_create(owner, PANEL_NUMERIC_TEXT,
  1375. X        XV_KEY_DATA, INSTANCE, ip,
  1376. X        XV_X, 101,
  1377. X        XV_Y, 79,
  1378. X        PANEL_VALUE_DISPLAY_LENGTH, 1,
  1379. X        PANEL_VALUE_STORED_LENGTH, 80,
  1380. X        PANEL_LABEL_STRING, "Priority:",
  1381. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  1382. X        PANEL_MAX_VALUE, 9,
  1383. X        PANEL_MIN_VALUE, 1,
  1384. X        PANEL_VALUE, 5,
  1385. X        PANEL_READ_ONLY, FALSE,
  1386. X        NULL);
  1387. X    return obj;
  1388. }
  1389. X
  1390. /*
  1391. X * Create object `entry_cancel' in the specified instance.
  1392. X */
  1393. XXv_opaque
  1394. entry_entry_frame_entry_cancel_create(ip, owner)
  1395. X    entry_entry_frame_objects    *ip;
  1396. X    Xv_opaque    owner;
  1397. {
  1398. X    extern void        close_create();
  1399. X    Xv_opaque    obj;
  1400. X    
  1401. X    obj = xv_create(owner, PANEL_BUTTON,
  1402. X        XV_KEY_DATA, INSTANCE, ip,
  1403. X        XV_X, 91,
  1404. X        XV_Y, 119,
  1405. X        PANEL_LABEL_STRING, "Cancel",
  1406. X        PANEL_NOTIFY_PROC, close_create,
  1407. X        NULL);
  1408. X    return obj;
  1409. }
  1410. X
  1411. /*
  1412. X * Create object `entry_done' in the specified instance.
  1413. X */
  1414. XXv_opaque
  1415. entry_entry_frame_entry_done_create(ip, owner)
  1416. X    entry_entry_frame_objects    *ip;
  1417. X    Xv_opaque    owner;
  1418. {
  1419. X    extern void        create_it();
  1420. X    Xv_opaque    obj;
  1421. X    
  1422. X    obj = xv_create(owner, PANEL_BUTTON,
  1423. X        XV_KEY_DATA, INSTANCE, ip,
  1424. X        XV_X, 351,
  1425. X        XV_Y, 119,
  1426. X        PANEL_LABEL_STRING, "Done",
  1427. X        PANEL_NOTIFY_PROC, create_it,
  1428. X        NULL);
  1429. X    return obj;
  1430. }
  1431. X
  1432. SHAR_EOF
  1433. chmod 0644 entry_ui.c ||
  1434. echo 'restore of entry_ui.c failed'
  1435. Wc_c="`wc -c < 'entry_ui.c'`"
  1436. test 5824 -eq "$Wc_c" ||
  1437.     echo 'entry_ui.c: original size 5824, current size' "$Wc_c"
  1438. rm -f _shar_wnt_.tmp
  1439. fi
  1440. # ============= logedit_ui.c ==============
  1441. if test -f 'logedit_ui.c' -a X"$1" != X"-c"; then
  1442.     echo 'x - skipping logedit_ui.c (File already exists)'
  1443.     rm -f _shar_wnt_.tmp
  1444. else
  1445. > _shar_wnt_.tmp
  1446. echo 'x - extracting logedit_ui.c (Text)'
  1447. sed 's/^X//' << 'SHAR_EOF' > 'logedit_ui.c' &&
  1448. /*
  1449. X * logedit_ui.c - User interface object initialization functions.
  1450. X * This file was generated by `gxv' from `logedit.G'.
  1451. X * DO NOT EDIT BY HAND.
  1452. X */
  1453. X
  1454. #include <stdio.h>
  1455. #include <sys/param.h>
  1456. #include <sys/types.h>
  1457. #include <xview/xview.h>
  1458. #include <xview/canvas.h>
  1459. #include <xview/panel.h>
  1460. #include <xview/scrollbar.h>
  1461. #include <xview/svrimage.h>
  1462. #include <xview/termsw.h>
  1463. #include <xview/text.h>
  1464. #include <xview/tty.h>
  1465. #include <xview/xv_xrect.h>
  1466. #include "logedit_ui.h"
  1467. X
  1468. /*
  1469. X * Initialize an instance of object `log_edit'.
  1470. X */
  1471. logedit_log_edit_objects *
  1472. logedit_log_edit_objects_initialize(ip, owner)
  1473. X    logedit_log_edit_objects    *ip;
  1474. X    Xv_opaque    owner;
  1475. {
  1476. X    if (!ip && !(ip = (logedit_log_edit_objects *) calloc(1, sizeof (logedit_log_edit_objects))))
  1477. X        return (logedit_log_edit_objects *) NULL;
  1478. X    if (!ip->log_edit)
  1479. X        ip->log_edit = logedit_log_edit_log_edit_create(ip, owner);
  1480. X    if (!ip->log_editor)
  1481. X        ip->log_editor = logedit_log_edit_log_editor_create(ip, ip->log_edit);
  1482. X    if (!ip->controls1)
  1483. X        ip->controls1 = logedit_log_edit_controls1_create(ip, ip->log_edit);
  1484. X    if (!ip->log_editor_cancel)
  1485. X        ip->log_editor_cancel = logedit_log_edit_log_editor_cancel_create(ip, ip->controls1);
  1486. X    if (!ip->log_editor_done)
  1487. X        ip->log_editor_done = logedit_log_edit_log_editor_done_create(ip, ip->controls1);
  1488. X    return ip;
  1489. }
  1490. X
  1491. /*
  1492. X * Create object `log_edit' in the specified instance.
  1493. X */
  1494. XXv_opaque
  1495. logedit_log_edit_log_edit_create(ip, owner)
  1496. X    logedit_log_edit_objects    *ip;
  1497. X    Xv_opaque    owner;
  1498. {
  1499. X    Xv_opaque    obj;
  1500. X    
  1501. X    obj = xv_create(owner, FRAME_CMD,
  1502. X        XV_KEY_DATA, INSTANCE, ip,
  1503. X        XV_WIDTH, 532,
  1504. X        XV_HEIGHT, 334,
  1505. X        XV_LABEL, "Edit Log Entry",
  1506. X        FRAME_SHOW_FOOTER, TRUE,
  1507. X        FRAME_SHOW_RESIZE_CORNER, TRUE,
  1508. X        FRAME_CMD_PUSHPIN_IN, FALSE,
  1509. X        NULL);
  1510. X    xv_set(xv_get(obj, FRAME_CMD_PANEL), WIN_SHOW, FALSE, NULL);
  1511. X    return obj;
  1512. }
  1513. X
  1514. /*
  1515. X * Create object `log_editor' in the specified instance.
  1516. X */
  1517. XXv_opaque
  1518. logedit_log_edit_log_editor_create(ip, owner)
  1519. X    logedit_log_edit_objects    *ip;
  1520. X    Xv_opaque    owner;
  1521. {
  1522. X    Xv_opaque    obj;
  1523. X    
  1524. X    obj = xv_create(owner, TEXTSW,
  1525. X        XV_KEY_DATA, INSTANCE, ip,
  1526. X        XV_X, 0,
  1527. X        XV_Y, 0,
  1528. X        XV_WIDTH, WIN_EXTEND_TO_EDGE,
  1529. X        XV_HEIGHT, 291,
  1530. X        OPENWIN_SHOW_BORDERS, TRUE,
  1531. X        NULL);
  1532. X    return obj;
  1533. }
  1534. X
  1535. /*
  1536. X * Create object `controls1' in the specified instance.
  1537. X */
  1538. XXv_opaque
  1539. logedit_log_edit_controls1_create(ip, owner)
  1540. X    logedit_log_edit_objects    *ip;
  1541. X    Xv_opaque    owner;
  1542. {
  1543. X    Xv_opaque    obj;
  1544. X    
  1545. X    obj = xv_create(owner, PANEL,
  1546. X        XV_KEY_DATA, INSTANCE, ip,
  1547. X        XV_X, 0,
  1548. X        XV_Y, (int)xv_get(ip->log_editor, XV_Y) +
  1549. X              (int)xv_get(ip->log_editor, XV_HEIGHT),
  1550. X        XV_WIDTH, WIN_EXTEND_TO_EDGE,
  1551. X        XV_HEIGHT, WIN_EXTEND_TO_EDGE,
  1552. X        WIN_BORDER, FALSE,
  1553. X        NULL);
  1554. X    return obj;
  1555. }
  1556. X
  1557. /*
  1558. X * Create object `log_editor_cancel' in the specified instance.
  1559. X */
  1560. XXv_opaque
  1561. logedit_log_edit_log_editor_cancel_create(ip, owner)
  1562. X    logedit_log_edit_objects    *ip;
  1563. X    Xv_opaque    owner;
  1564. {
  1565. X    extern void        cancel_log_edit();
  1566. X    Xv_opaque    obj;
  1567. X    
  1568. X    obj = xv_create(owner, PANEL_BUTTON,
  1569. X        XV_KEY_DATA, INSTANCE, ip,
  1570. X        XV_X, 123,
  1571. X        XV_Y, 13,
  1572. X        PANEL_LABEL_STRING, "Cancel",
  1573. X        PANEL_NOTIFY_PROC, cancel_log_edit,
  1574. X        NULL);
  1575. X    return obj;
  1576. }
  1577. X
  1578. /*
  1579. X * Create object `log_editor_done' in the specified instance.
  1580. X */
  1581. XXv_opaque
  1582. logedit_log_edit_log_editor_done_create(ip, owner)
  1583. X    logedit_log_edit_objects    *ip;
  1584. X    Xv_opaque    owner;
  1585. {
  1586. X    extern void        log_log_edit();
  1587. X    Xv_opaque    obj;
  1588. X    
  1589. X    obj = xv_create(owner, PANEL_BUTTON,
  1590. X        XV_KEY_DATA, INSTANCE, ip,
  1591. X        XV_X, 363,
  1592. X        XV_Y, 13,
  1593. X        PANEL_LABEL_STRING, "Done",
  1594. X        PANEL_NOTIFY_PROC, log_log_edit,
  1595. X        NULL);
  1596. X    return obj;
  1597. }
  1598. X
  1599. SHAR_EOF
  1600. chmod 0644 logedit_ui.c ||
  1601. echo 'restore of logedit_ui.c failed'
  1602. Wc_c="`wc -c < 'logedit_ui.c'`"
  1603. test 3472 -eq "$Wc_c" ||
  1604.     echo 'logedit_ui.c: original size 3472, current size' "$Wc_c"
  1605. rm -f _shar_wnt_.tmp
  1606. fi
  1607. # ============= logger.c ==============
  1608. if test -f 'logger.c' -a X"$1" != X"-c"; then
  1609.     echo 'x - skipping logger.c (File already exists)'
  1610.     rm -f _shar_wnt_.tmp
  1611. else
  1612. > _shar_wnt_.tmp
  1613. echo 'x - extracting logger.c (Text)'
  1614. sed 's/^X//' << 'SHAR_EOF' > 'logger.c' &&
  1615. /*
  1616. X * $Id: logger.c,v 1.2 1992/07/28 12:04:52 jipping Exp $
  1617. X * **********************************************************************
  1618. X *
  1619. X *   Logger.c ==> Logging routines for XVTDL.
  1620. X *
  1621. X * ----------------------------------------------------------------------
  1622. X * Copyright (c) 1992 by Mike Jipping and Hope College
  1623. X *
  1624. X * Permission is granted to copy and distribute this file in modified or
  1625. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  1626. X * is preserved, (b) no attempt is made to restrict redistribution of this
  1627. X * file, and (c) this file is not distributed as part of any collection whose
  1628. X * redistribution is restricted by a compilation copyright.
  1629. X * ----------------------------------------------------------------------
  1630. X *
  1631. X * Revision History:
  1632. X * $Log: logger.c,v $
  1633. X * Revision 1.2  1992/07/28  12:04:52  jipping
  1634. X * Added an unlink of temp log file with "%" attached.
  1635. X *
  1636. X * Revision 1.1  1992/07/27  18:38:29  jipping
  1637. X * Initial revision
  1638. X *
  1639. X *
  1640. X */
  1641. X
  1642. #include "globaldefs.h"
  1643. #include "logedit_ui.h"
  1644. X
  1645. int log_level, log_info_level;
  1646. char log_file[LINESIZ];
  1647. X
  1648. logedit_log_edit_objects    *logedit_log_edit;
  1649. X
  1650. /*
  1651. X ***********************************************************************
  1652. X *  A dummy routine to call a GUIDE initialize function for the 
  1653. X *  log editor.
  1654. X */
  1655. void initialize_log_editor()
  1656. {
  1657. X    logedit_log_edit = logedit_log_edit_objects_initialize(NULL, tdlist);
  1658. }
  1659. X
  1660. /*
  1661. X * **********************************************************************
  1662. X * This routines logs a day_entry structure in a way appropriate to 
  1663. X * the setting of "log_level" and "log_info_level".
  1664. X */
  1665. void log_entry (de)
  1666. struct day_entry *de;
  1667. {
  1668. X    FILE *logfd;
  1669. X    FILE *tmp;
  1670. X    char *temp_file;
  1671. X   struct timeval tv;
  1672. X
  1673. X    logfd = fopen(log_file, "a+");
  1674. X    if (logfd == NULL) {
  1675. X        fprintf(stderr, "Problems opening log file (%s) -- no log made\n", log_file);
  1676. X        return;
  1677. X    }
  1678. X
  1679. X   gettimeofday(&tv, 0);
  1680. X   tm = localtime(&tv.tv_sec);
  1681. X
  1682. X    if ((log_level == LOG_AT_QUIT) || (log_info_level == LOG_TIMESTAMP)) {
  1683. X        if (de->checked) {
  1684. X            fprintf(logfd, "%s...COMPLETED \"%s\"\n\n", asctime(tm), de->text);
  1685. X        } else {
  1686. X            fprintf(logfd, "%s...UNCHECKED \"%s\"\n\n", asctime(tm), de->text);
  1687. X        }
  1688. X        fclose(logfd);
  1689. X    } else {
  1690. X        if ( (temp_file = tempnam(NULL, "log")) == NULL) {
  1691. X            fprintf(stderr, "Unable to create temporary log file name\n");
  1692. X            return;
  1693. X        }
  1694. X        if ( (tmp = fopen(temp_file, "w")) == NULL) {
  1695. X            fprintf(stderr, "Unable to open temp file %s\n", temp_file);
  1696. X            free(temp_file);
  1697. X            return;
  1698. X        }
  1699. X        if (de->checked) {
  1700. X            fprintf(tmp, "%s...COMPLETED \"%s\"\n\n", asctime(tm), de->text);
  1701. X        } else {
  1702. X            fprintf(tmp, "%s...UNCHECKED \"%s\"\n\n", asctime(tm), de->text);
  1703. X        }
  1704. X        fclose(tmp);
  1705. X
  1706. X        xv_set(logedit_log_edit->log_editor_done, PANEL_CLIENT_DATA, logfd, 0);
  1707. X        xv_set(logedit_log_edit->log_editor, TEXTSW_FILE, temp_file, 0);
  1708. X        xv_set(logedit_log_edit->log_edit, XV_SHOW, TRUE, 0);
  1709. X    }
  1710. X
  1711. }
  1712. X
  1713. /*
  1714. X * **********************************************************************
  1715. X * Callback routine for the "Done" button on the log editor.  Logs the
  1716. X * comments into the log file.
  1717. X */
  1718. void log_log_edit(item, event)
  1719. Panel_item    item;
  1720. Event        *event;
  1721. {
  1722. X    logedit_log_edit_objects *ip =
  1723. X        (logedit_log_edit_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1724. X    FILE *logfd;
  1725. X
  1726. X    logfd = (FILE *)xv_get(ip->log_editor_done, PANEL_CLIENT_DATA);
  1727. X
  1728. X    textsw_save(ip->log_editor, 20, 20);
  1729. X    copyfile2(xv_get(ip->log_editor, TEXTSW_FILE), logfd);
  1730. X    fprintf(logfd, "\n");
  1731. X
  1732. X    fclose(logfd);
  1733. X    unlink(xv_get(ip->log_editor, TEXTSW_FILE));
  1734. X    unlink(strcat(xv_get(ip->log_editor, TEXTSW_FILE),"%"));
  1735. X    xv_set(logedit_log_edit->log_editor, TEXTSW_FILE, NULL, 0);
  1736. X    xv_set(logedit_log_edit->log_edit, XV_SHOW, FALSE, 0);
  1737. }
  1738. X
  1739. /*
  1740. X * **********************************************************************
  1741. X * Callback routine for the "cancel" button on the log editor.  Note that
  1742. X * we still log the message...just throw away any edits.
  1743. X */
  1744. void cancel_log_edit(item, event)
  1745. Panel_item    item;
  1746. Event        *event;
  1747. {
  1748. X    textsw_reset(logedit_log_edit->log_editor, 0, 0);
  1749. X    log_log_edit(item, event);
  1750. }
  1751. SHAR_EOF
  1752. chmod 0644 logger.c ||
  1753. echo 'restore of logger.c failed'
  1754. Wc_c="`wc -c < 'logger.c'`"
  1755. test 4019 -eq "$Wc_c" ||
  1756.     echo 'logger.c: original size 4019, current size' "$Wc_c"
  1757. rm -f _shar_wnt_.tmp
  1758. fi
  1759. # ============= main.c ==============
  1760. if test -f 'main.c' -a X"$1" != X"-c"; then
  1761.     echo 'x - skipping main.c (File already exists)'
  1762.     rm -f _shar_wnt_.tmp
  1763. else
  1764. > _shar_wnt_.tmp
  1765. echo 'x - extracting main.c (Text)'
  1766. sed 's/^X//' << 'SHAR_EOF' > 'main.c' &&
  1767. /* $Id: main.c,v 3.0 1992/07/27 18:40:26 jipping Exp $
  1768. X *
  1769. X * **********************************************************************
  1770. X *
  1771. X *  Main program for Xvtdl.
  1772. X *
  1773. X *  This routine sets up parameters from the command line, parses the
  1774. X *  specified todo database, and creates the windows, and sits back 
  1775. X *  to gather events.
  1776. X *
  1777. X *  Copyright (c) 1992 by Mike Jipping and Hope College
  1778. X * 
  1779. X *  Permission is granted to copy and distribute this file in modified or
  1780. X *  unmodified form, for noncommercial use, provided (a) this copyright notice
  1781. X *  is preserved, (b) no attempt is made to restrict redistribution of this
  1782. X *  file, and (c) this file is not distributed as part of any collection whose
  1783. X *  redistribution is restricted by a compilation copyright.
  1784. X *
  1785. X *  Revision History:
  1786. X *
  1787. X *  $Log: main.c,v $
  1788. X * Revision 3.0  1992/07/27  18:40:26  jipping
  1789. X * Release 3.0 includes:
  1790. X * * changed from "version.h" to "patchlevel.h" for comp.windows.x
  1791. X * * check X resources through a call to "load_xdefaults"
  1792. X * * fixed timer initialization
  1793. X * * interpose a destroy function
  1794. X *
  1795. X * Revision 2.5  1992/07/16  16:16:35  jipping
  1796. X * Fixed a bug with the Printer resource when none is present.
  1797. SHAR_EOF
  1798. true || echo 'restore of main.c failed'
  1799. fi
  1800. echo 'End of  part 2'
  1801. echo 'File main.c is continued in part 3'
  1802. echo 3 > _shar_seq_.tmp
  1803. exit 0
  1804. -- 
  1805. Senior Systems Scientist        mail: dcmartin@msi.com
  1806. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1807. 796 North Pastoria Avenue        at&t: 408/522-9236
  1808. Sunnyvale, California 94086        fax: 408/732-0831
  1809.