home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sources / x / 433 < prev    next >
Encoding:
Text File  |  1992-07-29  |  50.2 KB  |  1,795 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: v18i064: XVTDL 3.0, Part03/06
  5. Message-ID: <1992Jul29.175045.14949@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:45 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1781
  13.  
  14. Submitted-by: jipping@cs.hope.edu (Mike Jipping)
  15. Posting-number: Volume 18, Issue 64
  16. Archive-name: xvtdl-3.0/part03
  17.  
  18. #!/bin/sh
  19. # this is part.03 (part 3 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file main.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" != 3; 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 main.c'
  37. else
  38. echo 'x - continuing file main.c'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'main.c' &&
  40. X *
  41. X * Revision 2.4  1992/07/16  13:31:18  jipping
  42. X * Implemented two resource values: default_printer and postscriptmode.
  43. X *
  44. X * Revision 2.3  1992/07/14  12:31:38  jipping
  45. X * Added more flexible version notation (using version.h).
  46. X *
  47. X * Revision 2.2  1992/07/13  15:52:57  jipping
  48. X * Changed version number.
  49. X * Hardcoded initial main window creation size.
  50. X *
  51. X * Revision 2.1  1992/07/13  15:15:19  jipping
  52. X * Cleaned up code to avoid compilation warnings.
  53. X *
  54. X * Revision 2.0  1992/07/10  17:31:08  jipping
  55. X * Initial release
  56. X *
  57. X *
  58. X *
  59. X * **********************************************************************
  60. X */
  61. X
  62. #include "globaldefs.h"
  63. #include "patchlevel.h"
  64. X
  65. extern FILE *yyin;
  66. extern Notify_value midnight(), hourly();
  67. extern Notify_value my_destroy_func();
  68. X
  69. int debug=FALSE, verbose=FALSE, changed=FALSE;
  70. X
  71. Frame tdlist;
  72. Canvas calendar;
  73. X
  74. struct tm current, *tm, today, *localtime();
  75. int curr_month, curr_day, curr_year;
  76. char fname[FILENAMESIZ];
  77. X
  78. /*
  79. X * This routine parses the command line, looking for options.  The only
  80. X * options possible are
  81. X *
  82. X *   -d        -> turns on debugging output
  83. X *   -f file   -> use "file" as the todo database instead of
  84. X *                $HOME/.tododb
  85. X */
  86. X
  87. void parse_command_line (argc, argv)
  88. int argc;
  89. char **argv;
  90. {
  91. X   int argind;
  92. X   char *tcp;
  93. X
  94. X   argind = 1;
  95. X   while (argind < argc)
  96. X   {   
  97. X      tcp = argv[argind];
  98. X      if (*tcp == '-') {
  99. X         tcp++;
  100. X         switch(*tcp){
  101. X            case 'd':   /* d selects Debug output */
  102. X                debug = TRUE;
  103. X                verbose = TRUE;
  104. X                break;
  105. X            
  106. X            case 'f':
  107. X                argind++;
  108. X                tcp = argv[argind];
  109. X                strcpy(fname, tcp);
  110. X                freopen(tcp, "r", yyin);
  111. X                break;
  112. X
  113. X            default:
  114. X                printf("%c is not a legal flag\n", *tcp);
  115. X         }
  116. X      } else {
  117. X         printf("Bad argument: %s\n", tcp);
  118. X      }
  119. X      argind++;
  120. X    }
  121. }
  122. X
  123. X
  124. /*
  125. X * The main program.
  126. X */
  127. X
  128. void main (argc, argv)
  129. int argc;
  130. char **argv;
  131. {
  132. X   struct timeval tv;
  133. X   struct itimerval timer;
  134. X   char timstr[16], title[20];
  135. X   long till_midnight;
  136. X
  137. X   /* init XView */
  138. X   xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
  139. X
  140. X   /* set up initial parameters, the parse the command line */
  141. X   strcpy(fname, getenv("HOME"));
  142. X   strcat(fname, "/.tododb");
  143. X   yyin = fopen(fname, "r");
  144. X   parse_command_line(argc, argv);
  145. X
  146. X    /* Process any X resources that we have */
  147. X    load_xdefaults();
  148. X
  149. X   /* set up date-oriented variables */
  150. X   gettimeofday(&tv, 0);
  151. X   tm = localtime(&tv.tv_sec);
  152. X   today = *tm;
  153. X   curr_month = today.tm_mon+1;
  154. X   curr_day = today.tm_mday;
  155. X   curr_year = today.tm_year+1900;
  156. X
  157. X   /* create the windows */
  158. X    sprintf(title, "To Do List %d.%d", VERSION, PATCHLEVEL);
  159. X   tdlist = xv_create(NULL, FRAME,
  160. X                      FRAME_LABEL, title,
  161. X                             XV_WIDTH, 435,
  162. X                             XV_HEIGHT, 480,
  163. X                      0);
  164. X   create_windows();
  165. X
  166. X   /* parse the todo database and set up the "current" list */
  167. X   if (yyin != NULL) {
  168. X        yyparse();
  169. X        propagate();
  170. X    }
  171. X    if (category_head == NULL)
  172. X        category_head = (struct category_rec *)new_category("Every Day");
  173. X
  174. X   xv_set(categories,
  175. X          PANEL_CLIENT_DATA, category_head,
  176. X          PANEL_VALUE, 0,
  177. X          0);
  178. X
  179. X    entry_head = category_head->entry_head;
  180. X    entry_tail = category_head->entry_tail;
  181. X    rl_head = category_head->rl_head;
  182. X    rl_tail = category_head->rl_tail;
  183. X    display_list(curr_month, curr_day, curr_year);
  184. X
  185. X   /* set up the timer alarms to go off every hour */
  186. X   timer.it_value.tv_sec = 3600;
  187. X   timer.it_interval.tv_sec = 3600;
  188. X   timer.it_value.tv_usec = 0;
  189. X   timer.it_interval.tv_usec = 0;
  190. X   notify_set_itimer_func(tdlist, hourly, ITIMER_REAL, &timer, NULL);
  191. X
  192. X    /* catch window quits... */
  193. X    notify_interpose_destroy_func(tdlist, my_destroy_func);
  194. X
  195. X
  196. X   /* sit back and watch the show */
  197. X   xv_main_loop(tdlist);
  198. }
  199. SHAR_EOF
  200. echo 'File main.c is complete' &&
  201. chmod 0644 main.c ||
  202. echo 'restore of main.c failed'
  203. Wc_c="`wc -c < 'main.c'`"
  204. test 5037 -eq "$Wc_c" ||
  205.     echo 'main.c: original size 5037, current size' "$Wc_c"
  206. rm -f _shar_wnt_.tmp
  207. fi
  208. # ============= print_ui.c ==============
  209. if test -f 'print_ui.c' -a X"$1" != X"-c"; then
  210.     echo 'x - skipping print_ui.c (File already exists)'
  211.     rm -f _shar_wnt_.tmp
  212. else
  213. > _shar_wnt_.tmp
  214. echo 'x - extracting print_ui.c (Text)'
  215. sed 's/^X//' << 'SHAR_EOF' > 'print_ui.c' &&
  216. /*
  217. X * print_ui.c - User interface object initialization functions.
  218. X * This file was generated by `gxv' from `print.G'.
  219. X * DO NOT EDIT BY HAND.
  220. X */
  221. X
  222. #include <stdio.h>
  223. #include <sys/param.h>
  224. #include <sys/types.h>
  225. #include <xview/xview.h>
  226. #include <xview/canvas.h>
  227. #include <xview/panel.h>
  228. #include <xview/scrollbar.h>
  229. #include <xview/svrimage.h>
  230. #include <xview/termsw.h>
  231. #include <xview/text.h>
  232. #include <xview/tty.h>
  233. #include <xview/xv_xrect.h>
  234. #include "print_ui.h"
  235. X
  236. /*
  237. X * Initialize an instance of object `print_base'.
  238. X */
  239. print_print_base_objects *
  240. print_print_base_objects_initialize(ip, owner)
  241. X    print_print_base_objects    *ip;
  242. X    Xv_opaque    owner;
  243. {
  244. X    if (!ip && !(ip = (print_print_base_objects *) calloc(1, sizeof (print_print_base_objects))))
  245. X        return (print_print_base_objects *) NULL;
  246. X    if (!ip->print_base)
  247. X        ip->print_base = print_print_base_print_base_create(ip, owner);
  248. X    if (!ip->controls1)
  249. X        ip->controls1 = print_print_base_controls1_create(ip, ip->print_base);
  250. X    if (!ip->postscript)
  251. X        ip->postscript = print_print_base_postscript_create(ip, ip->controls1);
  252. X    if (!ip->printer)
  253. X        ip->printer = print_print_base_printer_create(ip, ip->controls1);
  254. X    if (!ip->scale)
  255. X        ip->scale = print_print_base_scale_create(ip, ip->controls1);
  256. X    if (!ip->categories)
  257. X        ip->categories = print_print_base_categories_create(ip, ip->controls1);
  258. X    if (!ip->incl_checked_items)
  259. X        ip->incl_checked_items = print_print_base_incl_checked_items_create(ip, ip->controls1);
  260. X    if (!ip->cancel_print)
  261. X        ip->cancel_print = print_print_base_cancel_print_create(ip, ip->controls1);
  262. X    if (!ip->exec_print)
  263. X        ip->exec_print = print_print_base_exec_print_create(ip, ip->controls1);
  264. X    return ip;
  265. }
  266. X
  267. /*
  268. X * Create object `print_base' in the specified instance.
  269. X */
  270. XXv_opaque
  271. print_print_base_print_base_create(ip, owner)
  272. X    print_print_base_objects    *ip;
  273. X    Xv_opaque    owner;
  274. {
  275. X    Xv_opaque    obj;
  276. X    
  277. X    obj = xv_create(owner, FRAME_CMD,
  278. X        XV_KEY_DATA, INSTANCE, ip,
  279. X        XV_WIDTH, 424,
  280. X        XV_HEIGHT, 127,
  281. X        XV_LABEL, "Print To Do List",
  282. X        FRAME_SHOW_FOOTER, FALSE,
  283. X        FRAME_SHOW_RESIZE_CORNER, TRUE,
  284. X        FRAME_CMD_PUSHPIN_IN, FALSE,
  285. X        NULL);
  286. X    xv_set(xv_get(obj, FRAME_CMD_PANEL), WIN_SHOW, FALSE, NULL);
  287. X    return obj;
  288. }
  289. X
  290. /*
  291. X * Create object `controls1' in the specified instance.
  292. X */
  293. XXv_opaque
  294. print_print_base_controls1_create(ip, owner)
  295. X    print_print_base_objects    *ip;
  296. X    Xv_opaque    owner;
  297. {
  298. X    Xv_opaque    obj;
  299. X    
  300. X    obj = xv_create(owner, PANEL,
  301. X        XV_KEY_DATA, INSTANCE, ip,
  302. X        XV_X, 0,
  303. X        XV_Y, 0,
  304. X        XV_WIDTH, WIN_EXTEND_TO_EDGE,
  305. X        XV_HEIGHT, WIN_EXTEND_TO_EDGE,
  306. X        WIN_BORDER, FALSE,
  307. X        NULL);
  308. X    return obj;
  309. }
  310. X
  311. /*
  312. X * Create object `postscript' in the specified instance.
  313. X */
  314. XXv_opaque
  315. print_print_base_postscript_create(ip, owner)
  316. X    print_print_base_objects    *ip;
  317. X    Xv_opaque    owner;
  318. {
  319. X    extern void        change_printer_type();
  320. X    Xv_opaque    obj;
  321. X    
  322. X    obj = xv_create(owner, PANEL_CHOICE,
  323. X        XV_KEY_DATA, INSTANCE, ip,
  324. X        XV_X, 234,
  325. X        XV_Y, 8,
  326. X        PANEL_CHOICE_NROWS, 1,
  327. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  328. X        PANEL_CHOOSE_NONE, FALSE,
  329. X        PANEL_NOTIFY_PROC, change_printer_type,
  330. X        PANEL_CHOICE_STRINGS,
  331. X            "Normal",
  332. X            "Postscript",
  333. X            NULL,
  334. X        NULL);
  335. X    return obj;
  336. }
  337. X
  338. /*
  339. X * Create object `printer' in the specified instance.
  340. X */
  341. XXv_opaque
  342. print_print_base_printer_create(ip, owner)
  343. X    print_print_base_objects    *ip;
  344. X    Xv_opaque    owner;
  345. {
  346. X    Xv_opaque    obj;
  347. X    
  348. X    obj = xv_create(owner, PANEL_TEXT,
  349. X        XV_KEY_DATA, INSTANCE, ip,
  350. X        XV_X, 24,
  351. X        XV_Y, 15,
  352. X        PANEL_VALUE_DISPLAY_LENGTH, 8,
  353. X        PANEL_VALUE_STORED_LENGTH, 80,
  354. X        PANEL_LABEL_STRING, "Printer:",
  355. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  356. X        PANEL_READ_ONLY, FALSE,
  357. X        NULL);
  358. X    return obj;
  359. }
  360. X
  361. /*
  362. X * Create object `scale' in the specified instance.
  363. X */
  364. XXv_opaque
  365. print_print_base_scale_create(ip, owner)
  366. X    print_print_base_objects    *ip;
  367. X    Xv_opaque    owner;
  368. {
  369. X    Xv_opaque    obj;
  370. X    
  371. X    obj = xv_create(owner, PANEL_NUMERIC_TEXT,
  372. X        XV_KEY_DATA, INSTANCE, ip,
  373. X        XV_X, 24,
  374. X        XV_Y, 40,
  375. X        PANEL_VALUE_DISPLAY_LENGTH, 5,
  376. X        PANEL_VALUE_STORED_LENGTH, 5,
  377. X        PANEL_LABEL_STRING, "Scaling Factor:",
  378. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  379. X        PANEL_MAX_VALUE, 1000,
  380. X        PANEL_MIN_VALUE, 0,
  381. X        PANEL_VALUE, 0,
  382. X        PANEL_READ_ONLY, FALSE,
  383. X        NULL);
  384. X    return obj;
  385. }
  386. X
  387. /*
  388. X * Create object `categories' in the specified instance.
  389. X */
  390. XXv_opaque
  391. print_print_base_categories_create(ip, owner)
  392. X    print_print_base_objects    *ip;
  393. X    Xv_opaque    owner;
  394. {
  395. X    Xv_opaque    obj;
  396. X    
  397. X    obj = xv_create(owner, PANEL_CHOICE,
  398. X        XV_KEY_DATA, INSTANCE, ip,
  399. X        XV_X, 231,
  400. X        XV_Y, 40,
  401. X        PANEL_CHOICE_NROWS, 1,
  402. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  403. X        PANEL_CHOOSE_NONE, FALSE,
  404. X        PANEL_LABEL_STRING, "Categories:",
  405. X        PANEL_CHOICE_STRINGS,
  406. X            "Current",
  407. X            "All",
  408. X            NULL,
  409. X        NULL);
  410. X    return obj;
  411. }
  412. X
  413. /*
  414. X * Create object `incl_checked_items' in the specified instance.
  415. X */
  416. XXv_opaque
  417. print_print_base_incl_checked_items_create(ip, owner)
  418. X    print_print_base_objects    *ip;
  419. X    Xv_opaque    owner;
  420. {
  421. X    extern void        change_checked();
  422. X    Xv_opaque    obj;
  423. X    
  424. X    obj = xv_create(owner, PANEL_TOGGLE, PANEL_FEEDBACK, PANEL_MARKED,
  425. X        XV_KEY_DATA, INSTANCE, ip,
  426. X        XV_X, 24,
  427. X        XV_Y, 65,
  428. X        PANEL_CHOICE_NROWS, 1,
  429. X        PANEL_LAYOUT, PANEL_HORIZONTAL,
  430. X        PANEL_LABEL_STRING, "Include Checked Items?",
  431. X        PANEL_NOTIFY_PROC, change_checked,
  432. X        PANEL_CHOICE_STRINGS,
  433. X            "Include",
  434. X            "Do Not Include",
  435. X            NULL,
  436. X        PANEL_VALUE, 0,
  437. X        NULL);
  438. X    return obj;
  439. }
  440. X
  441. /*
  442. X * Create object `cancel_print' in the specified instance.
  443. X */
  444. XXv_opaque
  445. print_print_base_cancel_print_create(ip, owner)
  446. X    print_print_base_objects    *ip;
  447. X    Xv_opaque    owner;
  448. {
  449. X    extern void        print_cancel();
  450. X    Xv_opaque    obj;
  451. X    
  452. X    obj = xv_create(owner, PANEL_BUTTON,
  453. X        XV_KEY_DATA, INSTANCE, ip,
  454. X        XV_X, 130,
  455. X        XV_Y, 99,
  456. X        PANEL_LABEL_STRING, "Cancel",
  457. X        PANEL_NOTIFY_PROC, print_cancel,
  458. X        NULL);
  459. X    return obj;
  460. }
  461. X
  462. /*
  463. X * Create object `exec_print' in the specified instance.
  464. X */
  465. XXv_opaque
  466. print_print_base_exec_print_create(ip, owner)
  467. X    print_print_base_objects    *ip;
  468. X    Xv_opaque    owner;
  469. {
  470. X    extern void        print_list();
  471. X    Xv_opaque    obj;
  472. X    
  473. X    obj = xv_create(owner, PANEL_BUTTON,
  474. X        XV_KEY_DATA, INSTANCE, ip,
  475. X        XV_X, 249,
  476. X        XV_Y, 99,
  477. X        PANEL_LABEL_STRING, "Print",
  478. X        PANEL_NOTIFY_PROC, print_list,
  479. X        NULL);
  480. X    return obj;
  481. }
  482. X
  483. SHAR_EOF
  484. chmod 0644 print_ui.c ||
  485. echo 'restore of print_ui.c failed'
  486. Wc_c="`wc -c < 'print_ui.c'`"
  487. test 5974 -eq "$Wc_c" ||
  488.     echo 'print_ui.c: original size 5974, current size' "$Wc_c"
  489. rm -f _shar_wnt_.tmp
  490. fi
  491. # ============= properties.c ==============
  492. if test -f 'properties.c' -a X"$1" != X"-c"; then
  493.     echo 'x - skipping properties.c (File already exists)'
  494.     rm -f _shar_wnt_.tmp
  495. else
  496. > _shar_wnt_.tmp
  497. echo 'x - extracting properties.c (Text)'
  498. sed 's/^X//' << 'SHAR_EOF' > 'properties.c' &&
  499. /*
  500. X * $Id: properties.c,v 1.1 1992/07/27 18:43:12 jipping Exp $
  501. X * **********************************************************************
  502. X *
  503. X *  Properties.c ==> Routines that implement the properties window.
  504. X *
  505. X * ----------------------------------------------------------------------
  506. X * Copyright (c) 1992 by Mike Jipping and Hope College
  507. X *
  508. X * Permission is granted to copy and distribute this file in modified or
  509. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  510. X * is preserved, (b) no attempt is made to restrict redistribution of this
  511. X * file, and (c) this file is not distributed as part of any collection whose
  512. X * redistribution is restricted by a compilation copyright.
  513. X * ----------------------------------------------------------------------
  514. X *
  515. X * Revision History:
  516. X * $Log: properties.c,v $
  517. X * Revision 1.1  1992/07/27  18:43:12  jipping
  518. X * Initial revision
  519. X *
  520. X */
  521. X
  522. #include "globaldefs.h"
  523. X
  524. props_props_frame_objects    *props_props_frame;
  525. X
  526. /*
  527. X * **********************************************************************
  528. X * Initialize the print window...by calling the routine set up by GUIDE.
  529. X */
  530. void initialize_props ()
  531. {
  532. X    props_props_frame = props_props_frame_objects_initialize(NULL, tdlist);
  533. }
  534. X
  535. /*
  536. X * **********************************************************************
  537. X * This routine sets the items that control the property settings --
  538. X * based on the settings of the global property variables.
  539. X */
  540. void set_global_props()
  541. {
  542. X    if (logging == 0) {
  543. X        log_level = LOG_NEVER;
  544. X        xv_set(props_props_frame->log_preference, PANEL_VALUE, LOG_NEVER, 0);
  545. X        xv_set(props_props_frame->log_info, PANEL_INACTIVE, TRUE, 0);
  546. X        xv_set(props_props_frame->log_filename, PANEL_INACTIVE, TRUE, 0);
  547. X    } else {
  548. X        if (EQUAL(log_preference, "atquit")) {
  549. X            log_level = LOG_AT_QUIT;
  550. X            xv_set(props_props_frame->log_preference, PANEL_VALUE, LOG_AT_QUIT, 0);
  551. X           xv_set(props_props_frame->log_info, PANEL_INACTIVE, TRUE, 0);
  552. X            xv_set(props_props_frame->log_filename, PANEL_INACTIVE, FALSE, 0);
  553. X        } else {
  554. X            log_level = LOG_AT_CHECKED;
  555. X            xv_set(props_props_frame->log_preference, PANEL_VALUE, LOG_AT_CHECKED, 0);
  556. X           xv_set(props_props_frame->log_info,
  557. X                     PANEL_INACTIVE, FALSE,
  558. X                     PANEL_VALUE,    log_info_level,
  559. X                     0);
  560. X            xv_set(props_props_frame->log_filename, PANEL_INACTIVE, FALSE, 0);
  561. X        }
  562. X    }
  563. X    xv_set(props_props_frame->log_filename, PANEL_VALUE, log_file, 0);
  564. X
  565. X    if (EQUAL(priority_listing, "ascending")) {
  566. X        xv_set(props_props_frame->priority_direction, PANEL_VALUE, 0, 0);
  567. X    } else {
  568. X        xv_set(props_props_frame->priority_direction, PANEL_VALUE, 1, 0);
  569. X    }
  570. X    xv_set(props_props_frame->def_printer, PANEL_VALUE, default_printer, 0);
  571. X    xv_set(props_props_frame->def_print_mode, PANEL_VALUE, postscriptmode, 0);
  572. }
  573. X
  574. /*
  575. X * **********************************************************************
  576. X * Callback routine for the property settings menu item.  Opens the
  577. X * properties window.
  578. X */
  579. X
  580. Menu_item open_properties(item, op)
  581. Menu_item    item;
  582. Menu_generate    op;
  583. {
  584. X    set_global_props();
  585. X    xv_set(props_props_frame->props_frame,
  586. X             XV_SHOW, TRUE,
  587. X             0);
  588. X    return(item);
  589. }
  590. X
  591. /*
  592. X * **********************************************************************
  593. X * Callback routine for the "Log Preference:" item.  Activates or
  594. X * deactivates items on the properties window.
  595. X */
  596. void set_log_preference(item, value, event)
  597. Panel_item    item;
  598. int        value;
  599. Event        *event;
  600. {
  601. X    props_props_frame_objects *ip =
  602. X        (props_props_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  603. X
  604. X    switch (value) {
  605. X       case LOG_AT_CHECKED:
  606. X           xv_set(ip->log_info, PANEL_INACTIVE, FALSE, 0);
  607. X            xv_set(ip->log_filename, PANEL_INACTIVE, FALSE, 0);
  608. X            break;
  609. X            
  610. X       case LOG_AT_QUIT:
  611. X           xv_set(ip->log_info, PANEL_INACTIVE, TRUE, 0);
  612. X            xv_set(ip->log_filename, PANEL_INACTIVE, FALSE, 0);
  613. X            break;
  614. X            
  615. X       case LOG_NEVER:
  616. X           xv_set(ip->log_info, PANEL_INACTIVE, TRUE, 0);
  617. X            xv_set(ip->log_filename, PANEL_INACTIVE, TRUE, 0);
  618. X            break;
  619. X    }
  620. X
  621. }
  622. X
  623. /*
  624. X * **********************************************************************
  625. X * This routine sets the values of the global variables that control
  626. X * the properties to the xvtdl program.  It does so by examining the
  627. X * values of the window items.
  628. X */
  629. void apply_props(ip)
  630. props_props_frame_objects *ip;
  631. {
  632. X    log_level = xv_get(ip->log_preference, PANEL_VALUE);
  633. X    logging = ! (log_level == LOG_NEVER);
  634. X    if (logging) {
  635. X        if (log_level == 0) {
  636. X            strcpy(log_preference, "atchecked");
  637. X        } else {
  638. X            strcpy(log_preference, "atquit");
  639. X        }
  640. X    }
  641. X    log_info_level = xv_get(ip->log_info, PANEL_VALUE);
  642. X    if (log_info_level == LOG_TIMESTAMP) {
  643. X        strcpy(log_info_pref, "timestamp");
  644. X    } else {
  645. X        strcpy(log_info_pref, "userspec");
  646. X    }
  647. X    strcpy(log_file, xv_get(ip->log_filename, PANEL_VALUE));
  648. X    if (xv_get(ip->priority_direction, PANEL_VALUE) == 0) {
  649. X
  650. X        strcpy(priority_listing, "ascending");
  651. X    } else {
  652. X        strcpy(priority_listing, "descending");
  653. X    }
  654. X    strcpy(default_printer, xv_get(ip->def_printer, PANEL_VALUE));
  655. X    xv_set(print_print_base->printer, PANEL_VALUE, default_printer, 0);
  656. X    postscriptmode = xv_get(ip->def_print_mode, PANEL_VALUE);
  657. X    xv_set(print_print_base->postscript, PANEL_VALUE, 1, 0);
  658. X    if (postscriptmode) {
  659. X        xv_set(print_print_base->scale, PANEL_INACTIVE, FALSE, 0);
  660. X    }
  661. X
  662. X    set_xdefaults();
  663. }
  664. X
  665. /*
  666. X * **********************************************************************
  667. X * Callback routine for the "Reset" button on the properties window.
  668. X */
  669. void reset_props(item, event)
  670. Panel_item item; 
  671. Event      *event;
  672. {
  673. X    load_xdefaults();
  674. X    set_global_props();
  675. }
  676. X
  677. /*
  678. X * **********************************************************************
  679. X * Callback routine for the Done button on the properties window.
  680. X */
  681. void close_props(item, event)
  682. Panel_item item; 
  683. Event      *event;
  684. {
  685. X    props_props_frame_objects *ip =
  686. X        (props_props_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  687. X
  688. X    apply_props(ip);
  689. X    save_xdefaults();
  690. X
  691. X    xv_set(ip->props_frame,
  692. X             XV_SHOW, FALSE,
  693. X             0);
  694. }
  695. SHAR_EOF
  696. chmod 0644 properties.c ||
  697. echo 'restore of properties.c failed'
  698. Wc_c="`wc -c < 'properties.c'`"
  699. test 5889 -eq "$Wc_c" ||
  700.     echo 'properties.c: original size 5889, current size' "$Wc_c"
  701. rm -f _shar_wnt_.tmp
  702. fi
  703. # ============= todo.y ==============
  704. if test -f 'todo.y' -a X"$1" != X"-c"; then
  705.     echo 'x - skipping todo.y (File already exists)'
  706.     rm -f _shar_wnt_.tmp
  707. else
  708. > _shar_wnt_.tmp
  709. echo 'x - extracting todo.y (Text)'
  710. sed 's/^X//' << 'SHAR_EOF' > 'todo.y' &&
  711. %token NUMBER STRING COMMENT SLASH COLON BAR
  712. %token BIGD BIGN BIGW BIGM BIGT
  713. %token LITTLED LITTLEW LITTLEB LITTLEM LITTLEY
  714. %token CATEGORY
  715. X
  716. %start todo_list
  717. X
  718. %{ 
  719. /*
  720. X * $Id: todo.y,v 2.1 1992/07/13 14:36:58 jipping Exp $
  721. X * **********************************************************************
  722. X *
  723. X * Todo.y ==> YACC description of the ASCII todo database format.  
  724. X *
  725. X * ----------------------------------------------------------------------
  726. X * Copyright (c) 1992 by Mike Jipping and Hope College
  727. X *
  728. X * Permission is granted to copy and distribute this file in modified or
  729. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  730. X * is preserved, (b) no attempt is made to restrict redistribution of this
  731. X * file, and (c) this file is not distributed as part of any collection whose
  732. X * redistribution is restricted by a compilation copyright.
  733. X * ----------------------------------------------------------------------
  734. X *
  735. X * Revision History:
  736. X *
  737. X * $Log: todo.y,v $
  738. X * Revision 2.1  1992/07/13  14:36:58  jipping
  739. X * Cleaned up code to avoid compilation warnings.
  740. X *
  741. X * Revision 2.0  1992/07/06  13:34:47  jipping
  742. X * Initial release.
  743. X *
  744. X *
  745. X */
  746. X
  747. #include "globaldefs.h"
  748. X
  749. extern struct entry_list *entry_search();
  750. X
  751. int number_value;
  752. char string_value[80];
  753. int inquotes;
  754. int datecode;
  755. struct day_entry *de, *tmpde;
  756. struct entry_list *el;
  757. struct recurrence_list *tmprl;
  758. struct category_rec *cr, *tmpcr;
  759. X
  760. %}
  761. X
  762. %%
  763. X
  764. todo_list : /* empty */
  765. X           | todo_entry todo_list
  766. X           | category todo_list
  767. X           ;
  768. X
  769. todo_entry : date_part {
  770. X                 el = entry_search(datecode, TRUE, NULL);
  771. X                     de = el->last;
  772. X                     tmprl = NULL;
  773. X              }
  774. X             recurring_part
  775. X              priority_part
  776. X              text_part {
  777. X                     if (tmprl == NULL) {
  778. X                         tmpde = NEW(struct day_entry);
  779. X                         tmpde->recurring_entry = FALSE;
  780. X                         tmpde->next = NULL;
  781. X                         string_value[0] = '\0';
  782. X                         sscanf(yytext, "\"%[^\"]\"", string_value);
  783. X                         strcpy(tmpde->text, string_value);
  784. X                         tmpde->priority = number_value;
  785. X                         tmpde->checked = FALSE;
  786. X                         if (de == NULL) {
  787. X                             el->first = el->last = tmpde;
  788. X                             tmpde->prev = NULL;
  789. X                         } else {
  790. X                             de->next = el->last = tmpde;
  791. X                             tmpde->prev = de;
  792. X                         }
  793. X                     } else {
  794. X                         sscanf(yytext, "\"%[^\"]\"", string_value);
  795. X                         strcpy(rl_tail->text, string_value);
  796. X                         rl_tail->priority = number_value;
  797. X                     }
  798. X                 }
  799. X                 ;
  800. X
  801. date_part : NUMBER {datecode = number_value;}
  802. X            SLASH NUMBER {datecode = datecode * 100 + number_value;}
  803. X            SLASH NUMBER {datecode = (number_value - 90) * 10000 + datecode;}
  804. X          ;
  805. X
  806. recurring_part :
  807. X                | BAR {
  808. X                        tmprl = NEW(struct recurrence_list);
  809. X                        if (rl_head == NULL) {
  810. X                            cr->rl_head = rl_head = cr->rl_tail = rl_tail = tmprl;
  811. X                        } else {
  812. X                            cr->rl_tail->next = rl_tail->next = tmprl;
  813. X                            cr->rl_tail = rl_tail = tmprl;
  814. X                        }
  815. X                        tmprl->starting_day_code = datecode;
  816. X                        tmprl->daily = tmprl->weekly = tmprl->biweekly = tmprl->monthly = tmprl->yearly = FALSE;
  817. X                        tmprl->dow = -1;
  818. X                        tmprl->mwf = tmprl->tt = FALSE;
  819. X                        tmprl->week_number = tmprl->number_of_weeks = 0;
  820. X                        tmprl->next = NULL;
  821. X                    }
  822. X                    recur_desc
  823. X                ;
  824. X
  825. recur_desc : /* empty */
  826. X           | LITTLED {tmprl->daily = TRUE;} recur_desc
  827. X           | LITTLEW {tmprl->weekly = TRUE;} recur_desc
  828. X           | LITTLEB {tmprl->biweekly = TRUE;} recur_desc
  829. X           | LITTLEM {tmprl->monthly = TRUE;} recur_desc
  830. X           | LITTLEY {tmprl->yearly = TRUE;} recur_desc
  831. X           | BIGM {tmprl->mwf = TRUE;} recur_desc
  832. X           | BIGT {tmprl->tt = TRUE;} recur_desc
  833. X           | BIGD NUMBER {tmprl->dow = number_value;} recur_desc
  834. X           | BIGN NUMBER {tmprl->week_number = number_value;} recur_desc
  835. X           | BIGW NUMBER {tmprl->number_of_weeks = number_value;} recur_desc
  836. X           ;
  837. X
  838. priority_part: COLON NUMBER ;
  839. X
  840. text_part : COLON STRING;
  841. X
  842. category: CATEGORY COLON STRING {
  843. X              string_value[0] = '\0';
  844. X                 sscanf(yytext, "\"%[^\"]\"", string_value);
  845. X                 cr = (struct category_rec *)new_category(string_value);
  846. X                 entry_head = entry_tail = (struct entry_list *) NULL;
  847. X                 rl_head = rl_tail = (struct recurrence_list *) NULL;
  848. X             }
  849. X        ;
  850. X
  851. %%
  852. X
  853. X
  854. #include "lex.yy.c"
  855. void yyerror(s)
  856. char *s;
  857. {
  858. X    fprintf(stderr,
  859. X              "Error on line %d: %s at or around \"%s\"\n",
  860. X              yylineno, s, yytext);
  861. X   yyerrok;
  862. }
  863. X
  864. X
  865. SHAR_EOF
  866. chmod 0644 todo.y ||
  867. echo 'restore of todo.y failed'
  868. Wc_c="`wc -c < 'todo.y'`"
  869. test 4389 -eq "$Wc_c" ||
  870.     echo 'todo.y: original size 4389, current size' "$Wc_c"
  871. rm -f _shar_wnt_.tmp
  872. fi
  873. # ============= xdefaults.c ==============
  874. if test -f 'xdefaults.c' -a X"$1" != X"-c"; then
  875.     echo 'x - skipping xdefaults.c (File already exists)'
  876.     rm -f _shar_wnt_.tmp
  877. else
  878. > _shar_wnt_.tmp
  879. echo 'x - extracting xdefaults.c (Text)'
  880. sed 's/^X//' << 'SHAR_EOF' > 'xdefaults.c' &&
  881. /*
  882. X * $Id: xdefaults.c,v 1.1 1992/07/27 18:45:10 jipping Exp $
  883. X * **********************************************************************
  884. X *
  885. X *  Xdefaults.c ==> Routines to control the setting of X defaults.
  886. X *
  887. X *   ** Please note:  These routines were shamelessly ripped off from
  888. X *   ** the Ftptool 4.3 distribution.  This tool was written by Mike 
  889. X *   ** Sullivan (Mike.Sullivan@Sun.COM) and are governed by the
  890. X *   ** copyright below.  Thanks, Mike!
  891. X *
  892. X * ----------------------------------------------------------------------
  893. X *     NOTICE TO USER: The source code, including the glyphs or icons 
  894. X *     forming a par of the OPEN LOOK TM Graphic User Interface, on this 
  895. X *     tape and in these files is copyrighted under U.S. and international
  896. X *     laws. Sun Microsystems, Inc. of Mountain View, California owns
  897. X *     the copyright and has design patents pending on many of the icons. 
  898. X *     AT&T is the owner of the OPEN LOOK trademark associated with the
  899. X *     materials on this tape. Users and possessors of this source code 
  900. X *     are hereby granted a nonexclusive, royalty-free copyright and 
  901. X *     design patent license to use this code in individual and 
  902. X *     commercial software. A royalty-free, nonexclusive trademark
  903. X *     license to refer to the code and output as "OPEN LOOK" compatible 
  904. X *     is available from AT&T if, and only if, the appearance of the 
  905. X *     icons or glyphs is not changed in any manner except as absolutely
  906. X *     necessary to accommodate the standard resolution of the screen or
  907. X *     other output device, the code and output is not changed except as 
  908. X *     authorized herein, and the code and output is validated by AT&T. 
  909. X *     Bigelow & Holmes is the owner of the Lucida (R) trademark for the
  910. X *     fonts and bit-mapped images associated with the materials on this 
  911. X *     tape. Users are granted a royalty-free, nonexclusive license to use
  912. X *     the trademark only to identify the fonts and bit-mapped images if, 
  913. X *     and only if, the fonts and bit-mapped images are not modified in any
  914. X *     way by the user. 
  915. X *
  916. X *
  917. X *     Any use of this source code must include, in the user documentation 
  918. X *     and internal comments to the code, notices to the end user as  
  919. X *     follows:
  920. X *
  921. X *
  922. X *     (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  923. X *     pending in the U.S. and foreign countries. OPEN LOOK is a 
  924. X *     trademark of AT&T. Used by written permission of the owners.
  925. X *
  926. X *
  927. X *      (c) Copyright Bigelow & Holmes 1986, 1985. Lucida is a registered 
  928. X *     trademark of Bigelow & Holmes. Permission to use the Lucida 
  929. X *     trademark is hereby granted only in association with the images 
  930. X *     and fonts described in this file.
  931. X *
  932. X *
  933. X *
  934. X *     SUN MICROSYSTEMS, INC., AT&T, AND BIGELOW & HOLMES 
  935. X *     MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF
  936. X *      THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" 
  937. X *     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. 
  938. X *     SUN  MICROSYSTEMS, INC., AT&T AND BIGELOW  & HOLMES, 
  939. X *     SEVERALLY AND INDIVIDUALLY, DISCLAIM ALL WARRANTIES 
  940. X *     WITH REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED
  941. X *     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  942. X *     PARTICULAR PURPOSE. IN NO EVENT SHALL SUN MICROSYSTEMS,
  943. X *     INC., AT&T OR BIGELOW & HOLMES BE LIABLE FOR ANY
  944. X *     SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
  945. X *     OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA     
  946. X *     OR PROFITS, WHETHER IN AN ACTION OF  CONTRACT, NEGLIGENCE
  947. X *     OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  948. X *     WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.
  949. X * ----------------------------------------------------------------------
  950. X *
  951. X * Revision History:
  952. X * $Log: xdefaults.c,v $
  953. X * Revision 1.1  1992/07/27  18:45:10  jipping
  954. X * Initial revision
  955. X *
  956. X *
  957. X *
  958. X */
  959. X
  960. #include "globaldefs.h"
  961. X
  962. char default_printer[25], log_preference[10], log_file[LINESIZ];
  963. char priority_listing[13], log_info_pref[25];
  964. int postscriptmode,logging;
  965. X
  966. char *find_dotfile(dotfile)
  967. char    *dotfile;
  968. {
  969. X    char    *home;
  970. X    char    *filename=NULL;
  971. X
  972. X    home = (char *)getenv("HOME");
  973. X    if (home != NULL && home[0] != '\0') {
  974. X        /* try $HOME/dotfile */
  975. X        filename = malloc((unsigned int)(strlen(home)+1+strlen(dotfile)+1));
  976. X        if (filename == NULL)
  977. X            return NULL;
  978. X        sprintf(filename, "%s/%s", home, dotfile);
  979. X        if (access(filename, F_OK) == -1) {
  980. X            free(filename);
  981. X            return NULL;
  982. X        }
  983. X        /* found it */
  984. X        return filename;
  985. X    }
  986. X    filename = strdup(dotfile);
  987. X    if (filename == NULL)
  988. X        return NULL;
  989. X    if (access(filename, F_OK) == -1) {
  990. X        free(filename);
  991. X        return NULL;
  992. X    }
  993. X
  994. X    return filename;
  995. }
  996. X
  997. char *create_dotfile(dotfile, mode)
  998. char    *dotfile;
  999. int             mode;
  1000. {
  1001. X    char    *home;
  1002. X    char    *filename=NULL;
  1003. X    int             fd;
  1004. X    
  1005. X    home = (char *)getenv("HOME");
  1006. X    if (home != NULL && home[0] != '\0') {
  1007. X        /* try $HOME/dotfile */
  1008. X        filename = malloc((unsigned int)(strlen(home)+1+strlen(dotfile)+1));
  1009. X        if (filename == NULL)
  1010. X            return NULL;
  1011. X        sprintf(filename, "%s/%s", home, dotfile);
  1012. X        if ((fd = creat(filename, mode)) == -1) {
  1013. X            free(filename);
  1014. X            return NULL;
  1015. X        }
  1016. X        close(fd);
  1017. X        /* found it */
  1018. X        return filename;
  1019. X    }
  1020. X    filename = strdup(dotfile);
  1021. X    if (filename == NULL)
  1022. X        return NULL;
  1023. X    if ((fd = creat(filename, mode)) == -1) {
  1024. X        free(filename);
  1025. X        return NULL;
  1026. X    }
  1027. X    close(fd);
  1028. X    
  1029. X    return filename;
  1030. }
  1031. X
  1032. void load_xdefaults()
  1033. {
  1034. X    char    *str;
  1035. X    int        ct;
  1036. X    char    *xapplresdir, res_file[LINESIZ];
  1037. X    char    *xvtdl_defaults;
  1038. X
  1039. X    if ((xapplresdir = (char *)getenv("XAPPLRESDIR")) != NULL) {
  1040. X        sprintf(res_file, "%s/Xvtdl", xapplresdir);
  1041. X        if (access(res_file, R_OK) == 0) {
  1042. X            defaults_load_db(res_file);
  1043. X        }
  1044. X    }
  1045. X    xvtdl_defaults = find_dotfile(".xvtdlrc");
  1046. X    if (xvtdl_defaults) {
  1047. X        defaults_load_db(xvtdl_defaults);
  1048. X        free(xvtdl_defaults);
  1049. X    }
  1050. X
  1051. X    strcpy(default_printer,
  1052. X             (char *)defaults_get_string("xvtdl.printer",
  1053. X                                                  "Xvtdl.Printer",
  1054. X                                                  "lp"));
  1055. X    postscriptmode =
  1056. X        (int)defaults_get_boolean("xvtdl.postscript",
  1057. X                                          "Xvtdl.PostScript",
  1058. X                                          FALSE);
  1059. X
  1060. X    logging = 
  1061. X        (int)defaults_get_boolean("xvtdl.logging",
  1062. X                                          "Xvtdl.Logging",
  1063. X                                          FALSE);
  1064. X    if (! logging) log_level = LOG_NEVER;
  1065. X
  1066. X    strcpy(log_preference, 
  1067. X             (char *)defaults_get_string("xvtdl.logpreference",
  1068. X                                                  "Xvtdl.LogPreference",
  1069. X                                                  "atquit"));
  1070. X    if (logging) {
  1071. X        if (EQUAL(log_preference, "atquit")) {
  1072. X            log_level = LOG_AT_QUIT;
  1073. X        } else {
  1074. X            log_level = LOG_AT_CHECKED;
  1075. X        }
  1076. X    }
  1077. X
  1078. X    strcpy(log_info_pref, 
  1079. X             (char *)defaults_get_string("xvtdl.loginfopreference",
  1080. X                                                  "Xvtdl.LogInfoPreference",
  1081. X                                                  "timestamp"));
  1082. X    if (EQUAL(log_info_pref, "timestamp")) {
  1083. X        log_info_level = LOG_TIMESTAMP;
  1084. X    } else {
  1085. X        log_info_level = LOG_USER_SPEC;
  1086. X    }
  1087. X
  1088. X    strcpy(log_file, 
  1089. X             (char *)defaults_get_string("xvtdl.logfilename",
  1090. X                                                  "Xvtdl.LogFileName",
  1091. X                                                  ""));
  1092. X
  1093. X    strcpy(priority_listing,
  1094. X             (char *)defaults_get_string("xvtdl.prioritylisting",
  1095. X                                                  "Xvtdl.PriorityListing",
  1096. X                                                  "descending"));
  1097. }
  1098. X
  1099. void set_xdefaults()
  1100. {
  1101. X    defaults_set_string("Xvtdl.Printer", default_printer);
  1102. X    defaults_set_boolean("Xvtdl.PostScript", postscriptmode);
  1103. X    defaults_set_boolean("Xvtdl.Logging", logging);
  1104. X    defaults_set_string("Xvtdl.LogPreference", log_preference);
  1105. X    defaults_set_string("Xvtdl.LogInfoPreference", log_info_pref);
  1106. X    defaults_set_string("Xvtdl.LogFileName", log_file);
  1107. X    defaults_set_string("Xvtdl.PriorityListing", priority_listing);
  1108. }
  1109. X
  1110. void save_xdefaults()
  1111. {
  1112. X   char  *filename=NULL;
  1113. X    FILE    *fp;
  1114. X    char    *str;
  1115. X    char    *true = "True";
  1116. X    char    *false = "False";
  1117. X
  1118. X    filename = find_dotfile(".xvtdlrc");
  1119. X    if (filename == NULL)
  1120. X        if ((filename = (char *)create_dotfile(".xvtdlrc", 0644)) == NULL)
  1121. X            return;
  1122. X    if ((fp = fopen(filename, "w")) == NULL) {
  1123. X        fprintf(stderr, "Could not write defaults file...\n");
  1124. X        return;
  1125. X    }
  1126. X
  1127. X    fprintf(fp, "Xvtdl.Printer:\t%s\n", default_printer);
  1128. X    fprintf(fp, "Xvtdl.PostScript:\t%s\n", 
  1129. X        (postscriptmode == 0) ? false : true);
  1130. X    fprintf(fp, "Xvtdl.Logging:\t%s\n", 
  1131. X        (logging == 0) ? false : true);
  1132. X    fprintf(fp, "Xvtdl.LogPreference:\t%s\n", log_preference);
  1133. X    fprintf(fp, "Xvtdl.LogInfoPreference:\t%s\n", log_info_pref);
  1134. X    fprintf(fp, "Xvtdl.LogFileName:\t%s\n", log_file);
  1135. X    fprintf(fp, "Xvtdl.PriorityListing:\t%s\n", priority_listing);
  1136. X
  1137. X    fclose(fp);
  1138. X    free(filename);
  1139. }
  1140. SHAR_EOF
  1141. chmod 0644 xdefaults.c ||
  1142. echo 'restore of xdefaults.c failed'
  1143. Wc_c="`wc -c < 'xdefaults.c'`"
  1144. test 8135 -eq "$Wc_c" ||
  1145.     echo 'xdefaults.c: original size 8135, current size' "$Wc_c"
  1146. rm -f _shar_wnt_.tmp
  1147. fi
  1148. # ============= print.c ==============
  1149. if test -f 'print.c' -a X"$1" != X"-c"; then
  1150.     echo 'x - skipping print.c (File already exists)'
  1151.     rm -f _shar_wnt_.tmp
  1152. else
  1153. > _shar_wnt_.tmp
  1154. echo 'x - extracting print.c (Text)'
  1155. sed 's/^X//' << 'SHAR_EOF' > 'print.c' &&
  1156. /*
  1157. X * $Id: print.c,v 3.0 1992/07/27 18:42:35 jipping Exp $
  1158. X * *********************************************************************
  1159. X * Print.c --> Routines for printing todo lists.
  1160. X *
  1161. X * The "print" window was constructed using Sun's GUIDE.  These routines
  1162. X * reference window portions through pointer interfaces established by
  1163. X * GUIDE code.  The actual code to construct the interface can be found 
  1164. X * in "print_ui.c" and "print_ui.h".
  1165. X *
  1166. X * ----------------------------------------------------------------------
  1167. X *
  1168. X * Copyright (c) 1992 by Mike Jipping and Hope College
  1169. X *  
  1170. X * Permission is granted to copy and distribute this file in modified or
  1171. X * unmodified form, for noncommercial use, provided (a) this copyright notice
  1172. X * is preserved, (b) no attempt is made to restrict redistribution of this
  1173. X * file, and (c) this file is not distributed as part of any collection whose
  1174. X * redistribution is restricted by a compilation copyright.
  1175. X *
  1176. X * ----------------------------------------------------------------------
  1177. X *
  1178. X * Revision History:
  1179. X *
  1180. X * $Log: print.c,v $
  1181. X * Revision 3.0  1992/07/27  18:42:35  jipping
  1182. X * Release 3.0 includes:
  1183. X * * added a "print_all" routine to print all items in "List All" list
  1184. X * * fixed hard coded temp file name with call to "tempnam"
  1185. X * * fixed some pinning errors
  1186. X * * changed from userid to gecos on output print
  1187. X * `.
  1188. X *
  1189. X * Revision 2.2  1992/07/16  13:38:49  jipping
  1190. X * COmplete rewrote the printing methods to accomodate printing
  1191. X * all categories; see print_category and print_list.
  1192. X *
  1193. X * Revision 2.1  1992/07/15  17:25:47  jipping
  1194. X * Implemented the feature of printing all categories.
  1195. X * (1) added the print_category routine
  1196. X * (2) made print_list call print_category as requested.
  1197. X *
  1198. X * Revision 2.0  1992/07/06  12:42:08  jipping
  1199. X * Initial release.
  1200. X *
  1201. X */
  1202. X
  1203. #include "globaldefs.h"
  1204. X
  1205. Attr_attribute    INSTANCE;
  1206. print_print_base_objects    *print_print_base;
  1207. int incl_checked;
  1208. X
  1209. /*
  1210. X * **********************************************************************
  1211. X * Initialize the print window...by calling the routine set up by GUIDE.
  1212. X */
  1213. X
  1214. void initialize_print ()
  1215. {
  1216. X    print_print_base = print_print_base_objects_initialize(NULL, tdlist);
  1217. X
  1218. X    xv_set(print_print_base->scale,
  1219. X             PANEL_VALUE, 100,
  1220. X             PANEL_INACTIVE, TRUE,
  1221. X             0);
  1222. X    xv_set(print_print_base->incl_checked_items, PANEL_VALUE, 1, 0);
  1223. X    if (default_printer != NULL)
  1224. X        xv_set(print_print_base->printer, PANEL_VALUE, default_printer, 0);
  1225. X    if (postscriptmode) {
  1226. X        xv_set(print_print_base->postscript, PANEL_VALUE, 1, 0);
  1227. X        xv_set(print_print_base->scale, PANEL_INACTIVE, FALSE, 0);
  1228. X    }
  1229. X    
  1230. X    incl_checked = 1;
  1231. }
  1232. X
  1233. /*
  1234. X * **********************************************************************
  1235. X * Notify callback function for the "cancel" button.
  1236. X */
  1237. X
  1238. void print_cancel(item, event)
  1239. Panel_item    item;
  1240. Event        *event;
  1241. {
  1242. X    xv_set(print_print_base->print_base,
  1243. X             XV_SHOW, FALSE,
  1244. X             0);
  1245. }
  1246. X
  1247. /*
  1248. X * **********************************************************************
  1249. X * Given a month, day, and year spec, this routine displays the todo
  1250. X * list.  This includes recurring and non-recurring entries.  The list is
  1251. X * sorted by priority.
  1252. X */
  1253. print_category (cr,tmp,ps,incl_checked,scale_factor,name,title)
  1254. struct category_rec *cr;
  1255. FILE *tmp;
  1256. int ps,incl_checked;
  1257. float scale_factor;
  1258. char *name, *title;
  1259. {
  1260. X    struct print_list {
  1261. X        char print_line[80];
  1262. X        int item_checked;
  1263. X        struct print_list *next;
  1264. X    };
  1265. X
  1266. X    struct print_list *position[10], *head[10], *pl, *tpl;
  1267. X    int today_datecode, datecode, count, nrows, entry;
  1268. X    struct entry_list *el;
  1269. X    struct day_entry *de;
  1270. X    struct recurrence_list *rl;
  1271. X    struct day_entry *tmprl, *rl2;
  1272. X    Server_image check;
  1273. X    char txt[80];
  1274. X
  1275. X   /*
  1276. X    *  Initialize and clear the position tally for sorting the list
  1277. X    */
  1278. X    entry_head = cr->entry_head;
  1279. X    entry_tail = cr->entry_tail;
  1280. X    rl_head = cr->rl_head;
  1281. X    rl_tail = cr->rl_tail;
  1282. X
  1283. X    for (count=0; count<10; count++)
  1284. X        position[count] = head[count] = (struct print_list *)NULL;
  1285. X
  1286. X   /*
  1287. X    *  compute the correct datecode and find the entry list for that
  1288. X    *  date.
  1289. X    */
  1290. X    datecode = (curr_year-1990)*10000 + curr_month*100 + curr_day;
  1291. X    today_datecode =
  1292. X        (today.tm_year-90)*10000 + (today.tm_mon+1)*100 + today.tm_mday;
  1293. X    el = (struct entry_list *)entry_search(datecode, FALSE, NULL);
  1294. X
  1295. X   /*
  1296. X    * If we have one, get its entries....
  1297. X    */
  1298. X    if (el != NULL) {
  1299. X        for (de = el->first; de != NULL; de = de->next) {
  1300. X            pl = NEW(struct print_list);
  1301. X            strcpy(pl->print_line, de->text);
  1302. X            pl->item_checked = de->checked;
  1303. X            pl->next = NULL;
  1304. X            if (position[de->priority] != NULL) {
  1305. X                position[de->priority]->next = pl;
  1306. X            } else {
  1307. X                head[de->priority] = pl;
  1308. X            }
  1309. X            position[de->priority] = pl;
  1310. X        }
  1311. X    }
  1312. X
  1313. X    /*
  1314. X     *  Search the recurrence list for possible candidates to print
  1315. X     */
  1316. X    el = (struct entry_list *)entry_search(datecode, TRUE, NULL);
  1317. X    for (rl = rl_head; rl != NULL; rl = rl->next) {
  1318. X        if (datecode_matches(datecode, rl)) {
  1319. X            pl = NEW(struct print_list);
  1320. X            strcpy(pl->print_line, rl->text);
  1321. X            pl->item_checked = FALSE;
  1322. X            pl->next = NULL;
  1323. X            if (position[rl->priority] != NULL) {
  1324. X                position[rl->priority]->next = pl;
  1325. X            } else {
  1326. X                head[rl->priority] = pl;
  1327. X            }
  1328. X            position[rl->priority] = pl;
  1329. X        }
  1330. X    }
  1331. X
  1332. X    /* 
  1333. X     *  And, finally, print the list.
  1334. X    */
  1335. X    if (ps) {
  1336. X        fprintf(tmp, "%%%%Page:\n612 792 0 FMBEGINPAGE\n");
  1337. X        fprintf(tmp, "%f %f scale\n", scale_factor/100.0, scale_factor/100.0);
  1338. X      fprintf(tmp, "72 746 540 756 R\n7 X\n0 K\nV\n72 32.67 540 42.67 R\n");
  1339. X      fprintf(tmp, "V\n99 72 540 720 R\nV\n0 F\n0 X\n(T) 99 708 T\n(o Do List) 110.33 708 T\n1 F\n");
  1340. X        fprintf(tmp, "(for %s) 99 687 T\n", name);
  1341. X        fprintf(tmp, "(Category: %s) 99 668 T\n", cr->name);
  1342. X        fprintf(tmp, "(Date: %s) 99 649 T\n", title);
  1343. X        copyfile2(PRINT_PROLOG2, tmp);
  1344. X    } else {
  1345. X        fprintf(tmp, "*** TO DO LIST ***\n");
  1346. X        fprintf(tmp, "      for %s\n", name);
  1347. X        fprintf(tmp, "      Category: %s\n", cr->name);
  1348. X        fprintf(tmp, "      Date: %s\n\n\n", title);
  1349. X    }
  1350. X
  1351. X    entry = 0;
  1352. X    for (count=9; count >= 0; count--) {
  1353. X        tpl = NULL;
  1354. X        for (pl=head[count]; pl != NULL; tpl = pl,pl = pl->next) {
  1355. X            if (tpl != NULL) free(tpl);
  1356. X            if (! pl->item_checked) {
  1357. X                if (ps) {
  1358. X                    fprintf(tmp, "(%s) %d TODOITEM\n", pl->print_line, entry++);
  1359. X                } else {
  1360. X                    fprintf(tmp, "  [ ] %s\n\n", pl->print_line);
  1361. X                }
  1362. X            } else {
  1363. X                if (incl_checked == 1) {
  1364. X                    if (ps) {
  1365. X                        fprintf(tmp, "(%s) %d TODOCHECKEDITEM\n", pl->print_line, entry++);
  1366. X                    } else {
  1367. X                        fprintf(tmp, "  [X] %s\n\n", pl->print_line);
  1368. X                    }
  1369. X                }
  1370. X            }
  1371. X        }
  1372. X    }
  1373. X    if (ps) {
  1374. X        fprintf(tmp, "FMENDPAGE\n%%%%EndPage:\n");        
  1375. X    } else {
  1376. X        fprintf(tmp, "\f");
  1377. X    }
  1378. }
  1379. X
  1380. /*
  1381. X * **********************************************************************
  1382. X * Given a month, day, and year spec, this routine displays the todo
  1383. X * list.  This includes recurring and non-recurring entries.  The list is
  1384. X * sorted by priority.
  1385. X */
  1386. print_all (tmp,ps,incl_checked,scale_factor,name,title)
  1387. FILE *tmp;
  1388. int ps,incl_checked;
  1389. float scale_factor;
  1390. char *name, *title;
  1391. {
  1392. X    struct print_list {
  1393. X        char print_line[80];
  1394. X        int item_checked;
  1395. X        struct print_list *next;
  1396. X    };
  1397. X
  1398. X    struct print_list *position[10], *head[10], *pl, *tpl;
  1399. X    int today_datecode, datecode, count, nrows, entry;
  1400. X    struct entry_list *el;
  1401. X    struct day_entry *de;
  1402. X    struct recurrence_list *rl;
  1403. X    struct day_entry *tmprl, *rl2;
  1404. X    struct category_rec *cr;
  1405. X    Server_image check;
  1406. X    char txt[80];
  1407. X
  1408. X   /*
  1409. X    *  Initialize and clear the position tally for sorting the list
  1410. X    */
  1411. X    for (count=0; count<10; count++)
  1412. X        position[count] = head[count] = (struct print_list *)NULL;
  1413. X
  1414. X   /*
  1415. X    *  compute the correct datecode and find the entry list for that
  1416. X    *  date.
  1417. X    */
  1418. X    datecode = (curr_year-1990)*10000 + curr_month*100 + curr_day;
  1419. X    today_datecode =
  1420. X        (today.tm_year-90)*10000 + (today.tm_mon+1)*100 + today.tm_mday;
  1421. X
  1422. X    cr = category_head;
  1423. X    while (cr != NULL) {
  1424. X        entry_head = cr->entry_head;
  1425. X        entry_tail = cr->entry_tail;
  1426. X        rl_head = cr->rl_head;
  1427. X        rl_tail = cr->rl_tail;
  1428. X        
  1429. X        el = (struct entry_list *)entry_search(datecode, FALSE, NULL);
  1430. X        
  1431. X        /*
  1432. X         * If we have one, get its entries....
  1433. X         */
  1434. X        if (el != NULL) {
  1435. X            for (de = el->first; de != NULL; de = de->next) {
  1436. X                pl = NEW(struct print_list);
  1437. X                strcpy(pl->print_line, de->text);
  1438. X                pl->item_checked = de->checked;
  1439. X                pl->next = NULL;
  1440. X                if (position[de->priority] != NULL) {
  1441. X                    position[de->priority]->next = pl;
  1442. X                } else {
  1443. X                    head[de->priority] = pl;
  1444. X                }
  1445. X                position[de->priority] = pl;
  1446. X            }
  1447. X        }
  1448. X        
  1449. X        /*
  1450. X         *  Search the recurrence list for possible candidates to print
  1451. X         */
  1452. X        el = (struct entry_list *)entry_search(datecode, TRUE, NULL);
  1453. X        for (rl = rl_head; rl != NULL; rl = rl->next) {
  1454. X            if (datecode_matches(datecode, rl)) {
  1455. X                pl = NEW(struct print_list);
  1456. X                strcpy(pl->print_line, rl->text);
  1457. X                pl->item_checked = FALSE;
  1458. X                pl->next = NULL;
  1459. X                if (position[rl->priority] != NULL) {
  1460. X                    position[rl->priority]->next = pl;
  1461. X                } else {
  1462. X                    head[rl->priority] = pl;
  1463. X                }
  1464. X                position[rl->priority] = pl;
  1465. X            }
  1466. X        }
  1467. X        cr = cr->next;
  1468. X    }
  1469. X    cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  1470. X    entry_head = cr->entry_head;
  1471. X    entry_tail = cr->entry_tail;
  1472. X    rl_head = cr->rl_head;
  1473. X    rl_tail = cr->rl_tail;
  1474. X        
  1475. X    /* 
  1476. X     *  And, finally, contruct the list.
  1477. X     */
  1478. X    if (ps) {
  1479. X        fprintf(tmp, "%%%%Page:\n612 792 0 FMBEGINPAGE\n");
  1480. X        fprintf(tmp, "%f %f scale\n", scale_factor/100.0, scale_factor/100.0);
  1481. X        fprintf(tmp, "72 746 540 756 R\n7 X\n0 K\nV\n72 32.67 540 42.67 R\n");
  1482. X        fprintf(tmp, "V\n99 72 540 720 R\nV\n0 F\n0 X\n(T) 99 708 T\n(o Do List) 110.33 708 T\n1 F\n");
  1483. X        fprintf(tmp, "(for %s) 99 687 T\n", name);
  1484. X        fprintf(tmp, "(Category: ALL CATEGORIES) 99 668 T\n");
  1485. X        fprintf(tmp, "(Date: %s) 99 649 T\n", title);
  1486. X        copyfile2(PRINT_PROLOG2, tmp);
  1487. X    } else {
  1488. X        fprintf(tmp, "*** TO DO LIST ***\n");
  1489. X        fprintf(tmp, "      for %s\n", name);
  1490. X        fprintf(tmp, "      Category: ALL CATEGORIES\n");
  1491. X        fprintf(tmp, "      Date: %s\n\n\n", title);
  1492. X    }
  1493. X    
  1494. X    entry = 0;
  1495. X    for (count=9; count >= 0; count--) {
  1496. X        tpl = NULL;
  1497. X        for (pl=head[count]; pl != NULL; tpl = pl,pl = pl->next) {
  1498. X            if (tpl != NULL) free(tpl);
  1499. X            if (! pl->item_checked) {
  1500. X                if (ps) {
  1501. X                    fprintf(tmp, "(%s) %d TODOITEM\n", pl->print_line, entry++);
  1502. X                } else {
  1503. X                    fprintf(tmp, "  [ ] %s\n\n", pl->print_line);
  1504. X                }
  1505. X            } else {
  1506. X                if (incl_checked == 1) {
  1507. X                    if (ps) {
  1508. X                        fprintf(tmp, "(%s) %d TODOCHECKEDITEM\n", pl->print_line, entry++);
  1509. X                    } else {
  1510. X                        fprintf(tmp, "  [X] %s\n\n", pl->print_line);
  1511. X                    }
  1512. X                }
  1513. X            }
  1514. X        }
  1515. X    }
  1516. X    if (ps) {
  1517. X        fprintf(tmp, "FMENDPAGE\n%%%%EndPage:\n");        
  1518. X    } else {
  1519. X        fprintf(tmp, "\f");
  1520. X    }
  1521. }
  1522. X
  1523. X
  1524. /*
  1525. X * **********************************************************************
  1526. X * Notify callback function for "Done" button --> actually DO the print,
  1527. X * depending on the setting of the items.
  1528. X *
  1529. X * Note that the current version depends on two prolog files for printing
  1530. X * in PostScript.  These must be set up in the "globaldefs.h" file, and 
  1531. X * are denoted by the PROLOG1 and PROLOG2 macros.
  1532. X */
  1533. X
  1534. void print_list(item, event)
  1535. Panel_item item; 
  1536. Event      *event;
  1537. {
  1538. X    print_print_base_objects
  1539. X        *ip = (print_print_base_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1540. X    char *temp_file;
  1541. X    FILE *tmp;
  1542. X    int ps;
  1543. X    float scale_factor;
  1544. X    struct category_rec *cr;
  1545. X    char day_title[50];
  1546. X    char printercmd[120];
  1547. X    struct tm *now;
  1548. X   struct timeval tv;
  1549. X    struct passwd *pwd;
  1550. X
  1551. X    /* 
  1552. X    *  Open the temp file.
  1553. X    */
  1554. X   if ( (temp_file = tempnam(NULL, "xvtdl")) == NULL) {
  1555. X        fprintf(stderr, "Unable to create temporary file name\n");
  1556. X        return;
  1557. X    }
  1558. X    if ( (tmp = fopen(temp_file, "w")) == NULL) {
  1559. X        fprintf(stderr, "Unable to open temp file %s\n", temp_file);
  1560. X        free(temp_file);
  1561. X        return;
  1562. X    }
  1563. X
  1564. X   /*
  1565. X    * Get set up.  Set up the time variables, and set up the file 
  1566. X    * header.
  1567. X    */
  1568. X   now = localtime(&tv.tv_sec);
  1569. X    now->tm_mon = curr_month - 1;
  1570. X    now->tm_mday = curr_day;
  1571. X    now->tm_year = curr_year-1900;
  1572. X    now->tm_wday = zeller(curr_month, curr_day, curr_year);
  1573. X    strftime(day_title, 50, "%A, %B %e, %Y", now);
  1574. X
  1575. X    ps = (xv_get(ip->postscript, PANEL_VALUE) == 1);
  1576. X    scale_factor = (float)xv_get(ip->scale, PANEL_VALUE);
  1577. X    pwd = getpwuid(getuid());
  1578. X
  1579. X    if (ps) copyfile2(PRINT_PROLOG1, tmp);
  1580. X
  1581. X    if (xv_get(ip->categories, PANEL_INACTIVE) == TRUE) {
  1582. X        print_all(tmp,ps,incl_checked,scale_factor,pwd->pw_gecos,day_title);
  1583. X    } else if (xv_get(ip->categories, PANEL_VALUE) == 1) {
  1584. X        cr = category_head;
  1585. X        while (cr != NULL) {
  1586. X            print_category(cr,tmp,ps,incl_checked,scale_factor,pwd->pw_gecos,day_title);
  1587. X            cr = cr->next;
  1588. X        }
  1589. X        cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  1590. X        entry_head = cr->entry_head;
  1591. X        entry_tail = cr->entry_tail;
  1592. X        rl_head = cr->rl_head;
  1593. X        rl_tail = cr->rl_tail;
  1594. X    } else {
  1595. X        cr = (struct category_rec *)xv_get(categories, PANEL_CLIENT_DATA);
  1596. X        print_category(cr,tmp,ps,incl_checked,scale_factor,pwd->pw_gecos,day_title);
  1597. X    }
  1598. X
  1599. X    /*
  1600. X    *  And we're done.
  1601. X    */
  1602. X    fclose(tmp);
  1603. X    sprintf(printercmd, "lpr -P%s %s",
  1604. X              (char *)xv_get(ip->printer, PANEL_VALUE), temp_file);
  1605. X    system(printercmd);
  1606. X
  1607. X    unlink(temp_file);
  1608. X    free(temp_file);
  1609. X
  1610. X    xv_set(print_print_base->print_base,
  1611. X             XV_SHOW, FALSE,
  1612. X             0);
  1613. }
  1614. X
  1615. /*
  1616. X * **********************************************************************
  1617. X * Callback function for the "Print..." button on the ToDo List window.
  1618. X */
  1619. X
  1620. void start_print(item, event)
  1621. X    Panel_item    item;
  1622. X    Event        *event;
  1623. {
  1624. X    if (strlen((char *)xv_get(print_print_base->printer, PANEL_VALUE)) == 0)
  1625. X        xv_set(print_print_base->printer, PANEL_VALUE, "lp", 0);
  1626. X    xv_set(print_print_base->print_base,
  1627. X             XV_SHOW, TRUE,
  1628. X             0);
  1629. }
  1630. X
  1631. /*
  1632. X * **********************************************************************
  1633. X * Notify callback function for the printer type item.
  1634. X */
  1635. void
  1636. change_printer_type(item, value, event)
  1637. X    Panel_item    item;
  1638. X    int        value;
  1639. X    Event        *event;
  1640. {
  1641. X    print_print_base_objects
  1642. X        *ip = (print_print_base_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1643. X    
  1644. X    if (value == 0) {
  1645. X        xv_set(ip->scale, PANEL_INACTIVE, TRUE, 0);
  1646. X    } else {
  1647. X        xv_set(ip->scale, PANEL_INACTIVE, FALSE, 0);
  1648. X    }
  1649. X        
  1650. }
  1651. X
  1652. /*
  1653. X * **********************************************************************
  1654. X * Notify callback function for the "Include items" widget.  Makes a 
  1655. X * checkbox widget into an "exclusive" checkbox widget ('cause it looks
  1656. X * nice).
  1657. X */
  1658. void change_checked(item, value, event)
  1659. Panel_item    item;
  1660. int        value;
  1661. Event        *event;
  1662. {
  1663. X    print_print_base_objects
  1664. X        *ip = (print_print_base_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1665. X    
  1666. X    if (value != incl_checked) {
  1667. X        incl_checked = incl_checked==1?2:1;
  1668. X        xv_set(ip->incl_checked_items, PANEL_VALUE, incl_checked, 0);
  1669. X    }
  1670. }
  1671. SHAR_EOF
  1672. chmod 0644 print.c ||
  1673. echo 'restore of print.c failed'
  1674. Wc_c="`wc -c < 'print.c'`"
  1675. test 14426 -eq "$Wc_c" ||
  1676.     echo 'print.c: original size 14426, current size' "$Wc_c"
  1677. rm -f _shar_wnt_.tmp
  1678. fi
  1679. # ============= props_ui.c ==============
  1680. if test -f 'props_ui.c' -a X"$1" != X"-c"; then
  1681.     echo 'x - skipping props_ui.c (File already exists)'
  1682.     rm -f _shar_wnt_.tmp
  1683. else
  1684. > _shar_wnt_.tmp
  1685. echo 'x - extracting props_ui.c (Text)'
  1686. sed 's/^X//' << 'SHAR_EOF' > 'props_ui.c' &&
  1687. /*
  1688. X * props_ui.c - User interface object initialization functions.
  1689. X * This file was generated by `gxv' from `props.G'.
  1690. X * DO NOT EDIT BY HAND.
  1691. X */
  1692. X
  1693. #include <stdio.h>
  1694. #include <sys/param.h>
  1695. #include <sys/types.h>
  1696. #include <xview/xview.h>
  1697. #include <xview/canvas.h>
  1698. #include <xview/panel.h>
  1699. #include <xview/scrollbar.h>
  1700. #include <xview/svrimage.h>
  1701. #include <xview/termsw.h>
  1702. #include <xview/text.h>
  1703. #include <xview/tty.h>
  1704. #include <xview/xv_xrect.h>
  1705. #include "props_ui.h"
  1706. X
  1707. /*
  1708. X * Initialize an instance of object `props_frame'.
  1709. X */
  1710. props_props_frame_objects *
  1711. props_props_frame_objects_initialize(ip, owner)
  1712. X    props_props_frame_objects    *ip;
  1713. X    Xv_opaque    owner;
  1714. {
  1715. X    if (!ip && !(ip = (props_props_frame_objects *) calloc(1, sizeof (props_props_frame_objects))))
  1716. X        return (props_props_frame_objects *) NULL;
  1717. X    if (!ip->props_frame)
  1718. X        ip->props_frame = props_props_frame_props_frame_create(ip, owner);
  1719. X    if (!ip->logging_panel)
  1720. X        ip->logging_panel = props_props_frame_logging_panel_create(ip, ip->props_frame);
  1721. X    if (!ip->logging_msg)
  1722. X        ip->logging_msg = props_props_frame_logging_msg_create(ip, ip->logging_panel);
  1723. X    if (!ip->log_preference)
  1724. X        ip->log_preference = props_props_frame_log_preference_create(ip, ip->logging_panel);
  1725. X    if (!ip->log_info)
  1726. X        ip->log_info = props_props_frame_log_info_create(ip, ip->logging_panel);
  1727. X    if (!ip->log_filename)
  1728. X        ip->log_filename = props_props_frame_log_filename_create(ip, ip->logging_panel);
  1729. X    if (!ip->other_panel)
  1730. X        ip->other_panel = props_props_frame_other_panel_create(ip, ip->props_frame);
  1731. X    if (!ip->other_msg)
  1732. X        ip->other_msg = props_props_frame_other_msg_create(ip, ip->other_panel);
  1733. X    if (!ip->priority_direction)
  1734. X        ip->priority_direction = props_props_frame_priority_direction_create(ip, ip->other_panel);
  1735. X    if (!ip->def_printer)
  1736. X        ip->def_printer = props_props_frame_def_printer_create(ip, ip->other_panel);
  1737. X    if (!ip->def_print_mode)
  1738. X        ip->def_print_mode = props_props_frame_def_print_mode_create(ip, ip->other_panel);
  1739. X    if (!ip->controls1)
  1740. X        ip->controls1 = props_props_frame_controls1_create(ip, ip->props_frame);
  1741. X    if (!ip->done_button)
  1742. X        ip->done_button = props_props_frame_done_button_create(ip, ip->controls1);
  1743. X    if (!ip->reset_button)
  1744. X        ip->reset_button = props_props_frame_reset_button_create(ip, ip->controls1);
  1745. X    return ip;
  1746. }
  1747. X
  1748. /*
  1749. X * Create object `props_frame' in the specified instance.
  1750. X */
  1751. XXv_opaque
  1752. props_props_frame_props_frame_create(ip, owner)
  1753. X    props_props_frame_objects    *ip;
  1754. X    Xv_opaque    owner;
  1755. {
  1756. X    Xv_opaque    obj;
  1757. X    
  1758. X    obj = xv_create(owner, FRAME_CMD,
  1759. X        XV_KEY_DATA, INSTANCE, ip,
  1760. X        XV_WIDTH, 516,
  1761. X        XV_HEIGHT, 369,
  1762. X        XV_LABEL, "Properties",
  1763. X        FRAME_SHOW_FOOTER, TRUE,
  1764. X        FRAME_SHOW_RESIZE_CORNER, TRUE,
  1765. X        FRAME_CMD_PUSHPIN_IN, FALSE,
  1766. X        NULL);
  1767. X    xv_set(xv_get(obj, FRAME_CMD_PANEL), WIN_SHOW, FALSE, NULL);
  1768. X    return obj;
  1769. }
  1770. X
  1771. /*
  1772. X * Create object `logging_panel' in the specified instance.
  1773. X */
  1774. XXv_opaque
  1775. props_props_frame_logging_panel_create(ip, owner)
  1776. X    props_props_frame_objects    *ip;
  1777. X    Xv_opaque    owner;
  1778. {
  1779. X    Xv_opaque    obj;
  1780. X    
  1781. X    obj = xv_create(owner, PANEL,
  1782. SHAR_EOF
  1783. true || echo 'restore of props_ui.c failed'
  1784. fi
  1785. echo 'End of  part 3'
  1786. echo 'File props_ui.c is continued in part 4'
  1787. echo 4 > _shar_seq_.tmp
  1788. exit 0
  1789. -- 
  1790. Senior Systems Scientist        mail: dcmartin@msi.com
  1791. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1792. 796 North Pastoria Avenue        at&t: 408/522-9236
  1793. Sunnyvale, California 94086        fax: 408/732-0831
  1794.