home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sources / x / 436 < prev    next >
Encoding:
Text File  |  1992-07-29  |  50.2 KB  |  1,830 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: v18i066: XVTDL 3.0, Part05/06
  5. Message-ID: <1992Jul29.175125.15067@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:51:25 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1816
  13.  
  14. Submitted-by: jipping@cs.hope.edu (Mike Jipping)
  15. Posting-number: Volume 18, Issue 66
  16. Archive-name: xvtdl-3.0/part05
  17.  
  18. #!/bin/sh
  19. # this is part.05 (part 5 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file control.c 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" != 5; 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 control.c'
  37. else
  38. echo 'x - continuing file control.c'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'control.c' &&
  40. X                              0);
  41. X            xv_set(item, PANEL_VALUE, 0, 0);
  42. X         return;
  43. X        }
  44. X        xv_set(entry_category, PANEL_INACTIVE, TRUE, 0);
  45. X        xv_set(recurring, PANEL_INACTIVE, TRUE, 0);
  46. X        xv_set(entry_editor->entry_priority, PANEL_INACTIVE, TRUE, 0);
  47. X    }
  48. }
  49. X
  50. /*
  51. X * **********************************************************************
  52. X * Call back routine to list all categories.  Does a little house keeping
  53. X *  -- like make the categories item in print window inactive -- but 
  54. X * really nothing terribly special.
  55. X */
  56. void list_all_categories(item, event)
  57. Panel_item item; 
  58. Event      *event;
  59. {
  60. X    xv_set(print_print_base->categories, PANEL_INACTIVE, TRUE, 0);
  61. X    display_all(curr_month, curr_day, curr_year);
  62. }
  63. X
  64. /*
  65. X * **********************************************************************
  66. X * This routine is called when it's midnight.  It performs propagation
  67. X * of list items and refreshes the data file.
  68. X */
  69. Notify_value midnight()
  70. {
  71. X   struct timeval tv;
  72. X    struct category_rec *cr;
  73. X
  74. X   gettimeofday(&tv, 0);
  75. X   tm = localtime(&tv.tv_sec);
  76. X   today = *tm;
  77. X   curr_month = today.tm_mon+1;
  78. X   curr_day = today.tm_mday;
  79. X   curr_year = today.tm_year+1900;
  80. X
  81. X    propagate();
  82. X
  83. X    cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  84. X    entry_head = cr->entry_head;
  85. X    entry_tail = cr->entry_tail;
  86. X    rl_head = cr->rl_head;
  87. X    rl_tail = cr->rl_tail;
  88. X    go_today();
  89. X
  90. X    return NOTIFY_DONE;
  91. }
  92. X
  93. X
  94. /*
  95. X * **********************************************************************
  96. X * This routine is called hourly.  It wakes up, refreshes the data base,
  97. X * and called the midght routine if necessary.
  98. X */    
  99. Notify_value hourly()
  100. {
  101. X   struct timeval tv;
  102. X
  103. X   gettimeofday(&tv, 0);
  104. X   tm = localtime(&tv.tv_sec);
  105. X    if (tm->tm_hour == 0) midnight();
  106. X
  107. X    return NOTIFY_DONE;
  108. X    
  109. }
  110. X
  111. /*
  112. X * **********************************************************************
  113. X * This routine is called for events on the base window.  It is mostly
  114. X * used for resizing the window and the inner panels to match.
  115. X */
  116. void tdl_events(window, event)
  117. XXv_Window       window;
  118. Event *event;
  119. {
  120. X    int height, width;
  121. X    int y;
  122. X    int rows, rowsize;
  123. X    
  124. X    switch(event_id(event)) {
  125. X       case WIN_RESIZE:
  126. X           height = xv_get(tdl_list, XV_HEIGHT);
  127. X            width = xv_get(tdl_list, XV_WIDTH);
  128. X            y = xv_get(todo, PANEL_ITEM_Y);
  129. X            rowsize = xv_get(todo, PANEL_LIST_ROW_HEIGHT);
  130. X            rows = (height - y - 20) / rowsize;
  131. X            if (rows <= 0)
  132. X                rows = 1;
  133. X            xv_set(todo, 
  134. X                     PANEL_LIST_DISPLAY_ROWS, rows,
  135. X                     PANEL_LIST_WIDTH, width - 30, 
  136. X                     NULL);
  137. X            break;
  138. X        default:
  139. X            break;
  140. X    }
  141. }
  142. X
  143. /*
  144. X * **********************************************************************
  145. X * This routine is called as a trap for the window destroy events...so we
  146. X * can write the database before we really quit.
  147. X */
  148. Notify_value my_destroy_func(client, status)
  149. Notify_client   client;
  150. Destroy_status  status;
  151. {
  152. X    if (status == DESTROY_SAVE_YOURSELF) {
  153. X        /* save state. Not a death */
  154. X        return NOTIFY_DONE;
  155. X    }
  156. X
  157. X    if (changed) refresh_db(log_level == LOG_AT_QUIT);
  158. X   xv_destroy_safe(tdlist);
  159. X
  160. X    switch(status) {
  161. X       case DESTROY_CHECKING:
  162. X           break;
  163. X       case DESTROY_CLEANUP:
  164. X           return notify_next_destroy_func(client, status);
  165. X           break;
  166. X       case DESTROY_PROCESS_DEATH:
  167. X           exit(1);
  168. X           break;
  169. X    }
  170. X    return NOTIFY_DONE;
  171. }
  172. X
  173. /*
  174. X * **********************************************************************
  175. X * Close the todo list to an iconic state.  Refresh the db if need be.
  176. X */
  177. void close_tdlist(item, event)
  178. Panel_item item; 
  179. Event      *event;
  180. {
  181. X    if (changed) refresh_db(FALSE);
  182. X    xv_set(tdlist, FRAME_CLOSED, TRUE, 0);
  183. }
  184. X
  185. /*
  186. X * **********************************************************************
  187. X * Terminate the program.
  188. X */
  189. void quit(item, event)
  190. Panel_item item; 
  191. Event      *event;
  192. {
  193. X    my_destroy_func((Notify_client)NULL, DESTROY_PROCESS_DEATH);
  194. X    notify_stop();
  195. }
  196. SHAR_EOF
  197. echo 'File control.c is complete' &&
  198. chmod 0644 control.c ||
  199. echo 'restore of control.c failed'
  200. Wc_c="`wc -c < 'control.c'`"
  201. test 20185 -eq "$Wc_c" ||
  202.     echo 'control.c: original size 20185, current size' "$Wc_c"
  203. rm -f _shar_wnt_.tmp
  204. fi
  205. # ============= create_windows.c ==============
  206. if test -f 'create_windows.c' -a X"$1" != X"-c"; then
  207.     echo 'x - skipping create_windows.c (File already exists)'
  208.     rm -f _shar_wnt_.tmp
  209. else
  210. > _shar_wnt_.tmp
  211. echo 'x - extracting create_windows.c (Text)'
  212. sed 's/^X//' << 'SHAR_EOF' > 'create_windows.c' &&
  213. /*
  214. X *  Create_windows.c ==> Routines to setup the windows in the XVTDL
  215. X *                       environment.
  216. X *
  217. X *  This includes calls to create cursors.
  218. X *
  219. X * ----------------------------------------------------------------------
  220. X * Copyright (c) 1992 by Mike Jipping and Hope College
  221. X *
  222. X * Permission is granted to copy and distribute this file in modified or
  223. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  224. X * is preserved, (b) no attempt is made to restrict redistribution of this
  225. X * file, and (c) this file is not distributed as part of any collection whose
  226. X * redistribution is restricted by a compilation copyright.
  227. X * ----------------------------------------------------------------------
  228. X *
  229. X * Revision History:
  230. X *
  231. X * $Log: create_windows.c,v $
  232. X * Revision 3.1  1992/07/28  12:05:51  jipping
  233. X * Adjusted title on "List All" button.
  234. X *
  235. X * Revision 3.0  1992/07/27  18:34:40  jipping
  236. X * Release 3.0 includes:
  237. X * * rearranged items on the control panel
  238. X * * added "List All..." and "Done" buttons
  239. X * * added distinguishing macros for Xview versions 2 and 3
  240. X * * added initializations for the properties and log editors
  241. X *
  242. X * Revision 2.3  1992/07/13  18:58:35  jipping
  243. X * Altered window fitting calls to accomodate OW version 2.
  244. X *
  245. X * Revision 2.2  1992/07/13  15:53:32  jipping
  246. X * Changed several panels' size to WIN_EXTEND_TO_EDGE to accomodate
  247. X * correct resizing.
  248. X *
  249. X * Revision 2.1  1992/07/13  13:53:52  jipping
  250. X * Placed all bitmaps for checks and buttons in a subdirectory.
  251. X *
  252. X * Revision 2.0  1992/07/10  17:17:53  jipping
  253. X * Initial Release.
  254. X *
  255. X * Revision 2.0  1992/07/10  16:21:58  jipping
  256. X * Initial Release
  257. X *
  258. X */
  259. X
  260. #include "globaldefs.h"
  261. X
  262. /*
  263. X *  Window system declarations...callback routines and XView variables
  264. X */
  265. X
  266. void tdl_events();
  267. void repaint_proc(), calendar_event_proc();
  268. void create(), close_list(), close_create();
  269. void go_forward(), go_today(), go_backward(), quit();
  270. void tdl_notify_proc();
  271. void create_it(), edit(), start_print();
  272. void create_recurring(), cancel_recurring(), choose_recurring(), close_recurring();
  273. void choose_new_category(), change_entry_type();
  274. void pg(), copy(), cut(), paste();
  275. void open_properties(), list_all_categories(), close_tdlist();
  276. X
  277. Icon  tdl_icon;
  278. Panel tdl_title, tdl_control, tdl_list;
  279. Panel_item date_message, backward, goto_today, forward, categories, recurring;
  280. Panel_item properties;
  281. Panel_item todo, create_entry, edit_entry, print_tdl, close_tdl, quit_tdl;
  282. Menu edit_menu;
  283. X
  284. Frame entry_frame;
  285. Panel entry_panel;
  286. Panel_item entry_text, entry_done, entry_type, entry_category;
  287. X
  288. Frame recurring_frame;
  289. Panel recurring_panel;
  290. Panel_item freq, day_of_week, day_of_week2, weeks, week_of_month;
  291. X
  292. /*
  293. X
  294. X *  Image declarations -- bitmaps for glyphs and icons.
  295. X */
  296. X
  297. static short notepad_bits[] = {
  298. #include "bitmaps/tdl.pr"
  299. };
  300. Server_image notepad;
  301. X
  302. static short notepad_mask_bits[] = {
  303. #include "bitmaps/tdl_mask.pr"
  304. };
  305. Server_image notepad_mask;
  306. X
  307. static short backward_bits[] = {
  308. #include "bitmaps/backward.pr"
  309. };
  310. Server_image backward_image;
  311. X
  312. static short forward_bits[] = {
  313. #include "bitmaps/forward.pr"
  314. };
  315. Server_image forward_image;
  316. X
  317. static short props_bits[] = {
  318. #include "bitmaps/props.pr"
  319. };
  320. Server_image props_image;
  321. X
  322. static short checked_off_bits[] = {
  323. #include "bitmaps/checked_off.pr"
  324. };
  325. Server_image checked_off;
  326. X
  327. static short checked_on_bits[] = {
  328. #include "bitmaps/checked_on.pr"
  329. };
  330. Server_image checked_on;
  331. X
  332. Server_image checks[10];
  333. static short zero_bits[] = {
  334. #include "bitmaps/0.pr"
  335. };
  336. static short one_bits[] = {
  337. #include "bitmaps/1.pr"
  338. };
  339. static short two_bits[] = {
  340. #include "bitmaps/2.pr"
  341. };
  342. static short three_bits[] = {
  343. #include "bitmaps/3.pr"
  344. };
  345. static short four_bits[] = {
  346. #include "bitmaps/4.pr"
  347. };
  348. static short five_bits[] = {
  349. #include "bitmaps/5.pr"
  350. };
  351. static short six_bits[] = {
  352. #include "bitmaps/6.pr"
  353. };
  354. static short seven_bits[] = {
  355. #include "bitmaps/7.pr"
  356. };
  357. static short eight_bits[] = {
  358. #include "bitmaps/8.pr"
  359. };
  360. static short nine_bits[] = {
  361. #include "bitmaps/9.pr"
  362. };
  363. X
  364. /*
  365. X * **********************************************************************
  366. X * This creates all the window stuff.  Note that it calls initialize
  367. X * routines from GUIDE-developed code.
  368. X */
  369. create_windows()
  370. X
  371. {
  372. X    char day_title[50];
  373. X
  374. X    /*
  375. X     *  First off...cursors and glyphs...
  376. X    */
  377. X    create_cursors();
  378. X    
  379. X    checked_off = xv_create(NULL, SERVER_IMAGE,
  380. X                              XV_WIDTH,           16,
  381. X                              XV_HEIGHT,          16,
  382. X                              SERVER_IMAGE_DEPTH, 1,
  383. X                              SERVER_IMAGE_BITS,  checked_off_bits,
  384. X                              NULL);
  385. X    
  386. X    checked_on = xv_create(NULL, SERVER_IMAGE,
  387. X                              XV_WIDTH,           16,
  388. X                              XV_HEIGHT,          16,
  389. X                              SERVER_IMAGE_DEPTH, 1,
  390. X                              SERVER_IMAGE_BITS,  checked_on_bits,
  391. X                              NULL);
  392. X
  393. X    checks[0] = xv_create(NULL, SERVER_IMAGE,
  394. X                                 XV_WIDTH,           16,
  395. X                                 XV_HEIGHT,          16,
  396. X                                 SERVER_IMAGE_DEPTH, 1,
  397. X                                 SERVER_IMAGE_BITS,  zero_bits,
  398. X                                 NULL);
  399. X    checks[1] = xv_create(NULL, SERVER_IMAGE,
  400. X                                 XV_WIDTH,           16,
  401. X                                 XV_HEIGHT,          16,
  402. X                                 SERVER_IMAGE_DEPTH, 1,
  403. X                                 SERVER_IMAGE_BITS,  one_bits,
  404. X                                 NULL);
  405. X    checks[2] = xv_create(NULL, SERVER_IMAGE,
  406. X                                 XV_WIDTH,           16,
  407. X                                 XV_HEIGHT,          16,
  408. X                                 SERVER_IMAGE_DEPTH, 1,
  409. X                                 SERVER_IMAGE_BITS,  two_bits,
  410. X                                 NULL);
  411. X    checks[3] = xv_create(NULL, SERVER_IMAGE,
  412. X                                 XV_WIDTH,           16,
  413. X                                 XV_HEIGHT,          16,
  414. X                                 SERVER_IMAGE_DEPTH, 1,
  415. X                                 SERVER_IMAGE_BITS,  three_bits,
  416. X                                 NULL);
  417. X    checks[4] = xv_create(NULL, SERVER_IMAGE,
  418. X                                 XV_WIDTH,           16,
  419. X                                 XV_HEIGHT,          16,
  420. X                                 SERVER_IMAGE_DEPTH, 1,
  421. X                                 SERVER_IMAGE_BITS,  four_bits,
  422. X                                 NULL);
  423. X    checks[5] = xv_create(NULL, SERVER_IMAGE,
  424. X                                 XV_WIDTH,           16,
  425. X                                 XV_HEIGHT,          16,
  426. X                                 SERVER_IMAGE_DEPTH, 1,
  427. X                                 SERVER_IMAGE_BITS,  five_bits,
  428. X                                 NULL);
  429. X    checks[6] = xv_create(NULL, SERVER_IMAGE,
  430. X                                 XV_WIDTH,           16,
  431. X                                 XV_HEIGHT,          16,
  432. X                                 SERVER_IMAGE_DEPTH, 1,
  433. X                                 SERVER_IMAGE_BITS,  six_bits,
  434. X                                 NULL);
  435. X    checks[7] = xv_create(NULL, SERVER_IMAGE,
  436. X                                 XV_WIDTH,           16,
  437. X                                 XV_HEIGHT,          16,
  438. X                                 SERVER_IMAGE_DEPTH, 1,
  439. X                                 SERVER_IMAGE_BITS,  seven_bits,
  440. X                                 NULL);
  441. X    checks[8] = xv_create(NULL, SERVER_IMAGE,
  442. X                                 XV_WIDTH,           16,
  443. X                                 XV_HEIGHT,          16,
  444. X                                 SERVER_IMAGE_DEPTH, 1,
  445. X                                 SERVER_IMAGE_BITS,  eight_bits,
  446. X                                 NULL);
  447. X    checks[9] = xv_create(NULL, SERVER_IMAGE,
  448. X                                 XV_WIDTH,           16,
  449. X                                 XV_HEIGHT,          16,
  450. X                                 SERVER_IMAGE_DEPTH, 1,
  451. X                                 SERVER_IMAGE_BITS,  nine_bits,
  452. X                                 NULL);
  453. X
  454. X    /*
  455. X    *  Now, create the main todo list window. 
  456. X    *
  457. X    *  Start with the "title panel".
  458. X    */
  459. X
  460. X    tdl_title = xv_create(tdlist, PANEL,
  461. X                                 OPENWIN_SHOW_BORDERS,  TRUE,
  462. X                                 XV_WIDTH,  WIN_EXTEND_TO_EDGE,
  463. X                                 0);
  464. X
  465. X    notepad = xv_create(NULL, SERVER_IMAGE,
  466. X                              XV_WIDTH,           64,
  467. X                              XV_HEIGHT,          64,
  468. X                              SERVER_IMAGE_DEPTH, 1,
  469. X                              SERVER_IMAGE_BITS,  notepad_bits,
  470. X                              NULL);
  471. X
  472. X    notepad_mask = xv_create(NULL, SERVER_IMAGE,
  473. X                                     XV_WIDTH,           64,
  474. X                                     XV_HEIGHT,          64,
  475. X                                     SERVER_IMAGE_DEPTH, 1,
  476. X                                     SERVER_IMAGE_BITS,  notepad_mask_bits,
  477. X                                     NULL);
  478. X
  479. X    tdl_icon = xv_create(XV_NULL, ICON,
  480. X                                ICON_IMAGE,  notepad,
  481. X                                ICON_MASK_IMAGE, notepad_mask,
  482. X                                ICON_TRANSPARENT, TRUE,
  483. X                                0);
  484. X
  485. X    xv_set(tdlist, FRAME_ICON, tdl_icon, 0);
  486. X
  487. X    (void) xv_create(tdl_title, PANEL_MESSAGE,
  488. X                          PANEL_LABEL_IMAGE,  notepad,
  489. X                          XV_X, 280,
  490. X                          XV_Y, 10,
  491. X                          0);
  492. X
  493. X    strftime(day_title, 50, "%A, %B %e, %Y", today);
  494. X    date_message = xv_create(tdl_title, PANEL_MESSAGE,
  495. X                                     PANEL_LABEL_STRING, day_title,
  496. X                                     PANEL_LABEL_BOLD,   TRUE,
  497. X                                     XV_X,  200,
  498. X                                     XV_Y,  85,
  499. X                                     0);
  500. X
  501. X    window_fit_height(tdl_title);
  502. X
  503. X   /*
  504. X    *  Now the control panel 
  505. X    */
  506. X
  507. X    tdl_control = xv_create(tdlist, PANEL,
  508. X                                    WIN_BELOW, tdl_title,
  509. X                                    XV_WIDTH,  WIN_EXTEND_TO_EDGE,
  510. X                                    XV_X, 0,
  511. X                                    0);
  512. X
  513. X    backward_image = xv_create(NULL, SERVER_IMAGE,
  514. X                              XV_WIDTH,           32,
  515. X                              XV_HEIGHT,          22,
  516. X                              SERVER_IMAGE_DEPTH, 1,
  517. X                              SERVER_IMAGE_BITS,  backward_bits,
  518. X                              NULL);
  519. X
  520. X    categories = (Panel_item) xv_create(tdl_control, PANEL_CHOICE_STACK,
  521. X                                                    PANEL_LABEL_STRING, "Category:",
  522. X                                                    XV_X,  120,
  523. X                                                    XV_Y,  7,
  524. X                                                    PANEL_NOTIFY_PROC, choose_new_category,
  525. X                                                    0);
  526. X
  527. X    forward_image = xv_create(NULL, SERVER_IMAGE,
  528. X                              XV_WIDTH,           32,
  529. X                              XV_HEIGHT,          22,
  530. X                              SERVER_IMAGE_DEPTH, 1,
  531. X                              SERVER_IMAGE_BITS,  forward_bits,
  532. X                              NULL);
  533. X
  534. X    create_entry = xv_create(tdl_control, PANEL_BUTTON,
  535. X                                     PANEL_LABEL_STRING, "Create...",
  536. X                                     XV_X, 0,
  537. X                                     XV_Y, 40,
  538. X                                     PANEL_NOTIFY_PROC,  create,
  539. X                                     0);
  540. X
  541. X    edit_menu = xv_create(XV_NULL, MENU_COMMAND_MENU,
  542. X                                 MENU_ITEM,
  543. X                                    MENU_STRING, "Modify",
  544. X                                    MENU_GEN_PROC, edit,
  545. X                                    NULL,
  546. X                                 MENU_ITEM,
  547. X                                    MENU_STRING, "Copy",
  548. X                                    MENU_GEN_PROC, copy,
  549. X                                    NULL,
  550. X                                 MENU_ITEM,
  551. X                                    MENU_STRING, "Cut",
  552. X                                    MENU_GEN_PROC, cut,
  553. X                                    NULL,
  554. X                                 MENU_ITEM,
  555. X                                    MENU_STRING, "Paste",
  556. X                                    MENU_GEN_PROC, paste,
  557. X                                    NULL,
  558. X                                 MENU_ITEM,
  559. X                                    MENU_STRING, "",
  560. X                                    NULL,
  561. X                                 MENU_ITEM,
  562. X                                    MENU_STRING, "Properties...",
  563. X                                    MENU_NOTIFY_PROC, open_properties,
  564. X                                    NULL,
  565. X                                 MENU_GEN_PIN_WINDOW, tdlist, "Edit",
  566. X                                 NULL);    
  567. X
  568. X    edit_entry = xv_create(tdl_control, PANEL_BUTTON,
  569. X                                  PANEL_LABEL_STRING, "Edit",
  570. X                                  XV_X, 90,
  571. X                                  XV_Y, 40,
  572. X                                  PANEL_ITEM_MENU, edit_menu,
  573. X                                  0);
  574. X
  575. X    xv_create(tdl_control, PANEL_BUTTON,
  576. X                 PANEL_LABEL_STRING, "List All",
  577. #ifdef XVIEW3
  578. X                 PANEL_LABEL_WIDTH,  50,
  579. #endif
  580. X                 XV_X, 260,
  581. X                 XV_Y, 40,
  582. X                 PANEL_NOTIFY_PROC, list_all_categories,
  583. X                 0);
  584. X
  585. X    print_tdl = xv_create(tdl_control, PANEL_BUTTON,
  586. X                                 PANEL_LABEL_STRING, "Print...",
  587. #ifdef XVIEW3
  588. X                                 PANEL_LABEL_WIDTH,  50,
  589. #endif
  590. X                                 XV_X, 350,
  591. X                                 XV_Y, 40,
  592. X                                 PANEL_NOTIFY_PROC,  start_print,
  593. X                                 0);
  594. X
  595. X    backward = xv_create(tdl_control, PANEL_BUTTON,
  596. X                                XV_X,  0,
  597. X                                XV_Y,  0,
  598. X                                PANEL_LABEL_IMAGE, backward_image,
  599. X                                PANEL_NOTIFY_PROC, go_backward,
  600. X                                0);
  601. X
  602. X    forward = xv_create(tdl_control, PANEL_BUTTON,
  603. X                              PANEL_LABEL_IMAGE, forward_image,
  604. X                              XV_X,  373,
  605. X                              XV_Y,  0,
  606. X                              PANEL_NOTIFY_PROC, go_forward,
  607. X                              0);
  608. X
  609. X    close_tdl = xv_create(tdl_control, PANEL_BUTTON, 
  610. X                                 PANEL_LABEL_STRING, "Done",
  611. #ifdef XVIEW3
  612. X                                 PANEL_LABEL_WIDTH,  50,
  613. #endif
  614. X                                 XV_X, 0,
  615. X                                 XV_Y, 65,
  616. X                                 PANEL_NOTIFY_PROC, close_tdlist,
  617. X                                 0);
  618. X    
  619. X    goto_today = (Panel_item) xv_create(tdl_control, PANEL_BUTTON,
  620. X                                                    PANEL_LABEL_STRING, "Today",
  621. #ifdef XVIEW3
  622. X                                                    PANEL_LABEL_WIDTH,  50,
  623. #endif
  624. X                                                    XV_X,  170,
  625. X                                                    XV_Y,  40,
  626. X                                                    PANEL_NOTIFY_PROC, go_today,
  627. X                                                    0);
  628. X
  629. X    quit_tdl = xv_create(tdl_control, PANEL_BUTTON,
  630. X                                PANEL_LABEL_STRING, "Quit",
  631. #ifdef XVIEW3
  632. X                                PANEL_LABEL_WIDTH,  50,
  633. #endif
  634. X                                XV_X, 350,
  635. X                                XV_Y, 65,
  636. X                                PANEL_NOTIFY_PROC, quit,
  637. X                                0);
  638. X
  639. X    window_fit_height(tdl_control);
  640. X
  641. X    /*
  642. X    *  Now the TDL list...
  643. X    */
  644. X
  645. X    tdl_list = xv_create(tdlist, PANEL,
  646. X                                WIN_BELOW, tdl_control,
  647. X                                XV_WIDTH,  WIN_EXTEND_TO_EDGE,
  648. X                                XV_HEIGHT, WIN_EXTEND_TO_EDGE,
  649. X                                XV_X, 0,
  650. X                                0);
  651. X
  652. X    todo = xv_create(tdl_list, PANEL_LIST,
  653. X                          PANEL_LIST_WIDTH, 400,
  654. X                          PANEL_LIST_DISPLAY_ROWS, 10,
  655. X                          PANEL_CHOOSE_NONE, TRUE,
  656. X                          PANEL_NOTIFY_PROC, tdl_notify_proc,
  657. X                          PANEL_READ_ONLY, TRUE,
  658. X                          PANEL_ITEM_MENU, edit_menu,
  659. X                          0);
  660. X
  661. X    /*
  662. X     *  FInally, the calendar.  Notice that the calendar is a canvas...
  663. X    *  but is treated like an X11 graphics surface.
  664. X    */
  665. X
  666. X    calendar = xv_create(tdlist, CANVAS,
  667. X                                XV_X,           0,
  668. X                                XV_Y,           0,
  669. X                                XV_WIDTH,       175,
  670. X                                XV_HEIGHT,      100,
  671. X                                CANVAS_X_PAINT_WINDOW,  TRUE,
  672. X                                CANVAS_REPAINT_PROC,    repaint_proc,
  673. X                                0);
  674. X
  675. X    /* Set input mask */
  676. X    xv_set(canvas_paint_window(calendar),
  677. X             WIN_EVENT_PROC,         calendar_event_proc,
  678. X             WIN_IGNORE_EVENTS,
  679. X                LOC_WINENTER, LOC_WINEXIT,
  680. X                0,
  681. X             WIN_CONSUME_EVENTS,
  682. X                /*KBD_DONE, KBD_USE, LOC_DRAG, LOC_MOVE, LOC_WINENTER,*/
  683. X                /*LOC_WINEXIT, WIN_ASCII_EVENTS,*/ WIN_MOUSE_BUTTONS,
  684. X                0,
  685. X             0);
  686. X
  687. X    /** Tack an event proc onto the window **/
  688. X    xv_set(tdlist, WIN_EVENT_PROC, tdl_events, 0);
  689. X
  690. X    /******  Entry Editor Window  *****/
  691. X
  692. X    entry_editor = entry_entry_frame_objects_initialize(XV_NULL, tdlist);
  693. X
  694. X    entry_frame = entry_editor->entry_frame;
  695. X    entry_type = entry_editor->entry_type;
  696. X    entry_category = entry_editor->entry_category;
  697. X    recurring = entry_editor->recurring;
  698. X    entry_done = entry_editor->entry_done;
  699. X    entry_text = entry_editor->entry_text;
  700. X
  701. X    /******  The recurrence editor *****/
  702. X
  703. X    recurring_frame = xv_create(entry_frame, FRAME_CMD,
  704. X                                         FRAME_LABEL, "Recurrence Editor",
  705. X                                         FRAME_CMD_PUSHPIN_IN, FALSE,
  706. X                                         XV_WIDTH, 630,
  707. X                                         XV_HEIGHT, 170,
  708. X                                         0);
  709. X
  710. X    recurring_panel = xv_create(recurring_frame, PANEL,
  711. X                                         XV_X, 0,
  712. X                                         XV_Y, 0,
  713. X                                         XV_WIDTH, 630,
  714. X                                         XV_HEIGHT, 160,
  715. X                                         0);
  716. X    
  717. X    freq = xv_create(recurring_panel, PANEL_CHOICE,
  718. X                 PANEL_LABEL_STRING,   "Freq:",
  719. X                 PANEL_CHOICE_STRINGS, "None",
  720. X                                         "Daily",
  721. X                                       "Weekly",
  722. X                                       "BiWeekly",
  723. X                                       "Monthly",
  724. X                                       "Yearly",
  725. X                                       0,
  726. X                 PANEL_DISPLAY_LEVEL,  PANEL_ALL,
  727. X                 PANEL_VALUE_X,        130,
  728. X                 PANEL_VALUE_Y,        10,
  729. X                 PANEL_NOTIFY_PROC,    choose_recurring,
  730. X                PANEL_VALUE,          0,
  731. X                 0);
  732. X
  733. X    day_of_week = xv_create(recurring_panel, PANEL_CHOICE,
  734. X                                    PANEL_LABEL_STRING,   "Day of Week:",
  735. X                                    PANEL_CHOICE_STRINGS,
  736. X                                            "Sunday",
  737. X                                            "Monday",
  738. X                                       "Tuesday",
  739. X                                       "Wednesday",
  740. X                                       "Thursday",
  741. X                                            "Friday",
  742. X                                       "Saturday",
  743. X                                       "Mon/Wed/Fri",
  744. X                                            "Tues/Thurs",
  745. X                                       0,
  746. X                                    PANEL_CHOICE_YS, 
  747. X                                       35, 35, 35, 35, 35, 35, 35, 60, 60,
  748. X                                       0,
  749. X                                    PANEL_CHOICE_X, 7, 130,
  750. X                                    PANEL_CHOICE_X, 8, 225,
  751. X                                    PANEL_DISPLAY_LEVEL,  PANEL_ALL,
  752. X                                    PANEL_VALUE_X,        130,
  753. X                                    PANEL_VALUE_Y,        35,
  754. X                                    PANEL_VALUE,  0,
  755. X                                    PANEL_INACTIVE,  TRUE,
  756. X                                    0);
  757. X    
  758. X    weeks = xv_create(recurring_panel, PANEL_NUMERIC_TEXT,
  759. X                            PANEL_VALUE_X,        130,
  760. X                            PANEL_VALUE_Y,        85,
  761. X                            PANEL_LABEL_STRING,   "# of weeks:",
  762. X                            PANEL_INACTIVE,  TRUE,
  763. X                            PANEL_VALUE_DISPLAY_LENGTH, 3,
  764. X                            0);
  765. X
  766. X    week_of_month = xv_create(recurring_panel, PANEL_NUMERIC_TEXT,
  767. X                                      PANEL_VALUE_X,        130,
  768. X                                      PANEL_VALUE_Y,        120,
  769. X                                      PANEL_LABEL_STRING,   "Week of month:",
  770. X                                      PANEL_INACTIVE,  TRUE,
  771. X                                      PANEL_VALUE_DISPLAY_LENGTH, 3,
  772. X                                      0);
  773. X
  774. X    xv_create(recurring_panel, PANEL_BUTTON, 
  775. X                 PANEL_LABEL_STRING, "Cancel",
  776. X                 PANEL_NOTIFY_PROC,  cancel_recurring,
  777. X                 PANEL_VALUE_X,      550,
  778. X                 PANEL_VALUE_Y,      140,
  779. X                 0);
  780. X
  781. X    xv_create(recurring_panel, PANEL_BUTTON, 
  782. X                 PANEL_LABEL_STRING, "Done",
  783. X                 PANEL_VALUE_X,      600,
  784. X                 PANEL_VALUE_Y,      140,
  785. X                 PANEL_NOTIFY_PROC,  close_recurring, 
  786. X                 0);
  787. X
  788. X    /*
  789. X    *  Initialize the rest by calling their routines
  790. X    */
  791. X    initialize_print();
  792. X    initialize_props();
  793. X    initialize_log_editor();
  794. X
  795. }
  796. X
  797. /*
  798. X * repaint_proc()
  799. X *      Called to repaint the canvas in response to damage events
  800. X *      and the initial painting of the canvas window.
  801. X */
  802. void
  803. repaint_proc(canvas, paint_window, dpy, xwin, xrects)
  804. Canvas        canvas;           /* Ignored */
  805. XXv_Window     paint_window;     /* Ignored */
  806. Display      *dpy;
  807. Window        xwin;
  808. XXv_xrectlist *xrects;           /* Ignored */
  809. {
  810. X    GC gc = DefaultGC(dpy, DefaultScreen(dpy));
  811. X
  812. X    XClearWindow(dpy, xwin);
  813. X     print_calendar(curr_month, curr_year);
  814. }
  815. X
  816. void reset_date_message()
  817. {
  818. X    char day_title[50];
  819. X    struct tm *now;
  820. X   struct timeval tv;
  821. X
  822. X   now = localtime(&tv.tv_sec);
  823. X    now->tm_mon = curr_month - 1;
  824. X    now->tm_mday = curr_day;
  825. X    now->tm_year = curr_year-1900;
  826. X    now->tm_wday = zeller(curr_month, curr_day, curr_year);
  827. X    
  828. X    strftime(day_title, 50, "%A, %B %e, %Y", now);
  829. X    xv_set(date_message, PANEL_LABEL_STRING, day_title, 0);
  830. }
  831. SHAR_EOF
  832. chmod 0644 create_windows.c ||
  833. echo 'restore of create_windows.c failed'
  834. Wc_c="`wc -c < 'create_windows.c'`"
  835. test 16778 -eq "$Wc_c" ||
  836.     echo 'create_windows.c: original size 16778, current size' "$Wc_c"
  837. rm -f _shar_wnt_.tmp
  838. fi
  839. # ============= list.c ==============
  840. if test -f 'list.c' -a X"$1" != X"-c"; then
  841.     echo 'x - skipping list.c (File already exists)'
  842.     rm -f _shar_wnt_.tmp
  843. else
  844. > _shar_wnt_.tmp
  845. echo 'x - extracting list.c (Text)'
  846. sed 's/^X//' << 'SHAR_EOF' > 'list.c' &&
  847. /*
  848. X * $Id: list.c,v 3.0 1992/07/27 18:36:51 jipping Exp $
  849. X * **********************************************************************
  850. X *
  851. X * List.c ==> List manipulation routines.
  852. X *            If it changes the current todo list widget somehow, it's 
  853. X *            here!
  854. X *
  855. X * ----------------------------------------------------------------------
  856. X * Copyright (c) 1992 by Mike Jipping and Hope College
  857. X *
  858. X * Permission is granted to copy and distribute this file in modified or
  859. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  860. X * is preserved, (b) no attempt is made to restrict redistribution of this
  861. X * file, and (c) this file is not distributed as part of any collection whose
  862. X * redistribution is restricted by a compilation copyright.
  863. X * ----------------------------------------------------------------------
  864. X *
  865. X * Revision History:
  866. X *
  867. X * $Log: list.c,v $
  868. X * Revision 3.0  1992/07/27  18:36:51  jipping
  869. X * Release 3.0 includes:
  870. X * * added "display_all" to display all list items
  871. X * * corrected cut buffer manipulation
  872. X * * fixed several list management bugs
  873. X * * added file backup to "refresh_db"
  874. X * * added logging capability
  875. X *
  876. X * Revision 2.4  1992/07/14  16:42:37  jipping
  877. X * Fixed incorrect list management in cut_selection (->next not being
  878. X * taken care of).
  879. X *
  880. X * Revision 2.3  1992/07/14  13:01:36  jipping
  881. X * Eliminated placing a callback on the text field in edit window.
  882. X *
  883. X * Revision 2.2  1992/07/13  14:25:22  jipping
  884. X * Cleaned up warnings in compilation.
  885. X *
  886. X * Revision 2.1  1992/07/10  19:47:09  jipping
  887. X * *** empty log message ***
  888. X *
  889. X * Revision 2.0  1992/07/10  15:58:04  jipping
  890. X * Initial release.
  891. X *
  892. X *
  893. X */
  894. #include "globaldefs.h"
  895. X
  896. extern FILE *yyin;
  897. extern void edit_it();
  898. X
  899. struct category_rec *new_category();
  900. void refresh_db();
  901. X
  902. struct entry_list *entry_head, *entry_tail;
  903. struct category_rec *category_head;
  904. struct day_entry *cut_buffer=NULL;
  905. int selected_item;
  906. X
  907. /*
  908. X * **********************************************************************
  909. X * entry_search is a utility routine that searches for the list of
  910. X * entries for a particular datecode in the current category.
  911. X *
  912. X * If "create" is TRUE, the entry list structure is created under 
  913. X * the specified category if it is not found to exist.
  914. X */
  915. struct entry_list *entry_search(code, create, category)
  916. int code, create;
  917. struct category_rec *category;
  918. {
  919. X    struct entry_list *el, *tmpel;
  920. X    struct category_rec *cr;
  921. X
  922. X    el = entry_head;
  923. X    for (el = entry_head; el != NULL; el = el->next) {
  924. X        if (el->day_code == code) {return el;}
  925. X    }
  926. X
  927. X    if (! create) return NULL;
  928. X    
  929. X   /*** If is does not exist, create it! ***/
  930. X
  931. X    tmpel = NEW(struct entry_list);
  932. X    tmpel->day_code = code;
  933. X    tmpel->first = tmpel->last = NULL;
  934. X    tmpel->next = NULL;
  935. X    tmpel->rl_first = tmpel->rl_last = NULL;
  936. X    if (category == NULL) {
  937. X        cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  938. X    } else {
  939. X        cr = category;
  940. X    }
  941. X    if (cr == NULL) {
  942. X        cr = new_category("Every Day");
  943. X    }
  944. X    if (entry_head == NULL) {
  945. X        cr->entry_head = entry_head = tmpel;
  946. X    } else {
  947. X        cr->entry_tail->next = tmpel;
  948. X        entry_tail->next = tmpel;
  949. X    }
  950. X    cr->entry_tail = entry_tail = tmpel;
  951. X    return tmpel;
  952. }
  953. X
  954. /*
  955. X * **********************************************************************
  956. X * A utility routine that returns the day entry in the entry list
  957. X * parameter that matches the text in the recurrence entry.
  958. X */
  959. struct day_entry *entry_rl_search(el, rl)
  960. struct entry_list *el;
  961. struct recurrence_list *rl;
  962. {
  963. X    struct day_entry *trl;
  964. X    
  965. X    for (trl = el->rl_first; trl != NULL; trl = trl->next) {
  966. X        if (EQUAL(trl->text, rl->text)) return trl;
  967. X    }
  968. X    return NULL;
  969. }
  970. X
  971. /*
  972. X * **********************************************************************
  973. X * Given the name of a category, this routine creates a new category -- 
  974. X * menu item, data structure, and all.
  975. X */
  976. struct category_rec *new_category(name)
  977. char *name;
  978. {
  979. X    struct category_rec *cr, *tmpcr;
  980. X    int num_cats;
  981. X
  982. X    tmpcr = NEW(struct category_rec);
  983. X    if (category_head == NULL) {
  984. X        category_head = tmpcr;
  985. X        xv_set(categories, PANEL_CHOICE_STRING, 0, name, 0);
  986. X    } else {
  987. X        for (cr = category_head; cr->next != NULL; cr = cr->next) ;
  988. X        cr->next = tmpcr;
  989. X        xv_set(categories,
  990. X                 PANEL_CHOICE_STRING,
  991. X                    xv_get(xv_get(categories, PANEL_ITEM_MENU), MENU_NITEMS), name,
  992. X                 0);
  993. X    }
  994. X    strcpy(tmpcr->name, name);
  995. X    tmpcr->entry_head = tmpcr->entry_tail = (struct entry_list *) NULL;
  996. X    tmpcr->rl_head = tmpcr->rl_tail = (struct recurrence_list *) NULL;
  997. X    tmpcr->next = (struct category_rec *) NULL;
  998. X
  999. X    xv_set(categories,
  1000. X             PANEL_CLIENT_DATA, tmpcr,
  1001. X             0);
  1002. X
  1003. X    return(tmpcr);
  1004. }
  1005. X
  1006. /*
  1007. X * **********************************************************************
  1008. X * This routine adds a todo list item ("text") with the specified
  1009. X * priority to the given category with the specified month, day, and
  1010. X * year. 
  1011. X */
  1012. add_to (category, month, day, year, text, priority)
  1013. struct category_rec *category;
  1014. int month, day, year, text, priority;
  1015. {
  1016. X    int datecode;
  1017. X    struct day_entry *de, *tmpde;
  1018. X    struct entry_list *el;
  1019. X
  1020. X    datecode = (year-1990)*10000 + month*100 + day;
  1021. X    el = entry_search(datecode, TRUE, category);
  1022. X    de = el->last;
  1023. X
  1024. X    tmpde = NEW(struct day_entry);
  1025. X    tmpde->next = NULL;
  1026. X    strcpy(tmpde->text, text);
  1027. X    tmpde->priority = priority;
  1028. X    tmpde->checked = FALSE;
  1029. X    if (de == NULL) {
  1030. X        el->first = el->last = tmpde;
  1031. X        tmpde->prev = NULL;
  1032. X    } else {
  1033. X        de->next = el->last = tmpde;
  1034. X        tmpde->prev = de;
  1035. X    }
  1036. }
  1037. X
  1038. /*
  1039. X * **********************************************************************
  1040. X * Given a month, day, and year spec, this routine displays the todo
  1041. X * list.  This includes recurring and non-recurring entries.  The list is
  1042. X * sorted by priority.
  1043. X */
  1044. display_list (month, day, year)
  1045. int month, day, year;
  1046. {
  1047. X    int today_datecode, datecode, count, nrows;
  1048. X    int position[10], pos, prop;
  1049. X    struct entry_list *el;
  1050. X    struct day_entry *de;
  1051. X    struct recurrence_list *rl;
  1052. X    struct day_entry *tmprl, *rl2;
  1053. X    Server_image check;
  1054. X    char txt[80];
  1055. X
  1056. X   /*
  1057. X    *  Clear the position tally for sorting the display, and the 
  1058. X    *  display itself.
  1059. X    */
  1060. X    for (count=0; count<10; count++) position[count] = -1;
  1061. X
  1062. X    nrows = xv_get(todo, PANEL_LIST_NROWS);
  1063. X    for (count = nrows-1; count >= 0; count --)
  1064. X        xv_set(todo,
  1065. X                 PANEL_LIST_DELETE, count,
  1066. X                 0);
  1067. X
  1068. X   /*
  1069. X    *  compute the correct datecode and find the entry list for that
  1070. X    *  date.
  1071. X    */
  1072. X    datecode = (year-1990)*10000 + month*100 + day;
  1073. X    today_datecode =
  1074. X        (today.tm_year-90)*10000 + (today.tm_mon+1)*100 + today.tm_mday;
  1075. X    el = entry_search(datecode, FALSE, NULL);
  1076. X
  1077. X   /*
  1078. X    * If we have one, display its entries....
  1079. X    */
  1080. X    if (el != NULL) {
  1081. X        for (de = el->first; de != NULL; de = de->next) {
  1082. X            pos = prop = position[de->priority]+1;
  1083. X            for (count=de->priority; count>=0; count--) {
  1084. X                if (position[count] < prop) {
  1085. X                    position[count] = prop;
  1086. X                } else {
  1087. X                    prop = position[count]+1;
  1088. X                    position[count] = prop;
  1089. X                }
  1090. X            }
  1091. X            xv_set(todo, PANEL_LIST_INSERT, pos, 0);
  1092. X            xv_set(todo,
  1093. X                     PANEL_LIST_STRING, pos, de->text,
  1094. X                     PANEL_LIST_GLYPH, pos, de->checked?checked_on:checks[de->priority],
  1095. X                     PANEL_LIST_CLIENT_DATA, pos, de, 
  1096. X                     0);
  1097. X        }
  1098. X    }
  1099. X
  1100. X    /*
  1101. X     *  Search the recurrence list for possible candidates to display.
  1102. X     *  Note a few things:
  1103. X     *     (1)  A dummy list is created if none exists to speed searching.
  1104. X     *     (2)  When an entry is found that matches, a day entry is
  1105. X     *          created for that item.
  1106. X     *
  1107. X     */
  1108. X    el = entry_search(datecode, TRUE, NULL);
  1109. X    for (rl = rl_head; rl != NULL; rl = rl->next) {
  1110. X        if (datecode_matches(datecode, rl)) {
  1111. X            if (! entry_rl_search(el, rl)) {
  1112. X                rl2 = el->rl_last;
  1113. X                tmprl = NEW(struct day_entry);
  1114. X                tmprl->next = NULL;
  1115. X                strcpy(tmprl->text, rl->text);
  1116. X                tmprl->priority = rl->priority;
  1117. X                tmprl->checked = FALSE;
  1118. X                if (rl2 == NULL) {
  1119. X                    tmprl->prev = NULL;
  1120. X                    el->rl_first = el->rl_last = tmprl;
  1121. X                } else {
  1122. X                    tmprl->prev = rl2;
  1123. X                    rl2->next = el->rl_last = tmprl;
  1124. X                }
  1125. X                check = checks[tmprl->priority];
  1126. X            } else {
  1127. X                tmprl = entry_rl_search(el, rl);
  1128. X                check = tmprl->checked?checked_on:checks[tmprl->priority];
  1129. X            } 
  1130. X            tmprl->recurring_entry = TRUE;
  1131. X
  1132. X            pos = prop = position[tmprl->priority]+1;
  1133. X            for (count=tmprl->priority; count>=0; count--) {
  1134. X                if (position[count] < prop) {
  1135. X                    position[count] = prop;
  1136. X                } else {
  1137. X                    prop = position[count]+1;
  1138. X                    position[count] = prop;
  1139. X                }
  1140. X            }
  1141. X            xv_set(todo, PANEL_LIST_INSERT, pos, 0);
  1142. X            xv_set(todo,
  1143. X                     PANEL_LIST_STRING,  pos, tmprl->text,
  1144. X                     PANEL_LIST_GLYPH, pos, check,
  1145. X                     PANEL_LIST_CLIENT_DATA, pos, tmprl, 
  1146. X                     0);
  1147. X        }
  1148. X    }
  1149. }
  1150. X
  1151. /*
  1152. X * **********************************************************************
  1153. X * Given a month, day, and year spec, this routine displays the todo
  1154. X * list.  This includes recurring and non-recurring entries.  The list is
  1155. X * sorted by priority.
  1156. X */
  1157. display_all (month, day, year)
  1158. int month, day, year;
  1159. {
  1160. X    int today_datecode, datecode, count, nrows;
  1161. X    int position[10], pos, prop;
  1162. X    struct entry_list *el;
  1163. X    struct day_entry *de;
  1164. X    struct recurrence_list *rl;
  1165. X    struct day_entry *tmprl, *rl2;
  1166. X    struct category_rec *cr;
  1167. X    Server_image check;
  1168. X    char txt[80];
  1169. X
  1170. X   /*
  1171. X    *  Clear the position tally for sorting the display, and the 
  1172. X    *  display itself.
  1173. X    */
  1174. X    for (count=0; count<10; count++) position[count] = -1;
  1175. X
  1176. X    nrows = xv_get(todo, PANEL_LIST_NROWS);
  1177. X    for (count = nrows-1; count >= 0; count --)
  1178. X        xv_set(todo,
  1179. X                 PANEL_LIST_DELETE, count,
  1180. X                 0);
  1181. X
  1182. X   /*
  1183. X    *  compute the correct datecode and find the entry list for that
  1184. X    *  date.
  1185. X    */
  1186. X    datecode = (year-1990)*10000 + month*100 + day;
  1187. X    today_datecode =
  1188. X        (today.tm_year-90)*10000 + (today.tm_mon+1)*100 + today.tm_mday;
  1189. X
  1190. X    cr = category_head;
  1191. X    while (cr != NULL) {
  1192. X        entry_head = cr->entry_head;
  1193. X        entry_tail = cr->entry_tail;
  1194. X
  1195. X        el = entry_search(datecode, FALSE, NULL);
  1196. X
  1197. X        /*
  1198. X         * If we have one, display its entries....
  1199. X         */
  1200. X        if (el != NULL) {
  1201. X            for (de = el->first; de != NULL; de = de->next) {
  1202. X                pos = prop = position[de->priority]+1;
  1203. X                for (count=de->priority; count>=0; count--) {
  1204. X                    if (position[count] < prop) {
  1205. X                        position[count] = prop;
  1206. X                    } else {
  1207. X                        prop = position[count]+1;
  1208. X                        position[count] = prop;
  1209. X                    }
  1210. X                }
  1211. X                xv_set(todo, PANEL_LIST_INSERT, pos, 0);
  1212. X                xv_set(todo,
  1213. X                         PANEL_LIST_STRING, pos, de->text,
  1214. X                         PANEL_LIST_GLYPH, pos, de->checked?checked_on:checks[de->priority],
  1215. X                         PANEL_LIST_CLIENT_DATA, pos, de, 
  1216. X                         0);
  1217. X            }
  1218. X        }
  1219. X        
  1220. X        /*
  1221. X         *  Search the recurrence list for possible candidates to display.
  1222. X         *  Note a few things:
  1223. X         *     (1)  A dummy list is created if none exists to speed searching.
  1224. X         *     (2)  When an entry is found that matches, a day entry is
  1225. X         *          created for that item.
  1226. X         *
  1227. X         */
  1228. X        el = entry_search(datecode, TRUE, NULL);
  1229. X        for (rl = rl_head; rl != NULL; rl = rl->next) {
  1230. X            if (datecode_matches(datecode, rl)) {
  1231. X                if (! entry_rl_search(el, rl)) {
  1232. X                    rl2 = el->rl_last;
  1233. X                    tmprl = NEW(struct day_entry);
  1234. X                    tmprl->next = NULL;
  1235. X                    strcpy(tmprl->text, rl->text);
  1236. X                    tmprl->priority = rl->priority;
  1237. X                    tmprl->checked = FALSE;
  1238. X                    if (rl2 == NULL) {
  1239. X                        tmprl->prev = NULL;
  1240. X                        el->rl_first = el->rl_last = tmprl;
  1241. X                    } else {
  1242. X                        tmprl->prev = rl2;
  1243. X                        rl2->next = el->rl_last = tmprl;
  1244. X                    }
  1245. X                    check = checks[tmprl->priority];
  1246. X                } else {
  1247. X                    tmprl = entry_rl_search(el, rl);
  1248. X                    check = tmprl->checked?checked_on:checks[tmprl->priority];
  1249. X                } 
  1250. X                tmprl->recurring_entry = TRUE;
  1251. X                
  1252. X                pos = prop = position[tmprl->priority]+1;
  1253. X                for (count=tmprl->priority; count>=0; count--) {
  1254. X                    if (position[count] < prop) {
  1255. X                        position[count] = prop;
  1256. X                    } else {
  1257. X                        prop = position[count]+1;
  1258. X                        position[count] = prop;
  1259. X                    }
  1260. X                }
  1261. X                xv_set(todo, PANEL_LIST_INSERT, pos, 0);
  1262. X                xv_set(todo,
  1263. X                         PANEL_LIST_STRING,  pos, tmprl->text,
  1264. X                         PANEL_LIST_GLYPH, pos, check,
  1265. X                         PANEL_LIST_CLIENT_DATA, pos, tmprl, 
  1266. X                         0);
  1267. X            }
  1268. X        }
  1269. X        cr = cr->next;
  1270. X    }
  1271. X
  1272. X    cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  1273. X    entry_head = cr->entry_head;
  1274. X    entry_tail = cr->entry_tail;
  1275. X    rl_head = cr->rl_head;
  1276. X    rl_tail = cr->rl_tail;
  1277. }
  1278. X
  1279. /*
  1280. X * **********************************************************************
  1281. X * When a list item is chosen for editing, this routine is called with 
  1282. X * the day_entry structure of the list item.  This sets up the edit
  1283. X * window and (possibly) the recurrence editor window.
  1284. X */
  1285. void edit_selection(de)
  1286. struct day_entry *de;
  1287. {
  1288. X    char selection_text[LINESIZ];
  1289. X    int datecode;
  1290. X    struct entry_list *el;
  1291. X    struct recurrence_list *rl;
  1292. X    struct day_entry *tmprl, *rl2;
  1293. X    int choice, choices;
  1294. X    struct category_rec *cr;
  1295. X
  1296. X   /** Setup the category in the edit window. ***/
  1297. X    xv_set(entry_category, PANEL_CHOICE_STRINGS, "", 0, 0);
  1298. X
  1299. X    for (choice=0,cr=category_head; cr!=NULL; choice++,cr=cr->next) {
  1300. X        xv_set(entry_category, PANEL_CHOICE_STRING, choice, cr->name, 0);
  1301. X    }
  1302. X    xv_set(entry_category, PANEL_VALUE, xv_get(categories, PANEL_VALUE), 0);
  1303. X
  1304. X   /*** Now set up the rest of the window. ***/
  1305. X    strcpy(selection_text, xv_get(todo, PANEL_LIST_STRING, selected_item));
  1306. X    xv_set(entry_text, PANEL_VALUE, selection_text, 0);
  1307. X    xv_set(entry_type, PANEL_VALUE, 0, 0);
  1308. X    xv_set(entry_category, PANEL_INACTIVE, TRUE, 0);
  1309. X    xv_set(recurring, PANEL_INACTIVE, FALSE, 0);
  1310. X    xv_set(entry_editor->entry_priority, PANEL_INACTIVE, FALSE, 0);
  1311. X    xv_set(entry_editor->entry_priority, PANEL_VALUE, de->priority, 0);
  1312. X    xv_set(entry_done,
  1313. X             PANEL_NOTIFY_PROC, edit_it,
  1314. X             PANEL_CLIENT_DATA, selected_item,
  1315. X             0);
  1316. X
  1317. X   /* 
  1318. X    * If the entry is recurring, set up the recurrence window
  1319. X    */    
  1320. X    if (de->recurring_entry) {
  1321. X        xv_set(freq, PANEL_CLIENT_DATA, TRUE, 0);
  1322. X        datecode = (curr_year-1990)*10000 + curr_month*100 + curr_day;
  1323. X        for (rl = rl_head; rl != NULL; rl = rl->next) {
  1324. X            if (datecode_matches(datecode, rl)) {
  1325. X                if (EQUAL(de->text, rl->text)) {
  1326. X                    if (rl->daily) {
  1327. X                        xv_set(freq, PANEL_VALUE, 1, 0);
  1328. X                    } else if ( (rl->weekly) | (rl->biweekly) ) {
  1329. X                        if (rl->weekly) {
  1330. X                            xv_set(freq, PANEL_VALUE, 2, 0);
  1331. X                        } else {
  1332. X                            xv_set(freq, PANEL_VALUE, 3, 0);
  1333. X                        }
  1334. X                        xv_set(weeks,
  1335. X                                 PANEL_INACTIVE, FALSE,
  1336. X                                 PANEL_VALUE, rl->number_of_weeks,
  1337. X                                 0);
  1338. X                        if (rl->mwf) {
  1339. X                            xv_set(day_of_week, 
  1340. X                                     PANEL_INACTIVE, FALSE,
  1341. X                                     PANEL_VALUE,    7,
  1342. X                                     0);
  1343. X                        } else if (rl->tt) {
  1344. X                            xv_set(day_of_week, 
  1345. X                                     PANEL_INACTIVE, FALSE,
  1346. X                                     PANEL_VALUE,    8,
  1347. X                                     0);
  1348. X                        } else {
  1349. X                            xv_set(day_of_week, 
  1350. X                                     PANEL_INACTIVE, FALSE,
  1351. X                                     PANEL_VALUE,    rl->dow,
  1352. X                                     0);
  1353. X                        }
  1354. X                    } else if ( rl->monthly) {
  1355. X                        xv_set(freq, PANEL_VALUE, 4, 0);
  1356. X                        xv_set(week_of_month,
  1357. X                                 PANEL_INACTIVE, FALSE,
  1358. X                                 PANEL_VALUE, rl->week_number,
  1359. X                                 0);
  1360. X                        if (rl->mwf) {
  1361. X                            xv_set(day_of_week, 
  1362. X                                     PANEL_INACTIVE, FALSE,
  1363. X                                     PANEL_VALUE,    7,
  1364. X                                     0);
  1365. X                        } else if (rl->tt) {
  1366. X                            xv_set(day_of_week, 
  1367. X                                     PANEL_INACTIVE, FALSE,
  1368. X                                     PANEL_VALUE,    8,
  1369. X                                     0);
  1370. X                        } else {
  1371. X                            xv_set(day_of_week, 
  1372. X                                     PANEL_INACTIVE, FALSE,
  1373. X                                     PANEL_VALUE,    rl->dow,
  1374. X                                     0);
  1375. X                        }
  1376. X                    } else if ( rl->yearly ) {
  1377. X                        xv_set(freq, PANEL_VALUE, 5, 0);
  1378. X                    }
  1379. X                    break;
  1380. X                }
  1381. X            }
  1382. X        }
  1383. X    } else {
  1384. X      /***  Entry is not recurring...  ***/
  1385. X        xv_set(freq, PANEL_CLIENT_DATA, FALSE, 0);
  1386. X        xv_set(freq, PANEL_VALUE, 0, 0);
  1387. X        xv_set(day_of_week, PANEL_INACTIVE, TRUE, 0);
  1388. X        xv_set(weeks, PANEL_INACTIVE, TRUE, 0);
  1389. X        xv_set(week_of_month, PANEL_INACTIVE, TRUE, 0);
  1390. X    }
  1391. X    set_cursor(basic_cursor);
  1392. X            
  1393. X    xv_set(entry_frame,
  1394. X             XV_SHOW, TRUE,
  1395. X             0);
  1396. }
  1397. X
  1398. /*
  1399. X * **********************************************************************
  1400. X * Copying the selection is easy...copy it to a cut buffer variable.
  1401. X */
  1402. void copy_selection (de)
  1403. struct day_entry *de;
  1404. {
  1405. X    cut_buffer = de;
  1406. X    copying = FALSE;
  1407. X    set_cursor(basic_cursor);
  1408. }
  1409. X
  1410. /*
  1411. X * **********************************************************************
  1412. X * This routine cuts the selected entry from the todo list.  This is
  1413. X * done by locating the day_entry in a list...and freeing it up.
  1414. X */
  1415. void cut_selection (de)
  1416. struct day_entry *de;
  1417. {
  1418. X    struct entry_list *el;
  1419. X    struct recurrence_list *rl, *rlp;
  1420. X    struct category_rec *cr;
  1421. X    int datecode;
  1422. X
  1423. X    /* 
  1424. X    * First, copy into the cut buffer 
  1425. X    */
  1426. X    if (cut_buffer == NULL)
  1427. X        cut_buffer = NEW(struct day_entry);
  1428. X    strcpy(cut_buffer->text, de->text);
  1429. X    cut_buffer->checked = de->checked;
  1430. X    cut_buffer->recurring_entry = de->recurring_entry;
  1431. X    cut_buffer->priority = de->priority;
  1432. X
  1433. X    datecode = (curr_year-1990)*10000 + curr_month*100 + curr_day;
  1434. X    el = entry_search(datecode, FALSE, NULL);
  1435. X    if (de->prev != NULL) {  /* in the middle of the list */
  1436. X        if (de->next != NULL) de->next->prev = de->prev;
  1437. X        de->prev->next = de->next;
  1438. X    } else {   /* at the head of the list. */
  1439. X        if (de->next != NULL) de->next->prev = NULL;
  1440. X        if (de->recurring_entry) {
  1441. X            el->rl_first = de->next;
  1442. X        } else {
  1443. X            el->first = de->next;
  1444. X        }
  1445. X    }
  1446. X    if (de->recurring_entry) {
  1447. X        if (el->rl_last == de) el->rl_last = de->prev;
  1448. X    } else {
  1449. X        if (el->last == de) el->last = de->prev;
  1450. X    }
  1451. X
  1452. X    /*** We also need to remove it from a recurring list ***/
  1453. X    if (de->recurring_entry) {
  1454. X        datecode = (curr_year-1990)*10000 + curr_month*100 + curr_day;
  1455. X        rlp = NULL;
  1456. X        for (rl = rl_head; rl != NULL; rlp = rl, rl = rl->next) {
  1457. X            if (datecode_matches(datecode, rl)) {
  1458. X                if (EQUAL(de->text, rl->text)) {
  1459. X                    if (rlp == NULL) {
  1460. X                        rl_head = rl->next;
  1461. X                        cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  1462. X                        cr->rl_head = rl_head;
  1463. X                    } else {
  1464. X                        rlp->next = rl->next;
  1465. X                    }
  1466. X                    free(rl);
  1467. X                }
  1468. X            }
  1469. X        }
  1470. X    }
  1471. X
  1472. X    free(de);
  1473. X
  1474. X    display_list(curr_month, curr_day, curr_year);
  1475. X    refresh_db(FALSE);
  1476. X    cutting = FALSE;
  1477. X    set_cursor(basic_cursor);
  1478. }
  1479. X
  1480. /*
  1481. X * **********************************************************************
  1482. X * This routine is called to paste the cut buffer into the current list.
  1483. X */
  1484. void paste_selection ()
  1485. {
  1486. X    int datecode, value;
  1487. X    struct category_rec *cr;
  1488. X    struct day_entry *de, *tmpde;
  1489. X    struct entry_list *el;
  1490. X
  1491. X   /*
  1492. X    *  If there is nothing to paste...
  1493. X    */
  1494. X    if (cut_buffer == NULL) {
  1495. X        notice_prompt(tdlist, NULL,
  1496. X                          NOTICE_MESSAGE_STRINGS,
  1497. X                             "There is nothing in the cut buffer.",
  1498. X                          0,
  1499. X                          NOTICE_BUTTON, "Ok", 1,
  1500. X                          0);
  1501. X        return;
  1502. X    }
  1503. X
  1504. X   /*
  1505. X    *  Go through the hassle of a list addition
  1506. X    */
  1507. X    value = xv_get(entry_category, PANEL_VALUE);
  1508. X    for (cr=category_head; cr!=NULL; cr=cr->next) {
  1509. X        if (EQUAL(xv_get(entry_category, PANEL_CHOICE_STRING, value), cr->name)) break;
  1510. X    }
  1511. X    datecode = (curr_year-1990)*10000 + curr_month*100 + curr_day;
  1512. X    el = entry_search(datecode, TRUE, cr);
  1513. X    de = el->last;
  1514. X
  1515. X    tmpde = NEW(struct day_entry);
  1516. X    tmpde->next = NULL;
  1517. X    strcpy(tmpde->text, cut_buffer->text);
  1518. X    tmpde->priority = cut_buffer->priority;
  1519. X    tmpde->checked = cut_buffer->checked;
  1520. X    if (de == NULL) {
  1521. X        el->first = el->last = tmpde;
  1522. X        tmpde->prev = NULL;
  1523. X    } else {
  1524. X        de->next = el->last = tmpde;
  1525. X        tmpde->prev = de;
  1526. X    }
  1527. X
  1528. X    display_list(curr_month, curr_day, curr_year);
  1529. X    refresh_db(FALSE);
  1530. X    set_cursor(basic_cursor);
  1531. }
  1532. X
  1533. /*
  1534. X * **********************************************************************
  1535. X * This routine is called for every selection on the todo list itself.
  1536. X * Based on the settings of the "editing", "copying", or "cutting"
  1537. X * variables, we do various things.
  1538. X */
  1539. void tdl_notify_proc(item, string, de, op, event)
  1540. Panel_item       item;
  1541. char             *string;
  1542. struct day_entry *de;
  1543. Panel_list_op    op;
  1544. Event            *event;
  1545. {
  1546. X    int selected, nrows;
  1547. X
  1548. X    nrows = xv_get(todo, PANEL_LIST_NROWS);
  1549. X    for (selected = 0; selected < nrows; selected ++) 
  1550. X        if (xv_get(todo, PANEL_LIST_SELECTED, selected)) break;
  1551. X    selected_item = selected;
  1552. X    
  1553. X    if (op == PANEL_LIST_OP_SELECT) {
  1554. X        nrows = xv_get(todo, PANEL_LIST_NROWS);
  1555. X        for (selected = 0; selected < nrows; selected ++) 
  1556. X            if (xv_get(todo, PANEL_LIST_SELECTED, selected)) break;
  1557. X        selected_item = selected;
  1558. X        if (editing) {
  1559. X            edit_selection(de);
  1560. X        } else if (copying) {
  1561. X            copy_selection(de);
  1562. X        } else if (cutting) {
  1563. X            cut_selection(de);
  1564. X        } else {
  1565. X            de->checked = ! de->checked;
  1566. X            if (de->checked) {
  1567. X                xv_set(todo, PANEL_LIST_GLYPH, selected_item, checked_on, 0);
  1568. X            } else {
  1569. X                xv_set(todo, PANEL_LIST_GLYPH, selected_item, checks[de->priority], 0);
  1570. X            }
  1571. X            if (log_level == LOG_AT_CHECKED) log_entry(de);
  1572. X        }
  1573. X        changed = TRUE;
  1574. X    }
  1575. X    xv_set(todo, PANEL_LIST_SELECT, selected_item, FALSE, 0);
  1576. }
  1577. X
  1578. /*
  1579. X * **********************************************************************
  1580. X * This is the routine that propagates list items.  Basically, if an 
  1581. X * item exists on a previous day -- either recurring or non-recurring --
  1582. X * and it is not checked off, it is moved to the list for the current
  1583. X * day.  This is done for all categories.
  1584. X */
  1585. void propagate ()
  1586. {
  1587. X    int datecode;
  1588. X    struct entry_list *el, *todayel;
  1589. X    struct category_rec *cr, *actualcr;
  1590. X    struct day_entry *de, *todayde, *tmpde;
  1591. X
  1592. X    datecode = (today.tm_year-90)*10000 + (today.tm_mon+1)*100 + today.tm_mday;
  1593. X    
  1594. X    cr = category_head;
  1595. X    while (cr != NULL) {
  1596. X        entry_head = cr->entry_head;
  1597. X        entry_tail = cr->entry_tail;
  1598. X        todayel = entry_search(datecode, TRUE, cr);
  1599. X
  1600. X      /*** First, for the non-recurring entries ***/
  1601. X        el = cr->entry_head;
  1602. X        for (el = cr->entry_head; el != NULL; el = el->next) {
  1603. X            if (el->day_code < datecode) {
  1604. X                for (de = el->first; de != NULL; de = de->next) {
  1605. X                    if (! de->checked ) {
  1606. X                        tmpde = NEW(struct day_entry);
  1607. X                        tmpde->next = NULL;
  1608. X                        strcpy(tmpde->text, de->text);
  1609. X                        tmpde->priority = de->priority;
  1610. X                        tmpde->checked = FALSE;
  1611. X                        todayde = todayel->last;
  1612. X                        if (todayde == NULL) {
  1613. X                            todayel->first = todayel->last = tmpde;
  1614. X                            tmpde->prev = NULL;
  1615. X                        } else {
  1616. X                            todayde->next = todayel->last = tmpde;
  1617. X                            tmpde->prev = todayde;
  1618. X                        }
  1619. X                    } else {
  1620. X                        if (log_level == LOG_AT_QUIT) log_entry(de);
  1621. X                    }
  1622. X                }
  1623. X                el->first = el->last = NULL;
  1624. X                
  1625. X                /*** Now, for the recurring entries. ***/
  1626. X                for (de = el->rl_first; de != NULL; de = de->next) {
  1627. X                    if (! de->checked ) {
  1628. X                        todayde = todayel->last;
  1629. X                        if (todayde == NULL) {
  1630. X                            todayel->first = todayel->last = de;
  1631. X                            tmpde->prev = NULL;
  1632. X                        } else {
  1633. X                            todayde->next = todayel->last = de;
  1634. X                            tmpde->prev = todayde;
  1635. X                        }
  1636. X                    } else {
  1637. X                        if (log_level == LOG_AT_QUIT) log_entry(de);
  1638. X                    }
  1639. X                }
  1640. X                el->rl_first = el->rl_last = NULL;
  1641. X            }
  1642. X        }
  1643. X        cr = cr->next;
  1644. X    }
  1645. X    changed = TRUE;
  1646. }
  1647. X
  1648. /*
  1649. X * **********************************************************************
  1650. X * This routine writes the structures -- non-recurring and recurring, for
  1651. X * all categories -- to the database file.  Note that this effectively 
  1652. X * wipes out the old contents.
  1653. X */
  1654. void refresh_db (fromquit)
  1655. int fromquit;
  1656. {
  1657. X    int datecode, month, day, year;
  1658. X    struct entry_list *el, *todayel;
  1659. X    struct day_entry *de, *todayde, *tmpde;
  1660. X    struct recurrence_list *rl;
  1661. X    struct category_rec *cr;
  1662. X    FILE *outfd;
  1663. X    char backup[LINESIZ], rlstr[20], tmpstr[20];
  1664. X
  1665. X    /*** Make sure the file is closed...then we can reopen */
  1666. X    fclose(yyin);
  1667. X    sprintf(backup, "%s.BAK", fname);
  1668. X    rename(fname, backup);
  1669. X    outfd = fopen(fname, "w");
  1670. X
  1671. X    cr = category_head;
  1672. X    while (cr != NULL) {
  1673. X        fprintf(outfd, "category: \"%s\"\n", cr->name);
  1674. X
  1675. X        /*** Non-recurring entries ***/
  1676. X        el = cr->entry_head;
  1677. X        for (el = cr->entry_head; el != NULL; el = el->next) {
  1678. X            for (de = el->first; de != NULL; de = de->next) {
  1679. X                if (! de->checked ) {
  1680. X                    year = (int)(el->day_code / 10000);
  1681. X                    month = (int)((el->day_code - year*10000) / 100);
  1682. X                    day = el->day_code % 100;
  1683. X                    
  1684. X                    fprintf(outfd, "%2d/%2d/%2d:%d:\"%s\"\n", month, day, year+90,
  1685. X                              de->priority, de->text);
  1686. X                } else {
  1687. X                    if (fromquit) log_entry(de);
  1688. X                }
  1689. X            }
  1690. X        }
  1691. X
  1692. X        /*** Recurring Entries ***/
  1693. X        for (rl = cr->rl_head; rl != NULL; rl = rl->next) {
  1694. X            year = (int)(rl->starting_day_code / 10000);
  1695. X            month = (int)((rl->starting_day_code - year*10000) / 100);
  1696. X            day = rl->starting_day_code % 100;
  1697. X            
  1698. X            rlstr[0] = '\0';
  1699. X            if (rl->daily) strcat(rlstr, "d");
  1700. X            if (rl->weekly) strcat(rlstr, "w");
  1701. X            if (rl->biweekly) strcat(rlstr, "b");
  1702. X            if (rl->monthly) strcat(rlstr, "m");
  1703. X            if (rl->yearly) strcat(rlstr, "y");
  1704. X            if (rl->mwf) strcat(rlstr, "M");
  1705. X            if (rl->tt) strcat(rlstr, "T");
  1706. X            if (rl->dow != -1) {
  1707. X                sprintf(tmpstr, "D%1d", rl->dow);
  1708. X                strcat(rlstr, tmpstr);
  1709. X            }
  1710. X            if (rl->week_number != 0) {
  1711. X                sprintf(tmpstr, "N%1d", rl->week_number);
  1712. X                strcat(rlstr, tmpstr);
  1713. X            }
  1714. X            if (rl-> number_of_weeks != 0) {
  1715. X                sprintf(tmpstr, "W%1d", rl->number_of_weeks);
  1716. X                strcat(rlstr, tmpstr);
  1717. X            }
  1718. X            
  1719. X            fprintf(outfd, "%2d/%2d/%2d|%s:%d:\"%s\"\n", month, day, year+90,
  1720. X                      rlstr, rl->priority, rl->text);
  1721. X        }
  1722. X        cr = cr->next;
  1723. X    }
  1724. X    fclose(outfd);
  1725. }
  1726. SHAR_EOF
  1727. chmod 0644 list.c ||
  1728. echo 'restore of list.c failed'
  1729. Wc_c="`wc -c < 'list.c'`"
  1730. test 24576 -eq "$Wc_c" ||
  1731.     echo 'list.c: original size 24576, current size' "$Wc_c"
  1732. rm -f _shar_wnt_.tmp
  1733. fi
  1734. # ============= prolog1.ps ==============
  1735. if test -f 'prolog1.ps' -a X"$1" != X"-c"; then
  1736.     echo 'x - skipping prolog1.ps (File already exists)'
  1737.     rm -f _shar_wnt_.tmp
  1738. else
  1739. > _shar_wnt_.tmp
  1740. echo 'x - extracting prolog1.ps (Text)'
  1741. sed 's/^X//' << 'SHAR_EOF' > 'prolog1.ps' &&
  1742. %!
  1743. %%BoundingBox: (atend)
  1744. %%Pages: (atend)
  1745. %%DocumentFonts: (atend)
  1746. %%EndComments
  1747. %
  1748. % FrameMaker PostScript Prolog 2.0, for use with FrameMaker 2.0
  1749. % Copyright (c) 1986,87,89 by Frame Technology, Inc.  All rights reserved.
  1750. %
  1751. % Known Problems:
  1752. %    Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1
  1753. /FMversion (2.0) def 
  1754. % Set up Color vs. Black-and-White
  1755. X    /FMPrintInColor systemdict /colorimage known def
  1756. % Uncomment this line to force b&w on color printer
  1757. %   /FMPrintInColor false def
  1758. /FrameDict 190 dict def 
  1759. systemdict /errordict known not {/errordict 10 dict def
  1760. X        errordict /rangecheck {stop} put} if
  1761. % The readline in 23.0 doesn't recognize cr's as nl's on AppleTalk
  1762. FrameDict /tmprangecheck errordict /rangecheck get put 
  1763. errordict /rangecheck {FrameDict /bug true put} put 
  1764. FrameDict /bug false put 
  1765. mark 
  1766. % Some PS machines read past the CR, so keep the following 3 lines together!
  1767. currentfile 5 string readline
  1768. 00
  1769. 0000000000
  1770. cleartomark 
  1771. errordict /rangecheck FrameDict /tmprangecheck get put 
  1772. FrameDict /bug get { 
  1773. X    /readline {
  1774. X        /gstring exch def
  1775. X        /gfile exch def
  1776. X        /gindex 0 def
  1777. X        {
  1778. X            gfile read pop 
  1779. X            dup 10 eq {exit} if 
  1780. X            dup 13 eq {exit} if 
  1781. X            gstring exch gindex exch put 
  1782. X            /gindex gindex 1 add def 
  1783. X        } loop
  1784. X        pop 
  1785. X        gstring 0 gindex getinterval true 
  1786. X        } def
  1787. X    } if
  1788. /FMVERSION {
  1789. X    FMversion ne {
  1790. X        /Times-Roman findfont 18 scalefont setfont
  1791. X        100 100 moveto
  1792. X        (FrameMaker version does not match postscript_prolog!)
  1793. X        dup =
  1794. X        show showpage
  1795. X        } if
  1796. X    } def 
  1797. /FMLOCAL {
  1798. X    FrameDict begin
  1799. X    0 def 
  1800. X    end 
  1801. X    } def 
  1802. X    /gstring FMLOCAL
  1803. X    /gfile FMLOCAL
  1804. X    /gindex FMLOCAL
  1805. X    /orgxfer FMLOCAL
  1806. X    /orgproc FMLOCAL
  1807. X    /organgle FMLOCAL
  1808. X    /orgfreq FMLOCAL
  1809. X    /yscale FMLOCAL
  1810. X    /xscale FMLOCAL
  1811. X    /manualfeed FMLOCAL
  1812. X    /paperheight FMLOCAL
  1813. X    /paperwidth FMLOCAL
  1814. /FMDOCUMENT { 
  1815. X    array /FMfonts exch def 
  1816. X    /#copies exch def
  1817. X    FrameDict begin
  1818. SHAR_EOF
  1819. true || echo 'restore of prolog1.ps failed'
  1820. fi
  1821. echo 'End of  part 5'
  1822. echo 'File prolog1.ps is continued in part 6'
  1823. echo 6 > _shar_seq_.tmp
  1824. exit 0
  1825. -- 
  1826. Senior Systems Scientist        mail: dcmartin@msi.com
  1827. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1828. 796 North Pastoria Avenue        at&t: 408/522-9236
  1829. Sunnyvale, California 94086        fax: 408/732-0831
  1830.