home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume17 / calentool / part12 / notify.c < prev   
Encoding:
C/C++ Source or Header  |  1991-04-06  |  31.5 KB  |  1,470 lines

  1. /*
  2.  * $Header: notify.c,v 2.4 91/03/27 16:46:01 billr Exp $
  3.  */
  4. /*
  5.  * notify.c
  6.  *
  7.  * Author: Philip Heller, Sun Microsystems. Inc. <terrapin!heller@sun.com>
  8.  *
  9.  * Original source Copyright (C) 1987, Sun Microsystems, Inc.
  10.  *    All Rights Reserved
  11.  * Permission is hereby granted to use and modify this program in source
  12.  * or binary form as long as it is not sold for profit and this copyright
  13.  * notice remains intact.
  14.  *
  15.  *
  16.  * Changes/additions by: Bill Randle, Tektronix, Inc. <billr@saab.CNA.TEK.COM>
  17.  *
  18.  * Changes and additions Copyright (C) 1988, 1989, 1991 Tektronix, Inc.
  19.  *    All Rights Reserved
  20.  * Permission is hereby granted to use and modify the modifications in source
  21.  * or binary form as long as they are not sold for profit and this copyright
  22.  * notice remains intact.
  23.  */
  24. /**********************************************************
  25.  *                              *
  26.  *     These are the notify routines which are invoked  *
  27.  * by events in the control panel subwindow,and the      *
  28.  * various popup window panels.                  *
  29.  *                              *
  30.  **********************************************************/
  31.  
  32.  
  33.  
  34. #include <stdio.h>
  35. #include <suntool/sunview.h>
  36. #include <suntool/canvas.h>
  37. #include <suntool/panel.h>
  38. #include <suntool/menu.h>
  39. #include "ct.h"
  40.  
  41. extern int monday_first;
  42. extern int mainsw_state, nr_weekdays, day_is_open;
  43. extern int dayslot_width, nr_weekdays;
  44. extern struct tm today, current;
  45. extern Cursor month_cursor, week_cursor, day_cursor, year_cursor;
  46. extern Pixfont *font;
  47. extern Frame frame;
  48. extern Panel panel;
  49. extern Canvas canvas;
  50. extern Pixwin *main_pixwin;
  51. extern Menu next_menu, previous_menu, year_menu, month_menu;
  52. extern Menu day_menu, week_menu, current_menu;
  53. extern Menu done_menu;
  54. extern Frame fframe;
  55. extern Panel_item repeat_pi, remind_pi, daysel_pi;
  56. extern Panel_item everyx_pi, whichwk_pi, marked_pi;
  57. extern Panel_item del_choice_pi, setdate_pi;
  58. extern Panel_item runl_pi, advw_pi;
  59. #ifndef NO_SUN_MOON
  60. extern Frame mframe, sframe;
  61. extern Panel_item moonbutton_pi, sunbutton_pi;
  62. #endif
  63. extern Frame fileframe;
  64. extern Panel_item filename_pi, file_ro_pi;
  65. #ifndef NO_PRINTER
  66. extern Panel_item prcmd_pi, prfile_pi;
  67. extern int print_to_file;
  68. extern Frame prframe;
  69. extern Menu print_menu;
  70. #endif
  71. extern Frame prompt_frame, date_frame;
  72. extern struct appt_entry future[];
  73. extern struct dayslot *slots;
  74. extern int attr_bi;  /* index into currently active day slot */
  75. extern int new_entry;
  76. extern struct tm olddate;
  77. extern int otherfile, read_only;
  78. extern char *othername, apts_pathname[], orig_apts_pathname[];
  79. extern int orig_ro;
  80. extern char printer[];
  81. extern int show_future;
  82. extern int show_time;
  83. extern int update_interval;
  84. extern struct appt_entry shelf_appt;
  85. extern int day_first;
  86. extern void close_frame();
  87. extern Notify_value leave();
  88.  
  89. int i;
  90.  
  91.  
  92. void
  93. donebutton_notify(item, event)
  94. Panel_item item;
  95. Event *event;
  96. {
  97.     if (event_id(event) == MS_LEFT) {
  98.         /* close to icon */
  99.         close_frame();
  100.     } else
  101.         panel_default_handle_event(item, event);
  102. }
  103.  
  104. void
  105. done_menu_event(item, event)
  106. Panel_item item;
  107. Event *event;
  108. {
  109.     int value;
  110.  
  111.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  112.         value = (int) menu_show(done_menu, panel, event, 0);
  113.         if (value == 1)
  114.             /* close frame */
  115.             close_frame();
  116.         else if (value == 2)
  117.             /* quit tool */
  118.             (void)leave((Notify_client)0, 0, (Notify_signal_mode)0);
  119.     } else
  120.         panel_default_handle_event(item, event);
  121. }
  122.  
  123. void
  124. weekbutton_notify(item, event)
  125. Panel_item item;
  126. Event *event;
  127. {
  128.     if (event_id(event) == MS_LEFT) {
  129.         switch (mainsw_state) {
  130.             case DISPLAYING_DAY:
  131.                 close_day();
  132.                 break;
  133.             case DISPLAYING_WEEK:
  134.                 return;
  135.             case DISPLAYING_MONTH:
  136.                 /* first week in month */
  137.                 current.tm_mday = 1;
  138.                 first_wkday();
  139.                 break;
  140.             case DISPLAYING_YEAR:
  141.                 /* first week in year */
  142.                 current.tm_mday = 1;
  143.                 current.tm_mon = JAN;
  144.                 first_wkday();
  145.                 break;
  146.         }
  147.         mainsw_state = DISPLAYING_WEEK;
  148.         draw_week();
  149.         window_set(canvas, WIN_CURSOR, week_cursor, 0);
  150.     } else
  151.         panel_default_handle_event(item, event);
  152. }
  153.  
  154.  
  155. void
  156. week_menu_event(item, event)
  157. Panel_item item;
  158. Event *event;
  159. {
  160.     int value, i;
  161.     Menu_item an_item;
  162.  
  163.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  164.         if (mainsw_state > DISPLAYING_MONTH) {
  165.             /* make all entries inactive */
  166.             for (i=1; i<=6; i++) {
  167.                 an_item = menu_get(week_menu, MENU_NTH_ITEM, i);
  168.                 menu_set(an_item, MENU_INACTIVE, TRUE, 0);
  169.             }
  170.         } else {
  171.             /* make all entries active */
  172.             for (i=1; i<=6; i++) {
  173.                 an_item = menu_get(week_menu, MENU_NTH_ITEM, i);
  174.                 menu_set(an_item, MENU_INACTIVE, FALSE, 0);
  175.             }
  176.         }
  177.         value = (int) menu_show(week_menu, panel, event, 0);
  178.         if (value > 0) {
  179.             current.tm_mday = (value - 1) * 7 + 1;
  180.             if (current.tm_mday > monthlength(current.tm_mon))
  181.                 current.tm_mday = monthlength(current.tm_mon);
  182.             if (mainsw_state == DISPLAYING_DAY)
  183.                 close_day();
  184.             if (mainsw_state != DISPLAYING_WEEK) {
  185.                 mainsw_state = DISPLAYING_WEEK;
  186.                 window_set(canvas, WIN_CURSOR, week_cursor, 0);
  187.             }
  188.             draw_week();
  189.         }
  190.     } else
  191.         panel_default_handle_event(item, event);
  192. }
  193.  
  194. lastmonth()
  195. {
  196.  
  197.     current.tm_mon -= 1;
  198.     current.tm_mday = 1;
  199.     draw_month();
  200. }
  201.  
  202.  
  203. nextmonth()
  204.     current.tm_mon += 1;
  205.     current.tm_mday = 1;
  206.         draw_month();
  207.  
  208.  
  209. void
  210. monthmenu_notify(item, event)  
  211. Panel_item item;  
  212. Event *event;
  213. {  
  214.     int i, j, new_day;
  215.  
  216.     if (event_id(event) == MS_LEFT) {
  217.         if (mainsw_state == DISPLAYING_YEAR)
  218.             /* go to first month of year */
  219.             current.tm_mon = JAN;
  220.         current.tm_mday = 1;
  221.         if (mainsw_state == DISPLAYING_DAY)
  222.             close_day();
  223.         if (mainsw_state != DISPLAYING_MONTH) {
  224.             mainsw_state = DISPLAYING_MONTH;
  225.             window_set(canvas, WIN_CURSOR, month_cursor, 0);
  226.         }
  227.         draw_month();
  228.     } else
  229.         panel_default_handle_event(item, event);
  230. }
  231.  
  232. void
  233. month_menu_event(item, event)
  234. Panel_item item;
  235. Event *event;
  236. {
  237.     int value;
  238.  
  239.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  240.         value = (int) menu_show(month_menu, panel, event, 0);
  241.         if (value > 0) {
  242.             current.tm_mday = 1;
  243.             current.tm_mon = value - 1;
  244.             if (mainsw_state == DISPLAYING_DAY)
  245.                 close_day();
  246.             if (mainsw_state != DISPLAYING_MONTH) {
  247.                 mainsw_state = DISPLAYING_MONTH;
  248.                 window_set(canvas, WIN_CURSOR, month_cursor, 0);
  249.             }
  250.             draw_month();
  251.         }
  252.     } else
  253.         panel_default_handle_event(item, event);
  254. }
  255.  
  256.  
  257. lastyear()
  258. {
  259.     current.tm_mday = 1;
  260.     current.tm_mon = JAN;
  261.     current.tm_year -= 1;
  262.     draw_year();
  263. }
  264.  
  265. nextyear()
  266. {
  267.     current.tm_mday = 1;
  268.     current.tm_mon = JAN;
  269.     current.tm_year += 1;
  270.     draw_year();
  271. }
  272.  
  273. void
  274. yearmenu_notify(item, event)
  275. Panel_item item;
  276. Event *event;
  277. {
  278.     int old_state;
  279.  
  280.     if (event_id(event) == MS_LEFT) {
  281.         if (mainsw_state == DISPLAYING_DAY) 
  282.             close_day(); 
  283.         old_state = mainsw_state;
  284.         mainsw_state = DISPLAYING_YEAR; 
  285.         draw_year(); 
  286.         if (old_state != DISPLAYING_YEAR)
  287.             window_set(canvas, WIN_CURSOR, year_cursor, 0);
  288.     } else
  289.         panel_default_handle_event(item, event);
  290.  
  291. void
  292. year_menu_event(item, event)
  293. Panel_item item;
  294. Event *event;
  295. {
  296.     int value, old_state;
  297.  
  298.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  299.         value = (int) menu_show(year_menu, panel, event, 0);
  300.         if (value > 0) {
  301.             current.tm_year = START_YEAR + value - 1;
  302.             if (mainsw_state == DISPLAYING_DAY) 
  303.                 close_day(); 
  304.             old_state = mainsw_state;
  305.             mainsw_state = DISPLAYING_YEAR; 
  306.             draw_year(); 
  307.             if (old_state != DISPLAYING_YEAR)
  308.                 window_set(canvas, WIN_CURSOR, year_cursor, 0);
  309.         }
  310.     } else
  311.         panel_default_handle_event(item, event);
  312. }
  313.  
  314.  
  315. lastweek()
  316. {
  317.     if (mainsw_state == DISPLAYING_DAY) {
  318.         close_day();
  319.         current.tm_mday -= 7;
  320.         draw_day();
  321.     } else if (mainsw_state == DISPLAYING_WEEK) {
  322.         current.tm_mday -= 7;
  323.         draw_week();
  324.     }
  325. }
  326.  
  327.  
  328. nextweek()
  329. {
  330.         if (mainsw_state == DISPLAYING_DAY) {
  331.                 close_day();
  332.         current.tm_mday += 7;
  333.                 draw_day();
  334.         } else if (mainsw_state == DISPLAYING_WEEK) {
  335.         current.tm_mday += 7;
  336.                 draw_week();
  337.     }
  338. }
  339.  
  340.  
  341.  
  342. yesterday()
  343. {
  344.     if (mainsw_state != DISPLAYING_DAY)
  345.         return(0);
  346.     close_day();
  347.     current.tm_mday--;
  348.     draw_day();
  349.     return(1);
  350. }
  351.  
  352.  
  353. void
  354. todaybutton_notify(item, event)
  355. Panel_item item;
  356. Event *event;
  357. {
  358.     if (event_id(event) == MS_LEFT) {
  359.         if (mainsw_state == DISPLAYING_DAY)
  360.             close_day();
  361.         else {
  362.             mainsw_state = DISPLAYING_DAY;
  363.             window_set(canvas, WIN_CURSOR, day_cursor, 0);
  364.         }
  365.         get_today();
  366.         current = today;
  367.         draw_day();
  368.     } else
  369.         panel_default_handle_event(item, event);
  370. }
  371.  
  372.  
  373.  
  374. tomorrow()
  375.         if (mainsw_state != DISPLAYING_DAY)
  376.                 return(0);
  377.         close_day(); 
  378.     current.tm_mday++;
  379.         draw_day(); 
  380.     return(1);
  381.  
  382.  
  383. void
  384. currentbutton_notify(item, event)
  385. Panel_item item;
  386. Event *event;
  387. {
  388.     if (event_id(event) == MS_LEFT) {
  389.         if (mainsw_state == DISPLAYING_DAY)
  390.             close_day();
  391.         get_today();
  392.         current = today;
  393.         switch (mainsw_state) {
  394.             case DISPLAYING_DAY:
  395.                 draw_day();
  396.                 break;
  397.             case DISPLAYING_WEEK:
  398.                 draw_week();
  399.                 break;
  400.             case DISPLAYING_MONTH:
  401.                 draw_month();
  402.                 break;
  403.             case DISPLAYING_YEAR:
  404.                 draw_year();
  405.                 break;
  406.         }
  407.     } else
  408.         panel_default_handle_event(item, event);
  409. }
  410.  
  411. void
  412. current_menu_event(item, event)
  413. Panel_item item;
  414. Event *event;
  415. {
  416.     Menu_item an_item;
  417.     char date[9];
  418.     int value, rtn;
  419.     struct tm Save;
  420.  
  421.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  422.         value = (int) menu_show(current_menu, panel, event, 0);
  423.         if (value == 0)
  424.             return;    /* no selection made */
  425.         if (mainsw_state == DISPLAYING_DAY)
  426.             close_day();
  427.         get_today();
  428.         Save = current;
  429.         current = today;
  430.         switch (value) {
  431.             case 1:    /* current day */
  432.                 mainsw_state = DISPLAYING_DAY;
  433.                 window_set(canvas, WIN_CURSOR, day_cursor, 0);
  434.                 draw_day();
  435.                 break;
  436.  
  437.             case 2:    /* current week */
  438.                 mainsw_state = DISPLAYING_WEEK;
  439.                 window_set(canvas, WIN_CURSOR, week_cursor, 0);
  440.                 draw_week();
  441.                 break;
  442.  
  443.             case 3:    /* current month */
  444.                 mainsw_state = DISPLAYING_MONTH;
  445.                 window_set(canvas, WIN_CURSOR, month_cursor, 0);
  446.                 draw_month();
  447.                 break;
  448.  
  449.             case 4:    /* current year */
  450.                 mainsw_state = DISPLAYING_YEAR;
  451.                 window_set(canvas, WIN_CURSOR, year_cursor, 0);
  452.                 draw_year();
  453.                 break;
  454.  
  455.             case 5:    /* change date */
  456.                 if (day_first)
  457.                     sprintf(date, "%d/%d/%02d", Save.tm_mday, Save.tm_mon+1, Save.tm_year);
  458.                 else
  459.                     sprintf(date, "%d/%d/%02d", Save.tm_mon+1, Save.tm_mday, Save.tm_year);
  460.                 panel_set_value(setdate_pi, date);
  461.                 do {
  462.                     window_loop(date_frame);
  463.                     /* change "current" date to reflect entry */
  464.                     rtn = parse_date((char *)panel_get_value(setdate_pi), FALSE);
  465.                 } while (rtn);
  466.                 mainsw_state = DISPLAYING_DAY;
  467.                 window_set(canvas, WIN_CURSOR, day_cursor, 0);
  468.                 draw_day();
  469.                 break;
  470.         }
  471.     } else
  472.         panel_default_handle_event(item, event);
  473. }
  474.  
  475. /*
  476.  * notifier for set date frame "Done" button
  477.  */
  478. void
  479. dtdone_proc(item, event)
  480. Panel_item item;
  481. Event *event;
  482. {
  483.     if (event_id(event) == MS_LEFT)
  484.         window_return(0);
  485. }
  486.  
  487. /* "done" from subframe menu of change date frame */
  488. void
  489. dtframe_done(frame)
  490. Frame frame;
  491. {
  492.     window_set(date_frame, WIN_SHOW, FALSE, 0);
  493. }
  494.  
  495. void
  496. daybutton_notify(item, event)
  497. Panel_item item;
  498. Event *event;
  499. {
  500.     if (event_id(event) == MS_LEFT) {
  501.         switch (mainsw_state) {
  502.             case DISPLAYING_DAY:
  503.                 /* no change */
  504.                 return;
  505.             case DISPLAYING_WEEK:
  506.                 /* pick first day in week */
  507.                 while (current.tm_wday != SUN) {
  508.                     current.tm_mday--;
  509.                     current.tm_wday--;
  510.                 }
  511.                 if (nr_weekdays < 7)
  512.                     /* start with MON */
  513.                     current.tm_mday++;
  514.                 break;
  515.             case DISPLAYING_MONTH:
  516.                 /* pick first day in month */
  517.                 current.tm_mday = 1;
  518.                 first_wkday();
  519.                 break;
  520.             case DISPLAYING_YEAR:
  521.                 /* pick first day in year */
  522.                 current.tm_mon = JAN;
  523.                 current.tm_mday = 1;
  524.                 first_wkday();
  525.                 break;
  526.         }
  527.         mainsw_state = DISPLAYING_DAY;
  528.         draw_day();
  529.         window_set(canvas, WIN_CURSOR, day_cursor, 0);
  530.     } else
  531.         panel_default_handle_event(item, event);
  532. }
  533.  
  534. void
  535. day_menu_event(item, event)
  536. Panel_item item;
  537. Event *event;
  538. {
  539.     int value, i;
  540.     Menu_item an_item;
  541.  
  542.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  543.         if (mainsw_state > DISPLAYING_WEEK) {
  544.             /* make all entries inactive */
  545.             for (i=1; i<=7; i++) {
  546.                 an_item = menu_get(day_menu, MENU_NTH_ITEM, i);
  547.                 menu_set(an_item, MENU_INACTIVE, TRUE, 0);
  548.             }
  549.         } else {
  550.             /* make all entries active */
  551.             for (i=1; i<=7; i++) {
  552.                 an_item = menu_get(day_menu, MENU_NTH_ITEM, i);
  553.                 menu_set(an_item, MENU_INACTIVE, FALSE, 0);
  554.             }
  555.         }
  556.         value = (int) menu_show(day_menu, panel, event, 0);
  557.         if (value > 0) {
  558.             /* find selected day in this week */
  559.             if (monday_first) {
  560.                 ++value;
  561.                 if (value == 7) value = 0;
  562.             }
  563.             if (--value > current.tm_wday)
  564.                 current.tm_mday += value - current.tm_wday;
  565.             else
  566.                 current.tm_mday -= current.tm_wday - value;
  567.             mainsw_state = DISPLAYING_DAY;
  568.             draw_day();
  569.             window_set(canvas, WIN_CURSOR, day_cursor, 0);
  570.         }
  571.     } else
  572.         panel_default_handle_event(item, event);
  573. }
  574.  
  575. first_wkday()
  576. {
  577.     /*
  578.      * Set day to first displayable day of the week selected.
  579.      * If we have a 7-day week display, then it will always
  580.      * be the first day of the month. If we have a 5 or 6 day
  581.      * display, the first day may need to be adjusted to the
  582.      * following monday.
  583.      */
  584.     if (nr_weekdays == 7)
  585.         /* it's ok as is */
  586.         return;
  587.     fix_current_day();    /* update wkday, etc. */
  588.     if (current.tm_wday == SUN)
  589.         current.tm_mday++;
  590.     else if (current.tm_wday > nr_weekdays)
  591.         current.tm_mday += 7 - current.tm_wday + 1;
  592. }
  593.  
  594. void
  595. next_menu_event(item, event)
  596. Panel_item item;
  597. Event *event;
  598. {
  599.     Menu_item an_item;
  600.     int value;
  601.  
  602.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  603.         i = 0;
  604.         while (++i < mainsw_state) {
  605.             an_item = menu_get(next_menu, MENU_NTH_ITEM, i);
  606.             menu_set(an_item, MENU_INACTIVE, TRUE, 0);
  607.         }
  608.         for (i=mainsw_state; i<=DISPLAYING_YEAR; i++) {
  609.             an_item = menu_get(next_menu, MENU_NTH_ITEM, i);
  610.             menu_set(an_item, MENU_INACTIVE, FALSE, 0);
  611.         }
  612.         value = (int) menu_show(next_menu, panel, event, 0);
  613.         if (value == 0)
  614.             return;    /* no selection made */
  615.         value--;
  616.         switch (mainsw_state) {
  617.             case DISPLAYING_DAY:
  618.                 switch (value) {
  619.                     case 0:    /* day */
  620.                         tomorrow();
  621.                         break;
  622.                     case 1: /* week */
  623.                         close_day();
  624.                         current.tm_mday += 7;
  625.                         draw_day();
  626.                         break;
  627.                     case 2:    /* month */
  628.                         close_day();
  629.                         current.tm_mon++;
  630.                         /* make sure day ends up in proper month */
  631.                         if (current.tm_mday == monthlength(current.tm_mon-1))
  632.                             /* last day of month */
  633.                             current.tm_mday = monthlength(current.tm_mon%12);
  634.                         else if (current.tm_mday > monthlength(current.tm_mon%12))
  635.                             current.tm_mday = monthlength(current.tm_mon%12);
  636.                         draw_day();
  637.                         break;
  638.                     case 3: /* year */
  639.                         close_day();
  640.                         current.tm_year++;
  641.                         draw_day();
  642.                         break;
  643.                 }
  644.                 break;
  645.             case DISPLAYING_WEEK:
  646.                 switch (value) {
  647.                     case 1:    /* week */
  648.                         nextweek();
  649.                         break;
  650.                     case 2:    /* month */
  651.                         current.tm_mon++;
  652.                         draw_week();
  653.                         break;
  654.                     case 3:    /* year */
  655.                         current.tm_year++;
  656.                         draw_week();
  657.                         break;
  658.                 }
  659.                 break;
  660.             case DISPLAYING_MONTH:
  661.                 switch (value) {
  662.                     case 2: /* month */
  663.                         nextmonth();
  664.                         break;
  665.                     case 3:    /* year */
  666.                         current.tm_year++;
  667.                         draw_month();
  668.                         break;
  669.                 }
  670.                 break;
  671.             case DISPLAYING_YEAR:
  672.                 if (value == 3)
  673.                     nextyear();
  674.                 break;
  675.         }
  676.     } else
  677.         panel_default_handle_event(item, event);
  678. }
  679.  
  680. void
  681. nextbutton_notify(item, event) 
  682. Panel_item item; 
  683. Event *event; 
  684.     if (event_id(event) == MS_LEFT) {
  685.         switch (mainsw_state) {
  686.             case DISPLAYING_DAY:
  687.                 tomorrow();
  688.                 break;
  689.             case DISPLAYING_WEEK:
  690.                 nextweek();
  691.                 break;
  692.             case DISPLAYING_MONTH:
  693.                 nextmonth();
  694.                 break;
  695.             case DISPLAYING_YEAR:
  696.                 nextyear();
  697.                 break;
  698.         }
  699.     } else
  700.         panel_default_handle_event(item, event);
  701. }
  702.  
  703. void
  704. previous_menu_event(item, event)
  705. Panel_item item;
  706. Event *event;
  707. {
  708.     Menu_item an_item;
  709.     int value;
  710.  
  711.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  712.         i = 0;
  713.         while (++i < mainsw_state) {
  714.             an_item = menu_get(previous_menu, MENU_NTH_ITEM, i);
  715.             menu_set(an_item, MENU_INACTIVE, TRUE, 0);
  716.         }
  717.         for (i=mainsw_state; i<=DISPLAYING_YEAR; i++) {
  718.             an_item = menu_get(previous_menu, MENU_NTH_ITEM, i);
  719.             menu_set(an_item, MENU_INACTIVE, FALSE, 0);
  720.         }
  721.         value = (int) menu_show(previous_menu, panel, event, 0);
  722.         if (value == 0)
  723.             return;    /* no selection made */
  724.         value--;
  725.         switch (mainsw_state) {
  726.             case DISPLAYING_DAY:
  727.                 switch (value) {
  728.                     case 0:    /* day */
  729.                         yesterday();
  730.                         break;
  731.                     case 1: /* week */
  732.                         close_day();
  733.                         current.tm_mday -= 7;
  734.                         draw_day();
  735.                         break;
  736.                     case 2:    /* month */
  737.                         close_day();
  738.                         current.tm_mon--;
  739.                         /* make sure day ends up in proper month */
  740.                         if (current.tm_mday == monthlength(current.tm_mon+1))
  741.                             /* last day of month */
  742.                             current.tm_mday = monthlength((current.tm_mon+12)%12);
  743.                         else if (current.tm_mday > monthlength((current.tm_mon+12)%12))
  744.                             current.tm_mday = monthlength((current.tm_mon+12)%12);
  745.                         draw_day();
  746.                         break;
  747.                     case 3: /* year */
  748.                         close_day();
  749.                         current.tm_year--;
  750.                         draw_day();
  751.                         break;
  752.                 }
  753.                 break;
  754.             case DISPLAYING_WEEK:
  755.                 switch (value) {
  756.                     case 1:    /* week */
  757.                         lastweek();
  758.                         break;
  759.                     case 2:    /* month */
  760.                         current.tm_mon--;
  761.                         draw_week();
  762.                         break;
  763.                     case 3:    /* year */
  764.                         current.tm_year--;
  765.                         draw_week();
  766.                         break;
  767.                 }
  768.                 break;
  769.             case DISPLAYING_MONTH:
  770.                 switch (value) {
  771.                     case 2: /* month */
  772.                         lastmonth();
  773.                         break;
  774.                     case 3:    /* year */
  775.                         current.tm_year--;
  776.                         draw_month();
  777.                         break;
  778.                 }
  779.                 break;
  780.             case DISPLAYING_YEAR:
  781.                 if (value == 3)
  782.                     lastyear();
  783.                 break;
  784.         }
  785.     } else {
  786.         panel_default_handle_event(item, event);
  787.     }
  788. }
  789.  
  790. void
  791. previous_menu_notify(item, event)
  792. Panel_item item; 
  793. Event *event; 
  794.     if (event_id(event) == MS_LEFT) {
  795.         switch (mainsw_state) {
  796.             case DISPLAYING_DAY:
  797.                 yesterday();
  798.                 break;
  799.             case DISPLAYING_WEEK:
  800.                 lastweek();
  801.                 break;
  802.             case DISPLAYING_MONTH:
  803.                 lastmonth();
  804.                 break;
  805.             case DISPLAYING_YEAR:
  806.                 lastyear();
  807.                 break;
  808.         }
  809.     } else
  810.         panel_default_handle_event(item, event);
  811. }
  812.  
  813. #ifndef NO_SUN_MOON
  814. void
  815. moonbutton_notify(item, event) 
  816. Panel_item item; 
  817. Event *event; 
  818.     if (event_id(event) == MS_LEFT) {
  819.         /* display popup frame with moon data */
  820.         moon_data_frame();
  821.         panel_set(moonbutton_pi, PANEL_SHOW_ITEM, FALSE, 0);
  822.     } else
  823.         panel_default_handle_event(item, event);
  824. }
  825.  
  826. void
  827. sunbutton_notify(item, event) 
  828. Panel_item item; 
  829. Event *event; 
  830.     if (event_id(event) == MS_LEFT) {
  831.         /* display popup frame with moon data */
  832.         sun_data_frame();
  833.         panel_set(sunbutton_pi, PANEL_SHOW_ITEM, FALSE, 0);
  834.     } else
  835.         panel_default_handle_event(item, event);
  836. }
  837. #endif
  838.  
  839. Notify_value
  840. myframe_interposer(client, event, arg, type)
  841. Notify_client client;
  842. Event *event;
  843. Notify_arg arg;
  844. Notify_event_type type;
  845. {
  846.     static int start_up = 1;
  847.     int closed_initial, closed_current;
  848.     Notify_value value;
  849.     void sframe_done(), mframe_done();
  850.  
  851.     /* get initial state */
  852.     closed_initial = (int)window_get(frame, FRAME_CLOSED);
  853.     /* let the frame do its thing */
  854.     value = notify_next_event_func(client, event, arg, type);
  855.     /* get new state */
  856.     closed_current = (int)window_get(frame, FRAME_CLOSED);
  857.     if (start_up) {
  858.         /* first time thru */
  859.         start_up = 0;
  860.         if (closed_initial)
  861.             /* starting up iconic */
  862.             olddate = current;
  863.         else
  864.             /* starting up open */
  865.             if (mainsw_state == DISPLAYING_DAY)
  866.                 /* create future appt popup */
  867.                 draw_future_appts();
  868.     } else if (closed_current != closed_initial) {
  869.         /* it changed state - either opened or closed */
  870.         if (closed_current) {
  871.             /* frame just closed */
  872.             close_frame();
  873.         } else {
  874.             /* frame just opened */
  875.             /*
  876.              * redraw display in case the "today" changed
  877.              * and a different day needs to be highlighted
  878.              */
  879.             if (day_is_open)
  880.                 close_day();
  881.             current = olddate;
  882.             switch (mainsw_state) {
  883.                 case DISPLAYING_DAY:
  884.                     draw_day1();
  885.                     /* create future popup next time thru */
  886.                     start_up = 1;
  887.                     break;
  888.                 case DISPLAYING_WEEK:
  889.                     draw_week();
  890.                     break;
  891.                 case DISPLAYING_MONTH:
  892.                     draw_month();
  893.                     break;
  894.                 case DISPLAYING_YEAR:
  895.                     draw_year();
  896.                     break;
  897.             }
  898.         }
  899.     }
  900.  
  901.     return(NOTIFY_DONE);
  902. }
  903.  
  904. /*
  905.  * notifier for "Done" button in the popup future appt frame
  906.  */
  907. void
  908. fdone_proc(item, event)
  909. Panel_item item;
  910. Event *event;
  911. {
  912.     if (event_id(event) == MS_LEFT) {
  913.         window_destroy(fframe);
  914.         fframe = 0;
  915.         show_future = 0;
  916.     }
  917. }
  918.  
  919. /*
  920.  * notifier for "Keep" button in the popup future appt frame
  921.  */
  922. void
  923. fkeep_proc(item, event)
  924. Panel_item item;
  925. Event *event;
  926. {
  927.     if (event_id(event) == MS_LEFT) {
  928.         window_destroy(fframe);
  929.         fframe = 0;
  930.     }
  931. }
  932.  
  933. /*
  934.  * Notifier for future appts. We get here when the user
  935.  * selects one of the displayed messages. When this happens,
  936.  * the day display for the selected future appt is displayed.
  937.  */
  938. void
  939. fappt_notify(item, event)
  940. Panel_item item;
  941. Event *event;
  942. {
  943.     int value;
  944.  
  945.     if (event_id(event) != MS_LEFT)
  946.         return;
  947.     
  948.     value = (int)panel_get(item, PANEL_CLIENT_DATA);
  949.     /* set current date to match the selected appt */
  950.     current.tm_year = future[value].year;
  951.     current.tm_mon = future[value].month;
  952.     current.tm_mday = future[value].day;
  953.     fix_current_day();
  954.  
  955.     /* draw new day page */
  956.     draw_day();
  957. }
  958.  
  959. /*
  960.  * Notify routine for everyx panel item in the attributes
  961.  * popup window. In this routine, we only care about the state
  962.  * of the "Selected Week" choice, which determines which panel
  963.  * item is displayed.
  964.  */
  965. void
  966. everyx_notify(item, event)
  967. Panel_item item;
  968. Event *event;
  969. {
  970.     int value;
  971.  
  972.     value = (int) panel_get_value(everyx_pi);
  973.     if (value & 0x4) {
  974.         if (value & 0x3) {
  975.             /* not allowed for ALL_DAYS or EVERY_MON_FRI */
  976.             value &= ~0x4;
  977.             panel_set_value(everyx_pi, value);
  978.         } else {
  979.             panel_set(repeat_pi, PANEL_SHOW_ITEM, FALSE, 0);
  980.             panel_set(whichwk_pi, PANEL_SHOW_ITEM, TRUE, 0);
  981.         }
  982.     } else {
  983.         panel_set(whichwk_pi, PANEL_SHOW_ITEM, FALSE, 0);
  984.         panel_set(repeat_pi, PANEL_SHOW_ITEM, TRUE, 0);
  985.     }
  986. }
  987.  
  988. /*
  989.  * Notify routine for the appointment attributes popup window.
  990.  * Since each panel item does not have its own notify routine,
  991.  * we check the current state of everything when the user
  992.  * selects the accept button and set the slot flags appropriately.
  993.  */
  994. void
  995. attr_accept(item, event)
  996. Panel_item item;
  997. Event *event;
  998. {
  999.     int value, flag = 0, repeat = 0;
  1000.     int oflag;
  1001.     struct appt_entry *apt = slots[attr_bi].cur_appt;
  1002.  
  1003.     if (event_id(event) != MS_LEFT)
  1004.         return;  /* ignore everything else */
  1005.     
  1006.     oflag = apt->flags;
  1007.  
  1008.     /* get the everyx value (every day, week, month, year) */
  1009.     value = (int) panel_get_value(everyx_pi);
  1010.     /* value is bitmap of selected choices */
  1011.     /* EVERY_MON_FRI and ALL_DAYS are mutually exclusive */
  1012.     if (value & 0x1)
  1013.         flag |= EVERY_MON_FRI;
  1014.     else if (value & 0x2)
  1015.         flag |= ALL_DAYS;
  1016.     else if (oflag & (EVERY_MON_FRI|ALL_DAYS))
  1017.         apt->day = current.tm_mday;
  1018.     if (value & 0x4)
  1019.         flag |= Setday(current.tm_wday);
  1020.     else if (oflag & EVERY_SOMEDAY)
  1021.         apt->day = current.tm_mday;
  1022.     if (value & 0x8)
  1023.         flag |= ALL_MONTHS;
  1024.     else if (oflag & ALL_MONTHS)
  1025.         apt->month = current.tm_mon;
  1026.     if (value & 0x10)
  1027.         flag |= ALL_YEARS;
  1028.     else if (oflag & ALL_YEARS)
  1029.         apt->year = current.tm_year;
  1030.     
  1031.     if (value & 0x4) {
  1032.         /* repeat at week intervals selected by which week pi */
  1033.         value = (int) panel_get_value(whichwk_pi);
  1034.         if (value == 0 || value == 0x40)
  1035.             /* ALL selected or no selection */
  1036.             value = ALL_WEEKS;
  1037.         flag |= REPEAT;
  1038.         repeat = value;
  1039.     } else {
  1040.         /* get repeat interval */
  1041.         value = atoi((char *)panel_get_value(repeat_pi));
  1042.         if (value > 0) {
  1043.             flag |= REPEAT;
  1044.             repeat = value;
  1045.         }
  1046.     }
  1047.  
  1048.     /* get lookahead value */
  1049.     value = atoi((char *)panel_get_value(remind_pi));
  1050.     if (value > 0) {
  1051.         flag |= LOOKAHEAD;
  1052.         if (apt->lookahead != value) {
  1053.             new_entry = 1;
  1054.             apt->lookahead = value;
  1055.         }
  1056.     }
  1057.  
  1058.     /* get runlength value */
  1059.     value = atoi((char *)panel_get_value(runl_pi));
  1060.     if (value > 0) {
  1061.         flag |= RUN;
  1062.         if (apt->runlength != value) {
  1063.             new_entry = 1;
  1064.             apt->runlength = value;
  1065.         }
  1066.     }
  1067.  
  1068.     /* get advance warning value */
  1069.     value = atoi((char *)panel_get_value(advw_pi));
  1070.     if (apt->warn != value) {
  1071.         new_entry = 1;
  1072.         apt->warn = value;
  1073.     }
  1074.  
  1075.     if (oflag & A_NOTE) {
  1076.         flag |= A_NOTE;
  1077.         /* marked indicator */
  1078.         value = (int) panel_get_value(marked_pi);
  1079.         if (value == 1)
  1080.             flag |= MARKED;  /* don't show in month/yr display */
  1081.     }
  1082.     /* shouldn't really be in this routine if the appt
  1083.      * was read only, however, this is still here for potential
  1084.      * future use.
  1085.      */
  1086.     if (oflag & READONLY)
  1087.         flag |= READONLY;
  1088.  
  1089.     if (apt->repeat != repeat || oflag != flag)
  1090.         new_entry = 1;    /* something changed */
  1091.  
  1092.     /* set the slot info */
  1093.     apt->repeat = repeat;
  1094.     apt->flags = flag;
  1095.  
  1096.     window_return(0);
  1097. }
  1098.  
  1099. /*
  1100.  * abort the attribute setting process, leaving the current
  1101.  * appointment unmodified.
  1102.  */
  1103. void
  1104. attr_abort(item, event)
  1105. Panel_item item;
  1106. Event *event;
  1107. {
  1108.     if (event_id(event) == MS_LEFT)
  1109.         window_return(0);
  1110. }
  1111.  
  1112. /*
  1113.  * Notify routine for the delete mode popup window.
  1114.  * Since the panel item does not have its own notify routine,
  1115.  * we check the current state when the user
  1116.  * selects the done button and set the slot flags appropriately.
  1117.  */
  1118. void
  1119. del_done(item, event)
  1120. Panel_item item;
  1121. Event *event;
  1122. {
  1123.     int value;
  1124.     struct appt_entry tmp;
  1125.  
  1126.     if (event_id(event) != MS_LEFT)
  1127.         return;  /* ignore everything else */
  1128.     
  1129.     value = (int) panel_get_value(del_choice_pi);
  1130.     if (value == 0) {
  1131.         /* don't show it today */
  1132.         /* create duplicate entry with delete flag set */
  1133.         tmp = *slots[attr_bi].cur_appt;
  1134.         tmp.flags &= ~(ALL_YEARS|ALL_MONTHS|ALL_DAYS|EVERY_SOMEDAY|REPEAT|EVERY_MON_FRI|RUN);
  1135.         tmp.flags |= DELETED;
  1136.         tmp.year = current.tm_year;
  1137.         tmp.month = current.tm_mon;
  1138.         tmp.day = current.tm_mday;
  1139.         add_to_slot(attr_bi, &tmp, TRUE);
  1140.         /* in the case of "cut", modify the shelf appt */
  1141.         if ((int)panel_get(del_choice_pi, PANEL_CLIENT_DATA)) {
  1142.             shelf_appt.flags &= ~(ALL_YEARS|ALL_MONTHS|ALL_DAYS|EVERY_SOMEDAY|REPEAT|EVERY_MON_FRI|RUN);
  1143.             shelf_appt.year = current.tm_year;
  1144.             shelf_appt.month = current.tm_mon;
  1145.             shelf_appt.day = current.tm_mday;
  1146.         }
  1147.     } else {
  1148.         /* completely kill appt */
  1149.         cut_delete(attr_bi);
  1150.     }
  1151.     new_entry = 1;
  1152.  
  1153.     window_return(0);
  1154. }
  1155.  
  1156. #ifndef NO_SUN_MOON
  1157. /*
  1158.  * notifier for "Done" button in the popup sun data frame
  1159.  */
  1160. void
  1161. sdone_proc(item, event)
  1162. Panel_item item;
  1163. Event *event;
  1164. {
  1165.     if (event_id(event) == MS_LEFT) {
  1166.         window_destroy(sframe);
  1167.         sframe = 0;
  1168.         panel_set(sunbutton_pi, PANEL_SHOW_ITEM, TRUE, 0);
  1169.     }
  1170. }
  1171.  
  1172. /*
  1173.  * notifier for "Done" button in the popup moon data frame
  1174.  */
  1175. void
  1176. mdone_proc(item, event)
  1177. Panel_item item;
  1178. Event *event;
  1179. {
  1180.     if (event_id(event) == MS_LEFT) {
  1181.         window_destroy(mframe);
  1182.         mframe = 0;
  1183.         panel_set(moonbutton_pi, PANEL_SHOW_ITEM, TRUE, 0);
  1184.     }
  1185. }
  1186.  
  1187. /* "done" from subframe menu */
  1188. void
  1189. sframe_done(frame)
  1190. Frame frame;
  1191. {
  1192.     window_destroy(sframe);
  1193.     sframe = 0;
  1194.     panel_set(sunbutton_pi, PANEL_SHOW_ITEM, TRUE, 0);
  1195. }
  1196.  
  1197. /* "done" from subframe menu */
  1198. void
  1199. mframe_done(frame)
  1200. Frame frame;
  1201. {
  1202.     window_destroy(mframe);
  1203.     mframe = 0;
  1204.     panel_set(moonbutton_pi, PANEL_SHOW_ITEM, TRUE, 0);
  1205. }
  1206. #endif    /* NO_SUN_MOON */
  1207.  
  1208. /*
  1209.  * notifier for file button in main control panel
  1210.  */
  1211. void
  1212. filebutton_notify(item, event)
  1213. Panel_item item;
  1214. Event *event;
  1215. {
  1216.     if (event_id(event) == MS_LEFT) {
  1217.         panel_set_value(filename_pi, apts_pathname);
  1218.         panel_set_value(file_ro_pi, (read_only ? 0 : 1));
  1219.         window_set(fileframe, WIN_SHOW, TRUE, 0);
  1220.     } else
  1221.         panel_default_handle_event(item, event);
  1222. }
  1223.  
  1224. /*
  1225.  * notifier for "Done" button in the popup file frame
  1226.  */
  1227. void
  1228. file_done(item, event)
  1229. Panel_item item;
  1230. Event *event;
  1231. {
  1232.     if (event_id(event) == MS_LEFT)
  1233.         window_set(fileframe, WIN_SHOW, FALSE, 0);
  1234. }
  1235.  
  1236. /*
  1237.  * notifier for "Accept" button in the popup file frame
  1238.  */
  1239. void
  1240. file_accept(item, event)
  1241. Panel_item item;
  1242. Event *event;
  1243. {
  1244.     char save_name[160];
  1245.     int save_ro;
  1246.     struct tm save_date;
  1247.  
  1248.     if (event_id(event) == MS_LEFT) {
  1249.             save_date = current;
  1250.         /* cleanup existing appts file and open new one */
  1251.         strcpy(save_name, apts_pathname);
  1252.         save_ro = read_only;
  1253.         cleanup();
  1254.         othername = (char *)panel_get_value(filename_pi);
  1255.         otherfile = 1;
  1256.         read_only = ((int)panel_get_value(file_ro_pi) == 0 ? 1 : 0);
  1257.         if (do_files(TRUE)) {
  1258.             /* error in opening new file - restore old */
  1259.             othername = save_name;
  1260.             read_only = save_ro;
  1261.             if (do_files(TRUE))
  1262.                 /* can't restore original */
  1263.                 err_rpt("can't restore appts file", FATAL);
  1264.         } else {
  1265.             /* read_only may have been changed by do_files() */
  1266.             panel_set_value(file_ro_pi, (read_only ? 0 : 1));
  1267.                     current = save_date;
  1268.             switch(mainsw_state) {
  1269.                 case DISPLAYING_DAY:
  1270.                     draw_day();
  1271.                     break;
  1272.                 case DISPLAYING_WEEK:
  1273.                     draw_week();
  1274.                     break;
  1275.                 case DISPLAYING_MONTH:
  1276.                     draw_month();
  1277.                     break;
  1278.                 case DISPLAYING_YEAR:
  1279.                     draw_year();
  1280.                     break;
  1281.             }
  1282.         }
  1283.     }
  1284. }
  1285.  
  1286. /*
  1287.  * notifier for "Reset" button in the popup file frame
  1288.  */
  1289. void
  1290. file_reset(item, event)
  1291. Panel_item item;
  1292. Event *event;
  1293. {
  1294.     if (event_id(event) == MS_LEFT)
  1295.         panel_set_value(filename_pi, apts_pathname);
  1296. }
  1297.  
  1298. /*
  1299.  * notifier for "Save" button in the popup file frame
  1300.  */
  1301. void
  1302. file_save(item, event)
  1303. Panel_item item;
  1304. Event *event;
  1305. {
  1306.     if (event_id(event) == MS_LEFT) {
  1307.         othername = (char *)panel_get_value(filename_pi);
  1308.         if (!strcmp(othername, apts_pathname)) {
  1309.             /* no filename change */
  1310.             if (mainsw_state == DISPLAYING_DAY && day_is_open)
  1311.                 close_day();
  1312.         }
  1313.     }
  1314. }
  1315.  
  1316. /*
  1317.  * notifier for "Original" button in the popup file frame
  1318.  */
  1319. void
  1320. file_orig(item, event)
  1321. Panel_item item;
  1322. Event *event;
  1323. {
  1324.     if (event_id(event) == MS_LEFT) {
  1325.         panel_set_value(filename_pi, orig_apts_pathname);
  1326.         panel_set_value(file_ro_pi, (orig_ro ? 0 : 1));
  1327.         /* force an Accept button event */
  1328.         file_accept(item, event);
  1329.     }
  1330. }
  1331.  
  1332. /*
  1333.  * "Done" from subframe menu of the file selection popup frame
  1334.  */
  1335. void
  1336. fileframe_done(frame)
  1337. Frame frame;
  1338. {
  1339.     window_set(fileframe, WIN_SHOW, FALSE, 0);
  1340. }
  1341.  
  1342. /*
  1343.  * notifier for prompt frame "No" button
  1344.  */
  1345. void
  1346. prompt_no_notify(item, event)
  1347. Panel_item item;
  1348. Event *event;
  1349. {
  1350.     if (event_id(event) == MS_LEFT)
  1351.         window_return(1);
  1352. }
  1353.  
  1354. /*
  1355.  * notifier for prompt frame "Yes" or "Ok" button
  1356.  */
  1357. void
  1358. prompt_yes_notify(item, event)
  1359. Panel_item item;
  1360. Event *event;
  1361. {
  1362.     if (event_id(event) == MS_LEFT)
  1363.         window_return(0);
  1364. }
  1365.  
  1366. #ifndef NO_PRINTER
  1367. /*
  1368.  * notifier for "Print" button in main control panel
  1369.  */
  1370. void
  1371. printbutton_notify(item, event)
  1372. Panel_item item;
  1373. Event *event;
  1374. {
  1375.     int prt_fmt;
  1376.  
  1377.     if (event_id(event) == MS_LEFT) {
  1378. #ifdef RASTER_ONLY
  1379.         /* default to printing a raster file */
  1380.         print_calendar(PR_RASTER);
  1381. #else
  1382.         /* default to printing a postscript file */
  1383.         print_calendar(PR_POSTSCRIPT);
  1384. #endif
  1385.     } else if (event_id(event) == MS_RIGHT) {
  1386.         /* print selected format */
  1387.         if ((prt_fmt = (int) panel_get(item, PANEL_CLIENT_DATA)) <= 2)
  1388.             print_calendar(prt_fmt);
  1389.     } else
  1390.         panel_default_handle_event(item, event);
  1391. }
  1392.  
  1393. void
  1394. print_menu_event(item, event)
  1395. Panel_item item;
  1396. Event *event;
  1397. {
  1398.     int value;
  1399. #ifdef RASTER_ONLY
  1400.     Menu_item an_item;
  1401. #endif
  1402.  
  1403.     if (event_id(event) == MS_RIGHT && event_is_down(event)) {
  1404. #ifdef RASTER_ONLY
  1405.         an_item = menu_get(print_menu, MENU_NTH_ITEM, PR_POSTSCRIPT);
  1406.         menu_set(an_item, MENU_INACTIVE, TRUE, 0);
  1407. #endif
  1408.         value = (int) menu_show(print_menu, panel, event, 0);
  1409.         if (value > 0) {
  1410.             panel_set(item, PANEL_CLIENT_DATA, value, 0);
  1411.             if (value == 3) {
  1412.                 /* change printer */
  1413.                 panel_set_value(prfile_pi, print_to_file);
  1414.                 panel_set_value(prcmd_pi, printer);
  1415.                 window_set(prframe, WIN_SHOW, TRUE, 0);
  1416.             } else {
  1417.                 panel_begin_preview(item, event);
  1418.                 panel_accept_preview(item, event);
  1419.             }
  1420.         }
  1421.     } else
  1422.         panel_default_handle_event(item, event);
  1423. }
  1424.  
  1425. void
  1426. prdone_proc(item, event)
  1427. Panel_item item;
  1428. Event *event;
  1429. {
  1430.     char *newstr;
  1431.     /**
  1432.     int status = 0;
  1433.     **/
  1434.  
  1435.     if (event_id(event) == MS_LEFT) {
  1436.         newstr = (char *) panel_get_value(prcmd_pi);
  1437.         print_to_file = (int) panel_get_value(prfile_pi);
  1438.         window_set(prframe, WIN_SHOW, FALSE, 0);
  1439.         if (strcmp(printer, newstr)) {
  1440.             /* the string changed */
  1441.             strcpy(printer, newstr);
  1442.             /******
  1443.              * writing to the defaults file doesn't work.
  1444.              *
  1445.              * create_prompt_frame("Printer changed - overwrite .defaults entry?", TRUE);
  1446.              * if (!window_loop(prompt_frame))
  1447.              *     defaults_set_string("/CalenTool/Printer", printer, &status);
  1448.              *****/
  1449.         }
  1450.     }
  1451. }
  1452.  
  1453. void
  1454. prframe_done(frame)
  1455. Frame frame;
  1456. {
  1457.     /* mark as no change */
  1458.     window_set(prframe, WIN_SHOW, FALSE, 0);
  1459. }
  1460. #endif    /* NO_PRINTER */
  1461.