1 /*----------------------------------------------------------------------------
2 --
3 --  Module:           xtmGlobal
4 --
5 --  Project:          Xdiary
6 --  System:           xtm - X Desktop Calendar
7 --    Subsystem:      <>
8 --    Function block: <>
9 --
10 --  Description:
11 --    Global declarations for Xdiary.
12 --
13 --  Filename:         xtmGlobal.h
14 --
15 --  Authors:          Roger Larsson, Ulrika Bornetun
16 --  Creation date:    1990-12-01
17 --
18 --
19 --  (C) Copyright Ulrika Bornetun, Roger Larsson (1995)
20 --      All rights reserved
21 --
22 --  Permission to use, copy, modify, and distribute this software and its
23 --  documentation for any purpose and without fee is hereby granted,
24 --  provided that the above copyright notice appear in all copies. Ulrika
25 --  Bornetun and Roger Larsson make no representations about the usability
26 --  of this software for any purpose. It is provided "as is" without express
27 --  or implied warranty.
28 ----------------------------------------------------------------------------*/
29 
30 /* SCCS module identifier. */
31 /* SCCSID = @(#) Module: xtmGlobal.h, Version: 1.1, Date: 95/02/18 15:52:23 */
32 
33 
34 /* Only include this module once. */
35 #ifndef define_xtmGlobal_h
36 #  define define_xtmGlobal_h
37 
38 
39 /*----------------------------------------------------------------------------
40 --  Include files
41 ----------------------------------------------------------------------------*/
42 
43 #include "Standard.h"
44 #include "TimDate.h"
45 #include "LstLinked.h"
46 
47 #include "xtmReminder.h"
48 #include "xitClipboard.h"
49 #include "xitMsgWin.h"
50 #include "xitInfo.h"
51 
52 
53 /*----------------------------------------------------------------------------
54 --  Macro definitions
55 ----------------------------------------------------------------------------*/
56 
57 /* Name of application. */
58 #define APPLICATION_NAME    "XDiary"
59 
60 
61 /* Max number of running alarms. */
62 #define XTM_GL_MAX_ALARM_PRC    50
63 
64 /* Max length of an archive name. */
65 #define XTM_GL_MAX_ARCH_NAME    15
66 
67 /* Max length of a calendar name. */
68 #define XTM_GL_MAX_CAL_NAME     15
69 
70 /* Max number of colors in color list. */
71 #define XTM_GL_MAX_COLORS       30
72 
73 /* Max length of comment. */
74 #define XTM_GL_MAX_COMMENT      20
75 
76 /* Max length of an external connection type. */
77 #define XTM_GL_MAX_EXTERN_TYPE  10
78 
79 /* Max length of directory location. */
80 #define XTM_GL_MAX_DIR          75
81 
82 /* Max number of dayl list views that can be active. */
83 #define XTM_GL_MAX_DL_VIEW       5
84 
85 /* Max length of entry tag. */
86 #define XTM_GL_MAX_ENTRY_TAG     4
87 
88 /* Max length of a host name. */
89 #define XTM_GL_MAX_HOSTNAME     40
90 
91 /* Max length of calendar location. */
92 #define XTM_GL_MAX_LOCATION     50
93 
94 /* Max length of mail address. */
95 #define XTM_GL_MAX_MAIL_ADDR    40
96 
97 /* Max length of a password. */
98 #define XTM_GL_MAX_PASSWORD     20
99 
100 /* Max length of a user ID. */
101 #define XTM_GL_MAX_USERID       20
102 
103 
104 /* Flags to signal various actions to take. */
105 #define XTM_GL_TOOLS_DONE         (1<<1)
106 #define XTM_GL_UPDATE_MAIN_CAL    (1<<2)
107 #define XTM_GL_UPDATE_DAY_CAL     (1<<3)
108 #define XTM_GL_UPDATE_CLOCK       (1<<4)
109 #define XTM_GL_UPDATE_ALL         (1<<5)
110 
111 /* Exception handler (raise exception). */
112 #define raise  goto
113 
114 
115 /*----------------------------------------------------------------------------
116 --  Type declarations
117 ----------------------------------------------------------------------------*/
118 
119 /* The layout of the appointments in the day list. */
120 typedef enum {
121   XTM_GL_LAYOUT_TIME,
122   XTM_GL_LAYOUT_DURATION
123 } XTM_GL_ENTRY_LAYOUT;
124 
125 
126 /* List of colors. */
127 typedef struct {
128   int    no_colors;
129   Pixel  color[ XTM_GL_MAX_COLORS ];
130 } XTM_GL_COLOR_LIST;
131 
132 
133 /* Data structure describing included file. */
134 typedef struct {
135 
136   /* File name (expanded). */
137   char  *file_name;
138 
139   /* File name (original). */
140   char  *orig_file_name;
141 
142 } XTM_GL_INCLUDE_FILE;
143 
144 
145 /* Data structure describing data from the customization file. */
146 typedef struct {
147 
148   /* Reminder alarm for new appointments. */
149   Boolean  alarm_for_new_app;
150 
151   /* Default alarm offsets valid. */
152   Boolean  alarm_valid[ 5 ];
153 
154   /* Display an extended monthe in calendars. */
155   Boolean  cal_month_extend;
156 
157   /* Make a new day view when clicking on a date in the calendar. */
158   Boolean  click_date_new_view;
159 
160   /* Require confirmation for certain important actions like delete? */
161   Boolean  confirm_actions;
162 
163   /* Run in debug mode? */
164   Boolean  debug_mode;
165 
166   /* Display flags for entries in the day view. */
167   Boolean  display_entry_flags;
168 
169   /* In the schedule window, display the navigate calendar automatically. */
170   Boolean  display_nav_cal;
171 
172   /* Do calendar refresh? */
173   Boolean  do_refresh;
174 
175   /* Interactive operations in the day view. */
176   Boolean  entries_interactive;
177 
178   /* Sound alarms? */
179   Boolean  give_alarm;
180 
181   /* Show schedule with a list layout. */
182   Boolean  list_layout;
183 
184   /* New release of XDiary? */
185   Boolean  new_release;
186 
187   /* Print only working days. */
188   Boolean  pr_only_workdays;
189 
190   /* Print in 3D? */
191   Boolean  pr_in_3d;
192 
193   /* Prompt with the repeating window? */
194   Boolean  prompt_repeat_win;
195 
196   /* Run in read-only mode? */
197   Boolean  read_only_mode;
198 
199   /* Show week numbers in the calendar? */
200   Boolean  show_week_numbers;
201 
202   /* Show standing entries in the calendar? */
203   Boolean  show_stand_in_cal;
204 
205   /* At start time, show what is up today? */
206   Boolean  show_day_to_do;
207 
208   /* Uset standard UNIX week numbering (is really wrong). */
209   Boolean  std_unix_week_numbers;
210 
211   /* Display true colors for entries in included calendars. */
212   Boolean  true_color_included;
213 
214   /* Use file locking or not? */
215   Boolean  use_file_lock;
216 
217   /* A valid resource file? */
218   Boolean  valid_resource_file;
219 
220   /* Do widget caching? */
221   Boolean  widget_caching;
222 
223   /* The workdays (Mon - Sun). */
224   Boolean  workdays[ 7 ];
225 
226   /* Wrap X-Server bug? */
227   Boolean  wrap_bug;
228 
229   /* Fancy calendar style? */
230   Boolean  cal_is_fancy;
231 
232   /* Free flags to use. */
233   Boolean  free_flag_1;
234   Boolean  free_flag_2;
235   Boolean  free_flag_3;
236   Boolean  free_flag_4;
237   Boolean  free_flag_5;
238 
239   /* Marker for entries with action alarms. */
240   int  action_alarm_marker;
241 
242   /* File system identifier for AFS files. */
243   int  afs_vfs_id;
244 
245   /* Marker for entries with alarms. */
246   int  alarm_marker;
247 
248   /* Default alarm offsets. */
249   int  alarm_offset[ 5 ];
250 
251   /* The default number of lines to show for an alarm. */
252   int  alarm_show_lines;
253 
254   /* Volume for alarms. */
255   int  alarm_volume;
256 
257   /* Size (in pixels) for the appointment pane in the day view. */
258   int  app_pane_height;
259 
260   /* Marker for archived entries. */
261   int  archive_marker;
262 
263   /* Style to use for day marks in calendar. */
264   int  cal_button_style;
265 
266   /* Shadow thickness for days with entries. */
267   int  cal_entry_shadow;
268 
269   /* Switch day in the day list? */
270   int  day_view_day_switch;
271 
272   /* Number of days to display in the day view. */
273   int  day_view_days;
274 
275   /* Default entry delta (in minutes). */
276   int  default_entry_delta;
277 
278   /* Default paper size. */
279   int  default_paper_size;
280 
281   /* Default tune to use. */
282   int  default_tune;
283 
284   /* Width for days in the day view (0 - use default values). */
285   int  def_day_width;
286 
287   /* Default duration for an entry. */
288   int  entry_default_duration;
289 
290   /* Width (in pixels) for the entry pane in the day view. */
291   int  entry_pane_width;
292 
293   /* Shadow for the buttons representing entries. */
294   int  entry_shadow_thickness;
295 
296   /* The default number of lines to show for each entry in the day list. */
297   int  entry_show_lines;
298 
299   /* Marker for important entries. */
300   int  important_marker;
301 
302   /* Depth of include files. */
303   int  incl_depth;
304 
305   /* Marker for included entries. */
306   int  include_marker;
307 
308   /* Marker for a 'done' note. */
309   int  note_done_marker;
310 
311   /* Marker for a note 'not done'. */
312   int  note_not_done_marker;
313 
314   /* Size (in pixels) for the note pane in the day view. */
315   int  note_pane_height;
316 
317   /* Number of lines in the print window. */
318   int  print_def_lines;
319 
320   /* Number of sheets per page when printing. */
321   int  print_def_sheets;
322 
323   /* Marker for a private entry. */
324   int  private_marker;
325 
326   /* Refresh rate in minutes for XDiary. */
327   int  refresh_rate;
328 
329   /* Marker for a standing entry. */
330   int  standing_marker;
331 
332   /* The day to start the day view on. */
333   int  start_day_view_on;
334 
335   /* Start time for entries in the day list. */
336   int  start_hour;
337 
338   /* End time for entries in the day list. */
339   int  stop_hour;
340 
341   /* Number of lines in the summary. */
342   int  summary_def_lines;
343 
344   /* Position for text marker in the appointment window. */
345   int  text_marker_pos;
346 
347   /* Duration delta for tune. */
348   int  tune_dur_delta;
349 
350   /* Free int to use. */
351   int  free_int_1;
352   int  free_int_2;
353   int  free_int_3;
354   int  free_int_4;
355   int  free_int_5;
356 
357   /* Format for dates. */
358   char  date_format[ 50 ];
359 
360   /* Selected language. */
361   char  msg_language[ 20 ];
362 
363   /* Format for times. */
364   char  time_format[ 50 ];
365 
366   /* Script (program) for access control. */
367   char  *acl_script;
368 
369   /* Script (program) to start the alarm process. */
370   char  *alarm_script;
371 
372   /* Type of text to display in the calendar icon window. */
373   char  *cal_icon_text;
374 
375   /* File to contain user custom data. */
376   char  *custom_file;
377 
378   /* Pre-processor for user custom data. */
379   char  *custom_file_pp;
380 
381   /* Script (program) for XDiary customization. */
382   char  *custom_script;
383 
384   /* List with background colors to use for databases. */
385   char  *db_color_bg_list;
386 
387   /* Directory for diary descriptions. */
388   char  *db_selection_dir;
389 
390   /* Default date format. */
391   char  *default_date_format;
392 
393   /* Default entry tag. */
394   char  *default_entry_tag;
395 
396   /* Default text for entries. */
397   char  *default_entry_text;
398 
399   /* Default printer to use. */
400   char  *default_printer;
401 
402   /* Default printer type to use. */
403   char  *default_printer_type;
404 
405   /* Default time format. */
406   char  *default_time_format;
407 
408   /* List with background colors to use. */
409   char  *color_bg_list;
410 
411   /* List with foreground colors to use. */
412   char  *color_fg_list;
413 
414   /* Default entry tags filter. */
415   char  *entry_tags_filter;
416 
417   /* Default tags to select in the tag selection menu. */
418   char  *entry_tags_menu;
419 
420   /* File for error logs. */
421   char  *error_log_file;
422 
423   /* Default tags to use in the day list. */
424   char  *filter_day_view_tags;
425 
426   /* Default tags to use for the alarm. */
427   char  *filter_alarm_tags;
428 
429   /* Script (program) to find calendar location. */
430   char  *find_location_script;
431 
432   /* Generic print command to use. */
433   char  *gen_print_command;
434 
435   /* Directory containing the holidays databases. */
436   char *holidays_db_dir;
437 
438   /* Script (program) to run when entries are printed. */
439   char  *print_script;
440 
441   /* Types of printer we can handle. */
442   char  *printer_types;
443 
444   /* Remote script to upload/download external calendars. */
445   char  *remote_script;
446 
447   /* File to contain system custom data. */
448   char  *system_custom_file;
449 
450   /* Pre-processor for system custom data. */
451   char  *system_custom_file_pp;
452 
453   /* Name of the file containing system printers. */
454   char  *system_printer_file;
455 
456   /* Colors tor tags. */
457   char  *tags_colors;
458 
459   /* Times to use in the time select fields. */
460   char  *time_sel_values;
461 
462   /* Files containing tunes to play. */
463   char *tune_file[ 5 ];
464 
465   /* Tune program to use. */
466   char *tune_player;
467 
468   /* String to use when calling the editor. */
469   char  *user_editor;
470 
471   /* Name of the file containing the user specified printers. */
472   char  *user_printer_file;
473 
474   /* System wide and user books in the info system. */
475   char  *system_books;
476   char  *user_books;
477 
478   /* Tune program parameters. */
479   char *tune_player_param;
480 
481   char  *free_char_1;
482   char  *free_char_2;
483   char  *free_char_3;
484   char  *free_char_4;
485 
486   /* Background color for all dates in the calendar. */
487   Pixel  date_mark_bg;
488 
489   /* Background color for a entry button in the day list. */
490   Pixel  entry_button_unselect_bg;
491 
492   /* Foreground color for date in calendar when entry exist that day. */
493   Pixel  entry_exist_fg;
494 
495   /* Background color for a read-only entry in the day list. */
496   Pixel  entry_include_bg;
497 
498   /* Foreground color for an important entry in the day list. */
499   Pixel  entry_important_fg;
500 
501   /* Background color for a selected entry in the day list. */
502   Pixel  entry_select_bg;
503 
504   /* Background color for an unselected entry in the day list. */
505   Pixel  entry_unselect_bg;
506 
507   /* Foreground color for a normal entry in the day list. */
508   Pixel  entry_normal_fg;
509 
510   /* Foreground color for a note entry in the day list. */
511   Pixel  entry_note_fg;
512 
513   /* Foreground color for dates marked as holidays. */
514   Pixel  holiday_fg;
515 
516   /* Foreground color for weekdays (Mon - Sun). */
517   Pixel  monday_fg;
518   Pixel  tuesday_fg;
519   Pixel  wednesday_fg;
520   Pixel  thursday_fg;
521   Pixel  friday_fg;
522   Pixel  saturday_fg;
523   Pixel  sunday_fg;
524 
525   /* Background color for today. */
526   Pixel  today_bg;
527 
528   /* Foreground color for the week numbers. */
529   Pixel  week_number_fg;
530 
531   /* Calendar database. */
532   void  *cal_db_handle;
533 
534   /* Group lists (XDiary messages). */
535   void  *group_db_handle;
536 
537   /* Tags database. */
538   void  *tags_db;
539 
540   /* Archive files. */
541   LST_DESC_TYPE  archive_files;
542 
543   /* Include files. */
544   LST_DESC_TYPE  include_files;
545 
546   /* Background colors DB. */
547   XTM_GL_COLOR_LIST  colorsDB_bg;
548 
549   /* Foreground colors DB. */
550   XTM_GL_COLOR_LIST  colorsDB_fg;
551 
552   /* Background colors for databases. */
553   XTM_GL_COLOR_LIST  db_colors_bg;
554 
555   /* Original argc and argv (command line). */
556   unsigned int  orig_argc;
557   char**        orig_argv;
558 
559   /* Reserve data references. */
560   void  *extra1;
561   void  *extra2;
562   void  *extra3;
563   void  *extra4;
564   void  *extra5;
565 
566 } XTM_GL_CUSTOM_DATA, *XTM_GL_CUSTOM_DATA_REF;
567 
568 
569 /* Structure describing a single alarm process. */
570 typedef struct {
571 
572   /* Database name. */
573   char  db_name[ 20 ];
574 
575 } XTM_GL_ALARM_PRC;
576 
577 
578 /* Running alarm process. */
579 typedef struct {
580 
581   /* Window with alarm process information. */
582   Widget  mainFo;
583 
584   /* Process ID for the alarm process. */
585   int  alarm_pid;
586 
587   /* The running alarm processes. */
588   XTM_GL_ALARM_PRC  processes[ XTM_GL_MAX_ALARM_PRC ];
589 
590 } XTM_GL_PROC_INFO, *XTM_GL_PROC_INFO_REF;
591 
592 
593 /* Basic data structure for the XDiary application. */
594 typedef struct {
595 
596   /* Command line flags. */
597   Boolean  startup_help;
598   Boolean  version_help;
599 
600   /* Various flags. */
601   UINT32  flags;
602 
603   /* Use this default db directory? */
604   char  *default_db_dir;
605 
606   /* Name of FIFO to use when communicating with the alarm process. */
607   char  *alarm_fifo_name;
608 
609   /* Title of the XDiary session. */
610   char  *title;
611 
612   /* The toplevel shell for the application. */
613   Widget  toplevel;
614 
615   /* Window for the main calendar. */
616   Widget  calW;
617 
618   /* The X application context. */
619   XtAppContext  context;
620 
621   /* FIFO file when communicating with the alarm process. */
622   FILE  *alarm_fifo_ref;
623 
624   /* Customization data. */
625   XTM_GL_CUSTOM_DATA_REF  custom_data;
626 
627   /* Process information. */
628   XTM_GL_PROC_INFO_REF  process_info;
629 
630   /* Window for error messages. */
631   XIT_MSW_HANDLE  msg_win_ref;
632 
633   /* Info reference. */
634   XIT_IN_HANDLE  info_handle;
635 
636   /* Main calendar. */
637   void  *cal_handle;
638 
639   /* Send message. */
640   void  *msg_send_handle;
641 
642   /* Reserve data references. */
643   void  *extra1;
644   void  *extra2;
645   void  *extra3;
646   void  *extra4;
647 
648   /* Start date for calendar. */
649   char  *start_date;
650 
651 } XTM_GL_BASE_DATA, *XTM_GL_BASE_DATA_REF;
652 
653 
654 /*----------------------------------------------------------------------------
655 --  Global definitions
656 ----------------------------------------------------------------------------*/
657 
658 /* Keyboard translations for tab group move. */
659 extern XtTranslations  xtm_di_tab_group_trans;
660 
661 /* Keyboard translations for newline in multi-line editor. */
662 extern XtTranslations  xtm_di_newline_trans;
663 
664 
665 /*----------------------------------------------------------------------------
666 --  Function prototypes
667 ----------------------------------------------------------------------------*/
668 
669 
670 #endif
671