home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / sun / volume1 / calentool / part02 / ct.h < prev   
Encoding:
C/C++ Source or Header  |  1989-05-27  |  6.8 KB  |  255 lines

  1. /*
  2.  * $Header: ct.h,v 2.1 89/05/09 14:25:13 billr Exp $
  3.  */
  4. /*
  5.  * ct.h - header file for calentool
  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 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. /* directory for date/event files */
  26. #ifndef DATELIB_DIR
  27. #    define DATELIB_DIR    "/usr/local/lib/calentool"
  28. #endif
  29.  
  30. #ifndef NOPRINTER
  31. /* command string for sending a file to the Postscript printer */
  32. #    ifndef PRINT_CMD
  33. #        define PRINT_CMD    "lpr -Plw"
  34. #    endif
  35.  
  36. /*#    define RASTER_ONLY    /* define this if no Postscript printer available */
  37. #endif
  38.  
  39. /* define NR_WEEKDAYS for desired week display */
  40. /* NR_WEEKDAYS        display   */
  41. /*    5        Mon-Fri   */
  42. /*    6        Mon-Sat      */
  43. /*    7        Sun-Sat      */
  44. /**/
  45. #ifndef NR_WEEKDAYS
  46. #    define NR_WEEKDAYS    5
  47. #endif
  48.  
  49. #ifndef START_HOUR
  50. #    define START_HOUR    8    /* 8am */
  51. #endif                    /*  to */
  52. #ifndef END_HOUR
  53. #    define END_HOUR        18    /* 6pm */
  54. #endif
  55.  
  56. #ifndef START_YEAR
  57. #    define START_YEAR    89
  58. #endif
  59. #ifndef NR_YEARS
  60. #    define NR_YEARS        5    /* number of years in menu */
  61. #endif
  62.  
  63. #ifndef UPDATE_RATE
  64. #    define UPDATE_RATE    "second"    /* update time */
  65. #endif                     /* options are "second" & "minute" */
  66. #define TIME_OUT    5        /* check appts every 5 minutes */
  67.  
  68. /*
  69.  * If calentool is too big and you want a stripped-down version
  70.  * define some or all of these here or in the Makefile. Combined,
  71.  * they save ~100K bytes.
  72.  */
  73. /*#define NO_PRINTER        /* exclude printer support code */
  74. /*#define NO_HOLIDAYS        /* exclude holiday checking code */
  75. /*#define NO_SUN_MOON        /* exclude Sun/Moon data frames */
  76.  
  77. /*********************************************************************/
  78. /* Nothing below here should need to be changed (typically)          */
  79. /*********************************************************************/
  80.  
  81. #ifndef TRUE
  82. #    define TRUE    1
  83. #endif
  84. #ifndef FALSE
  85. #    define FALSE    0
  86. #endif
  87.  
  88. #ifndef N_TSLOTS
  89. #    define N_TSLOTS        ((END_HOUR-START_HOUR)*2)    /* Number of 30-minute slots in a day. */
  90. #endif
  91. #define N_SLOTS        (N_TSLOTS+10)    /* Total number of slots on a day page. */
  92. #define MAX_FUTURE_ENTRIES    32    /* number of appts displayed in popup window */
  93.  
  94. /*
  95.  * APPT_CHECK_LIMIT is typically either "n_tslots"
  96.  * or "N_SLOTS" depending on whether we include the
  97.  * notes section when indicating that we still have
  98.  * appts today.
  99.  */
  100. #ifndef APPT_CHECK_LIMIT
  101. #    define APPT_CHECK_LIMIT    n_tslots
  102. #endif
  103.  
  104. /* Dimensions of 30-minute week slot.
  105.  * Message size determines width - everything else keyed
  106.  * off font size and message size
  107.  */
  108. #define WEEK_MESSAGE_SIZE    12
  109.  
  110. #define DISPLAYING_DAY          1       /* Defs for state of main */
  111. #define DISPLAYING_WEEK         2    /* subwindow (mainsw_state) */
  112. #define DISPLAYING_MONTH        3
  113. #define DISPLAYING_YEAR         4
  114.  
  115. #define BACKSPACE               8    /* editing chars */
  116. #define CTRL_R                  18
  117. #define CTRL_U                  21
  118. #define CTRL_W                  23
  119. #define DEL                     127
  120.  
  121. #define NONE            0
  122. #define DAY            1    /* Defs for "selected_type" (type of */
  123. #define WEEK            2    /* object selected by month click). */
  124. #define MONTH            3
  125.  
  126. #define INACTIVE        0    /* Defs for "active" field of timeslot. */
  127. #define ARROW_SHAFT        1
  128. #define ARROW_HEAD        2
  129. #define ACTIVE            4
  130.  
  131. #define JUSTIFY_LEFT    0        /* text justification in day slot */
  132. #define JUSTIFY_RIGHT    1
  133. #define JUSTIFY_INDEX    2
  134.  
  135. #define FOUND_SLOT    1        /* event tags for day display */
  136. #define FOUND_MORE    2
  137. #define FOUND_LARROW    3
  138. #define FOUND_RARROW    4
  139.  
  140. #define MMODIFY        1        /* order of entries in day menu */
  141. #define MCUT        2
  142. #define MPASTE        3
  143. #define MCOPY        4
  144. #define MDELETE        5
  145. #define MUNDELETE    6
  146.  
  147. #define PR_POSTSCRIPT    1        /* print options */
  148. #define PR_RASTER    2
  149.  
  150. #define SUN        0        /* days of the week */
  151. #define MON        1
  152. #define TUE        2
  153. #define WED        3
  154. #define THU        4
  155. #define FRI        5
  156. #define SAT        6
  157.  
  158. #define JAN        0        /* selected months */
  159. #define FEB        1
  160. #define DEC        11
  161.  
  162. #define ALL_YEARS    0x1        /* flags for special case appts */
  163. #define ALL_MONTHS    0x2
  164. #define ALL_DAYS    0x4
  165. #define REPEAT        0x8
  166. #define A_COMMENT    0x10
  167. #define EVERY_SUN    0x20
  168. #define EVERY_MON    0x40
  169. #define EVERY_TUE    0x60
  170. #define EVERY_WED    0x80
  171. #define EVERY_THU    0xa0
  172. #define EVERY_FRI    0xc0
  173. #define EVERY_SAT    0xe0
  174. #define    EVERY_SOMEDAY    0xe0
  175.     /* convert flag value to day-of-week number */
  176. #    define Pickday(d)    ((((d)&EVERY_SOMEDAY)>>5)-1)    
  177.     /* convert day of week to flag value */
  178. #    define Setday(d)    (((d)+1)<<5)
  179. #define LOOKAHEAD    0x100
  180. #define READONLY    0x200
  181. #define A_NOTE        0x400
  182. #define MARKED        0x800    /* don't show in month/year display */
  183. #define MARKED_NOTE    0xc00
  184. #define DELETED        0x1000    /* don't show the appt that matches this */
  185.  
  186. /* format of repeat field for every_someday type appts */
  187. #define WEEK1        0x1
  188. #define WEEK2        0x2
  189. #define WEEK3        0x4
  190. #define WEEK4        0x8
  191. #define WEEK5        0x10
  192. #define ALL_WEEKS    0x1f
  193. #define LAST_WEEK    0x20
  194. #define WEEK_LIMIT    0x3f
  195.  
  196. /* error reporting flags */
  197. #define NON_FATAL    0
  198. #define FATAL        1
  199.  
  200. #define STD_ICON    0        /* flags for icon currently displayed */
  201. #define REV_ICON    1
  202. #define NA_ICON        2
  203.  
  204. /* header line in appts file implies one-based entries and 99 memo flag */
  205. #define HEADER        "# CalenTool V2 - DO NOT REMOVE THIS LINE\n"
  206.  
  207. #define MAX_STRLEN    256    /* max size of strings */
  208. struct appt_entry {
  209.     /* describes an entry in the appointments file */
  210.     int year, month, day, hour, minute, arrows;
  211.     int repeat, lookahead, flags, sindex;
  212.     char str[MAX_STRLEN];
  213.     struct appt_entry *next;    /* ptr to next appt in list */
  214. };                    /* NULL if last entry */
  215.  
  216. struct rect_pos {
  217.     /* location of a given rect in the canvas */
  218.     int top, bottom, left, right;
  219. };
  220.  
  221. struct dayslot {
  222.     /* struct for storing relevant info for 30 min day slot */
  223.     struct rect_pos slot_pos; /* slot position in day display */
  224.     struct rect_pos larrow_pos; /* position of left scroll arrow */
  225.     struct rect_pos rarrow_pos; /* position of right scroll arrow */
  226.     struct rect_pos moreb_pos; /* position of "more" button */
  227.     int active;        /* status of this slot */
  228.     int count;        /* number of active appts in this slot */
  229.     struct appt_entry *cur_appt;    /* ptr to current appt in list */
  230.     struct appt_entry *first;    /* ptr to first appt in list */
  231. };                    /* NULL if no entries */
  232.  
  233. struct weekrect {
  234.     /* info for week display */
  235.     struct rect_pos wday_pos; /* screen position of this day */
  236.     struct rect_pos moreb_pos; /* position of "more" button */
  237.     int more;
  238.     struct dayslot weekslots[N_SLOTS];
  239. };
  240.  
  241. struct rect_limits {
  242.     int lowx;
  243.     int lowy;
  244.     int highx;
  245.     int highy;
  246. };
  247.  
  248. struct week_arrow {
  249.     int top;
  250.     int bottom;
  251.     int left;
  252.     int right;
  253.     int active;
  254. };
  255.