home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume17 / calentool / part16 / ct.h next >
C/C++ Source or Header  |  1991-04-06  |  8KB  |  309 lines

  1. /*
  2.  * $Header: ct.h,v 2.5 91/03/27 16:45:12 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, 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.  * If calentool is too big and you want a stripped-down version
  27.  * define some or all of these here or in the Makefile. Combined,
  28.  * they save ~100K bytes for a statically linked object.
  29.  */
  30. #define NO_PRINTER        /* exclude printer support code */
  31. /*#define NO_HOLIDAYS        /* exclude holiday checking code */
  32. /*#define NO_SUN_MOON        /* exclude Sun/Moon data frames */
  33.  
  34. /* ignore several things for calencheck program */
  35. #ifdef CALENCHECK
  36. #    define NO_PRINTER
  37. #    define NO_HOLIDAYS
  38. #    define NO_SUN_MOON
  39. #    define NOTOOL
  40. #endif
  41.  
  42. /* directory for date/event files */
  43. #ifndef DATELIB_DIR
  44. #    define DATELIB_DIR    "/usr/net/lib/calentool"
  45. #endif
  46.  
  47. #ifndef NO_PRINTER
  48. /* command string for sending a file to the Postscript printer */
  49. #    ifndef PRINT_CMD
  50. #        define PRINT_CMD    "lpr -Plw"
  51. #    endif
  52.  
  53. /*#    define RASTER_ONLY    /* define this if no PostScript printer available */
  54. #    ifndef PS_NOTE_FONT
  55. #        define PS_NOTE_FONT     "Helvetica-Narrow"
  56. #    endif
  57. /*#    define LANGUAGE        /* for natural language support */
  58.                 /* see the file pcaldw.c for details */
  59. #else
  60. #    define RASTER_ONLY    /* do not change this line */
  61. #endif /* NO_PRINTER */
  62.  
  63. #ifndef MAILPROG
  64. #    define MAILPROG        "/usr/ucb/mail"
  65.                 /* assumes -s option is available */
  66. #endif
  67.  
  68. /* define NR_WEEKDAYS for desired week display */
  69. /* NR_WEEKDAYS        display   */
  70. /*    5        Mon-Fri   */
  71. /*    6        Mon-Sat      */
  72. /*    7        Sun-Sat    or Mon-Sun  */
  73. /**/
  74. #ifndef NR_WEEKDAYS
  75. #    define NR_WEEKDAYS    5
  76. #endif
  77. #ifndef MON_FIRST
  78. #    define MON_FIRST    0    /* 0=Sun-Sat, 1=Mon-Sun */
  79. #endif
  80.  
  81. #ifndef START_HOUR
  82. #    define START_HOUR    8    /* 8am */
  83. #endif                    /*  to */
  84. #ifndef END_HOUR
  85. #    define END_HOUR        18    /* 6pm */
  86. #endif
  87. #ifndef HOUR_24
  88. #    define HOUR_24        0    /* 0=12hr time, 1=24hr time */
  89. #endif
  90. #ifndef DAY_FIRST
  91. #    define DAY_FIRST    0    /* 0=M/D/Y, 1=D/M/Y */
  92. #endif
  93.  
  94. #ifndef START_YEAR
  95. #    define START_YEAR    90
  96. #endif
  97. #ifndef NR_YEARS
  98. #    define NR_YEARS        5    /* number of years in menu */
  99. #endif
  100.  
  101. #ifndef N_NOTESLOTS
  102. #    define N_NOTESLOTS    10    /* number of slots for notes */
  103. #endif
  104.  
  105. #ifndef UPDATE_RATE
  106. #    define UPDATE_RATE    "second"    /* update time */
  107. #endif                     /* options are "second" & "minute" */
  108. #define TIME_OUT    2        /* check appts every 5 minutes */
  109.  
  110. /*
  111.  * APPT_CHECK_LIMIT is typically either "n_tslots"
  112.  * or "n_slots" depending on whether we include the
  113.  * notes section when indicating that we still have
  114.  * appts today.
  115.  */
  116. #ifndef APPT_CHECK_LIMIT
  117. #    define APPT_CHECK_LIMIT    n_tslots
  118. #endif
  119.  
  120. /*********************************************************************/
  121. /* Nothing below here should need to be changed (typically)          */
  122. /*********************************************************************/
  123.  
  124. #ifndef TRUE
  125. #    define TRUE    1
  126. #endif
  127. #ifndef FALSE
  128. #    define FALSE    0
  129. #endif
  130.  
  131. #define MAX_FUTURE_ENTRIES    32    /* number of appts displayed in popup window */
  132.  
  133. /* Dimensions of 30-minute week slot.
  134.  * Message size determines width - everything else keyed
  135.  * off font size and message size
  136.  */
  137. #define WEEK_MESSAGE_SIZE    12
  138.  
  139. #define MAX_INCLUDE_NESTING    4    /* number of allowed include files */
  140.  
  141. #define DISPLAYING_DAY          1       /* Defs for state of main */
  142. #define DISPLAYING_WEEK         2    /* subwindow (mainsw_state) */
  143. #define DISPLAYING_MONTH        3
  144. #define DISPLAYING_YEAR         4
  145.  
  146. #define BACKSPACE               8    /* editing chars */
  147. #define CTRL_R                  18
  148. #define CTRL_U                  21
  149. #define CTRL_W                  23
  150. #define DEL                     127
  151.  
  152. #define NONE            0
  153. #define DAY            1    /* Defs for "selected_type" (type of */
  154. #define WEEK            2    /* object selected by month click). */
  155. #define MONTH            3
  156.  
  157. #define JUSTIFY_LEFT    0        /* text justification in day slot */
  158. #define JUSTIFY_RIGHT    1
  159. #define JUSTIFY_INDEX    2
  160.  
  161. #define FOUND_SLOT    1        /* event tags for day display */
  162. #define FOUND_MORE    2
  163. #define FOUND_LARROW    3
  164. #define FOUND_RARROW    4
  165.  
  166. #define MMODIFY        1        /* order of entries in day menu */
  167. #define MCUT        2
  168. #define MPASTE        3
  169. #define MCOPY        4
  170. #define MDELETE        5
  171. #define MUNDELETE    6
  172.  
  173. #define PR_DEFAULT    0        /* print options */
  174. #define PR_ASCII    1
  175. #define PR_POSTSCRIPT    2
  176. #define PR_RASTER    3
  177.  
  178. #define SUN        0        /* days of the week */
  179. #define MON        1
  180. #define TUE        2
  181. #define WED        3
  182. #define THU        4
  183. #define FRI        5
  184. #define SAT        6
  185.  
  186. #define JAN        0        /* selected months */
  187. #define FEB        1
  188. #define DEC        11
  189.  
  190. #define ALL_YEARS    0x1        /* flags for special case appts */
  191. #define ALL_MONTHS    0x2
  192. #define ALL_DAYS    0x4
  193. #define REPEAT        0x8
  194.     /* check for any repeating type appt */
  195. #    define Repeating(d)    ((d)&(ALL_YEARS|ALL_MONTHS|ALL_DAYS|REPEAT|EVERY_MON_FRI))
  196. #define A_COMMENT    0x10
  197. #define EVERY_SUN    0x20
  198. #define EVERY_MON    0x40
  199. #define EVERY_TUE    0x60
  200. #define EVERY_WED    0x80
  201. #define EVERY_THU    0xa0
  202. #define EVERY_FRI    0xc0
  203. #define EVERY_SAT    0xe0
  204. #define    EVERY_SOMEDAY    0xe0
  205.     /* convert flag value to day-of-week number */
  206. #    define Pickday(d)    ((((d)&EVERY_SOMEDAY)>>5)-1)    
  207.     /* convert day of week to flag value */
  208. #    define Setday(d)    (((d)+1)<<5)
  209. #define LOOKAHEAD    0x100
  210. #define READONLY    0x200
  211. #define A_NOTE        0x400
  212. #define MARKED        0x800    /* don't show in month/year display */
  213. #define MARKED_NOTE    0xc00
  214. #define DELETED        0x1000    /* don't show the appt that matches this */
  215. #define RUN        0x2000
  216. #define EVERY_MON_FRI    0x4000
  217.  
  218. /* format of repeat field for every_someday type appts */
  219. #define WEEK1        0x1
  220. #define WEEK2        0x2
  221. #define WEEK3        0x4
  222. #define WEEK4        0x8
  223. #define WEEK5        0x10
  224. #define ALL_WEEKS    0x1f
  225. #define LAST_WEEK    0x20
  226. #define WEEK_LIMIT    0x3f
  227.  
  228. /* error reporting flags */
  229. #define NON_FATAL    0
  230. #define FATAL        1
  231.  
  232. /* icon identifiers */
  233. #define STD_ICON    0        /* flags for icon currently displayed */
  234. #define REV_ICON    1
  235. #define NA_ICON        2
  236.  
  237. /* arguments to print_apts() */
  238. #define PRI_DAY            1
  239. #define PRI_WEEK        2
  240. #define PRI_MONTH        3
  241. #define PRI_XNOTES        4
  242. #define PRI_DAY_XNOTES        (PRI_DAY|PRI_XNOTES)
  243. #define PRI_WEEK_XNOTES        (PRI_WEEK|PRI_XNOTES)
  244. #define PRI_MONTH_XNOTES     (PRI_MONTH|PRI_XNOTES)
  245. #define DST_STDOUT        1
  246. #define DST_MAIL        2
  247.  
  248. /* return codes from get_day_appts() */
  249. #define NO_ENTRIES    0
  250. #define SOME_APPTS    1
  251. #define SOME_NOTES    2
  252. #define SOME_MKNOTES    4
  253. #define SOME_FUTURES    8
  254.  
  255. /* header line in appts file implies one-based entries and 99 memo flag */
  256. #define HEADER        "# CalenTool V2.2 - DO NOT REMOVE THIS LINE\n"
  257. #define OHEADER        "# CalenTool V2 - DO NOT REMOVE THIS LINE\n"
  258.  
  259. #define MAX_STRLEN    256    /* max size of strings */
  260. struct appt_entry {
  261.     /* describes an entry in the appointments file */
  262.     int year, month, day, hour, minute, arrows;
  263.     int repeat, lookahead, flags, sindex;
  264.     int runlength, warn;
  265.     char str[MAX_STRLEN];
  266.     struct appt_entry *next;    /* ptr to next appt in list */
  267. };                    /* NULL if last entry */
  268.  
  269. struct rect_pos {
  270.     /* location of a given rect in the canvas */
  271.     int top, bottom, left, right;
  272. };
  273.  
  274. struct dayslot {
  275.     /* struct for storing relevant info for 30 min day slot */
  276.     struct rect_pos slot_pos; /* slot position in day display */
  277.     struct rect_pos larrow_pos; /* position of left scroll arrow */
  278.     struct rect_pos rarrow_pos; /* position of right scroll arrow */
  279.     struct rect_pos moreb_pos; /* position of "more" button */
  280.     int active;    /* number of appts that originate here */
  281.     int count;    /* number of appts in this slot */
  282.     int arrow_pos;    /* bitmap of arrow locations on screen */
  283.     struct appt_entry *cur_appt;    /* ptr to current appt in list */
  284.     struct appt_entry *first;    /* ptr to first appt in list */
  285. };                    /* NULL if no entries */
  286.  
  287. struct weekrect {
  288.     /* info for week display */
  289.     struct rect_pos wday_pos; /* screen position of this day */
  290.     struct rect_pos moreb_pos; /* position of "more" button */
  291.     int more;
  292.     struct dayslot *weekslots; /* array of slots for this day */
  293. };
  294.  
  295. struct rect_limits {
  296.     int lowx;
  297.     int lowy;
  298.     int highx;
  299.     int highy;
  300. };
  301.  
  302. struct week_arrow {
  303.     int top;
  304.     int bottom;
  305.     int left;
  306.     int right;
  307.     int active;
  308. };
  309.