2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*******************************************************************************
27 ** static char sccsid[] = "@(#)calendar.h 1.59 95/02/16 Copyr 1991 Sun Microsystems, Inc.";
29 ** $TOG: calendar.h /main/5 1999/02/08 17:00:18 mgreess $
31 ** RESTRICTED CONFIDENTIAL INFORMATION:
33 ** The information in this document is subject to special
34 ** restrictions in a confidential disclosure agreement between
35 ** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
36 ** document outside HP, IBM, Sun, USL, SCO, or Univel without
37 ** Sun's specific written approval. This document and all copies
38 ** and derivative works thereof must be returned or destroyed at
41 ** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 *******************************************************************************/
46 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
47 * (c) Copyright 1993, 1994 International Business Machines Corp. *
48 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
49 * (c) Copyright 1993, 1994 Novell, Inc. *
55 #include <X11/Intrinsic.h>
66 #define MSGFILE_ERROR "SUNW_DESKSET_CM_ERR"
67 #define MSGFILE_LABEL "SUNW_DESKSET_CM_LABEL"
68 #define MSGFILE_MESSAGE "SUNW_DESKSET_CM_MSG"
79 #define FAKE_MONOCHROME 1
81 #define DTCM_CAT "dtcm"
83 typedef enum {gr_solid, gr_short_dotted, gr_dotted,
84 gr_dot_dashed, gr_short_dashed,
85 gr_long_dashed, gr_odd_dashed} GR_Line_Style;
87 typedef enum {gr_mono, gr_color} GR_depth;
89 typedef enum {BOLD, MEDIUM} Font_Weight;
92 yearGlance, monthGlance, weekGlance, dayGlance
96 RENDER_REPAINT, RENDER_CLEAR_FIRST, RENDER_UNMAP
99 typedef struct {Tick start_time;
102 char *summary;} Paint_cache;
105 Pixel foreground; /* X Default Foreground Color */
106 Pixel background; /* X Default Background Color */
108 Pixel hilight_color; /* Default hilight color */
109 /*Drawable drawable;*/ /* X Drawable */
111 Display *display; /* X Display */
114 * gc is a general purpose GC which is configured on the fly for
115 * infrequent operations. For frequent operations we use one of
116 * the pre-configured GCs which we never change.
118 GC gc; /* X Graphics Context */
119 XGCValues *gcvals; /* X Graphics Context Values */
120 GC draw_gc; /* GC for drawing */
121 GC clear_gc; /* GC for clearing */
122 GC invert_gc; /* GC for inverting */
124 int screen_depth; /* screen depth */
125 XColor colorcell_del[RED+1];/* rgb colors */
129 main_win, browser, tempbrowser
145 caddr_t day_info; /* in dayglance.c */
146 caddr_t week_info; /* in weekglance.c */
147 caddr_t month_info; /* in monthglance.c */
148 caddr_t year_info; /* in yearglance.c */
149 char* current_calendar; /* in calendarA.c */
150 CSA_reminder_reference *next_alarm; /* in appt.c */
151 CSA_uint32 next_alarm_count;
152 int rings; /* number of rings to do in reminder */
153 int flashes; /* number of flashes to do in reminder */
154 XtIntervalId next_alarm_id;
155 caddr_t current_selection; /* in select.c */
156 char* wm_cmdstr; /* WM_COMMAND format
157 version of argv list */
158 int wm_cmdstrlen; /* Size of the wm_cmdstr
160 char *sessionfile; /* file name (if any)
163 XrmDatabase sessiondb; /* X database that is
170 typedef struct _Cal_Font {
173 XFontStruct *cf_font;
188 Widget button1; /* unused */
189 Widget button2; /* view button */
190 Widget button3; /* edit button */
191 Widget button4; /* browse button*/
192 Widget button5; /* print button */
193 Widget button6; /* unused */
194 Widget button7; /* unused */
195 Widget button8; /* prev button */
196 Widget button9; /* today button */
197 Widget button10; /* next button */
202 int rc_ts; /* timestamp of rc file: browse */
203 int version; /* version of cm */
204 WindowType last_canvas_touched; /* either browser or main */
208 * Datatype for application-defined resources. This is filled in by Xt during
209 * XtVaAppInitialize (for the cmdline args) and during XtGetApplicationResources
210 * for the app-defaults values. An instance of this is carried around in
211 * calendar->app_data to provide access to properties data.
213 * Historical note: old properties (.desksetdefaults) should be mapped into
214 * this, and (if they need to be written out) taken form this.
218 String default_calendar;
219 String default_printer;
221 XmFontList labelfontlist;
222 XmFontList viewfontlist;
223 XmFontList boldfontlist;
224 XmFontList iconfontlist;
226 XmFontList userfontlist;
228 XmFontList systemfontlist;
229 String app_font_family;
232 } DtCmAppResources, *DtCmAppResourcesPtr;
235 unsigned int icon_width;
236 unsigned int icon_height;
237 unsigned int icon_depth;
243 nl_catd DT_catd; /* catgets file descriptor */
244 CSA_session_handle cal_handle; /* browsing calendar rpc connection */
245 unsigned int user_access; /* access wrt current viewing cal */
246 CSA_session_handle my_cal_handle; /* my calendar's rpc connection */
247 unsigned int my_access;
248 int my_cal_version; /* my calendar rpc connection version */
252 General *general; /* stuff general to the calendar */
253 Widget form; /* main container */
254 Widget toolbar; /* frame for toolbar */
255 Widget canvas; /* main canvas for graphics*/
256 Widget menu_bar; /* top of menu hierarchy */
257 Widget browse_menu; /* cached for quick access */
258 Widget browse_button; /* for updating browse menu */
259 Widget message_text; /* status at foot of main window */
260 Widget previous; /* arrow to step back in time */
261 Widget today; /* button to jump to "now" */
262 Widget next; /* arrow to step forward in time */
263 Widget radio; /* container for toolbar scope btns */
264 Widget day_scope; /* scope buttns in tool bar */
268 Widget appt_btn; /* Quick access to appt editor */
269 Widget todo_btn; /* Quick access to todo editor */
270 Widget todo_edit_menu; /* Menu access to todo editor */
271 Widget todo_view_menu; /* Menu access to todo list */
272 Widget month1; /* month panels in day view */
275 Widget postup; /* in alarm.c */
276 Widget mainhelpdialog;
278 Widget credits_dialog;
279 View *view; /* cached info about current display */
280 DtCmAppResourcesPtr app_data; /* Xt-populated, listed above */
281 caddr_t properties; /* in props.c */
282 caddr_t properties_pu; /* in props_pu.c */
283 caddr_t editor; /* in editor.c */
284 caddr_t geditor; /* in group_editor.c */
285 caddr_t browser; /* in browser.c */
286 caddr_t browselist; /* in blist.c */
287 caddr_t todo; /* in todo.c */
288 caddr_t alist; /* in alist.c */
289 caddr_t print_opts; /* in printer.c */
290 caddr_t user; /* calendar driver */
291 char* calname; /* calendar name */
292 new_XContext *xcontext; /* XID, Display, GC, GCVals */
293 caddr_t find; /* in find.c */
294 caddr_t goTo; /* in goto.c */
295 caddr_t tempbr; /* in tempbr.c */
296 caddr_t mail; /* in mail.c */
297 caddr_t timezone; /* in timezone.c */
298 caddr_t print_data; /* in print.c - valid when dialog up */
299 char *tt_procid; /* Tooltalk process id, used for
300 tooltalk intiialization */
301 Paint_cache *paint_cache;
302 int paint_cache_size;
305 IconInfo *icon_inverted;
308 extern Calendar *calendar;
309 extern int _csa_iso8601_to_tick(char *, time_t*);
310 extern int _csa_tick_to_iso8601(time_t, char *);
312 #define MAXBUFLEN 4096
318 /* define to figure out if two XRectangle structures intersect each other */
320 #define myrect_intersectsrect(r1,r2) \
321 ((int)(r1)->x<=(int)(r2)->x+(int)(r2)->width && \
322 (int)(r1)->y<=(int)(r2)->y+(int)(r2)->height && \
323 (int)(r2)->x<=(int)(r1)->x+(int)(r1)->width && \
324 (int)(r2)->y<=(int)(r1)->y+(int)(r1)->height)
327 extern void cache_dims P((Calendar*, Dimension,
329 extern char* cm_get_relname P(());
330 extern Boolean in_range P((time_t, time_t, time_t));
331 extern int report_err P((char*));
332 extern void reset_alarm P((Calendar*));
333 extern CSA_return_code reset_timer P((Calendar*));
334 extern CSA_return_code paint_canvas P((Calendar*, XRectangle*,
336 extern void switch_it P((Calendar*, char*,
338 extern int yyyerror P((char*));
339 extern void gr_clear_area P((new_XContext*, int, int,
340 Dimension, Dimension));
341 extern void gr_clear_box P((new_XContext*, int, int, int,
343 extern void gr_make_grayshade P((new_XContext*, int, int, int,
345 extern void gr_make_gray P((new_XContext*, int, int, int,
347 extern void gr_make_rgbcolor P((new_XContext*, Colormap, int,
348 int, int, int, int, int,
350 extern int gr_nchars P((int, char*, Cal_Font *));
351 extern void gr_draw_rgb_box P((new_XContext*, int, int, int,
352 int, int, int, Colormap));
353 extern void gr_dissolve_box P((new_XContext*, int, int, int,
355 extern int gr_center P((int, char*, Cal_Font *));
356 extern void gr_text P((new_XContext*, int, int,
359 extern void gr_text_rgb P((new_XContext*, int, int,
360 Cal_Font *, char*, Pixel,
361 Colormap, XRectangle*));
362 extern void gr_draw_line P((new_XContext*, int, int, int,
365 extern void gr_draw_box P((new_XContext*, int, int, int,
367 extern void gr_draw_glyph P((new_XContext*, new_XContext*,
368 Pixmap, int, int, int, int));
369 extern void gr_set_clip_rectangles P((new_XContext*, int, int,
370 XRectangle*, int, int));
371 extern void gr_clear_clip_rectangles P((new_XContext*));
372 extern Boolean gr_init P((new_XContext*, Widget));
373 extern new_XContext *gr_create_xcontext P((Calendar*, Widget, GR_depth,
375 extern Boolean today_inrange P((Calendar*, time_t));
376 extern void update_browse_menu_names P((Calendar*));
377 extern char* get_user_calendar P(());
378 extern void destroy_paint_cache P((Paint_cache *, int));
379 extern void invalidate_cache P((Calendar *));
381 extern CSA_return_code allocate_paint_cache P((CSA_entry_handle *, int, Paint_cache **));
383 extern Boolean fontlist_to_font P((XmFontList, Cal_Font *));
384 extern void CalTextExtents P((Cal_Font *, char *, int,
385 int *, int *, int *, int *));
386 extern void CalDrawString P((Display *, Drawable,
387 Cal_Font *, GC, int, int,
389 extern void CalFontExtents P((Cal_Font *,