Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!sun-barr!newstop!sun!hillside.co.uk From: pc@hillside.co.uk (Peter Collinson) Newsgroups: comp.sources.x Subject: v08i005: Xcal, Patch2, Part01/01 Message-ID: <137919@sun.Eng.Sun.COM> Date: 27 Jun 90 06:45:01 GMT Sender: news@sun.Eng.Sun.COM Lines: 254 Approved: argv@sun.com Submitted-by: Peter Collinson Posting-number: Volume 8, Issue 5 Archive-name: xcal/patch2 Patch-To: xcal: Volume 7, Issue 1-2,28 Xcal is a calendar program. It generally sits on your screen displaying today's date - the format of this can be tailored to your taste. The patch below is from Rod Whitby and since several people have asked for this feature, I have put it out as a patch immediately. From Rod's mail: If InitialCalendar is True, then this month's calendar will be popped up when xcal is started. If InitialEdit is True, and there exists a file for today's date, then an Edit window for today will be popped up when xcal is started. ------------------------- patch from here -------------- Prereq: 1 *** patchlevel.h~ Sat Jun 23 19:50:35 1990 --- patchlevel.h Sat Jun 23 19:50:09 1990 *************** *** 1 **** ! #define PATCHLEVEL 1 --- 1 ---- ! #define PATCHLEVEL 2 *** version.c~ Sat Jun 23 19:47:55 1990 --- version.c Sat Jun 23 19:41:52 1990 *************** *** 1,10 **** #ifndef lint ! static char *sccsid = "@(#)version.c 1.2 (Hillside Systems) 5/5/90"; #endif lint /* * Version control file ! * version.c 1.2 5/5/90 ! * Automatically created on Sat May 5 16:15:20 BST 1990 * * Hand edit none of this if you want freeze to continue to work */ --- 1,10 ---- #ifndef lint ! static char *sccsid = "@(#)version.c 1.3 (Hillside Systems) 6/23/90"; #endif lint /* * Version control file ! * version.c 1.3 6/23/90 ! * Automatically created on Sat Jun 23 19:41:41 BST 1990 * * Hand edit none of this if you want freeze to continue to work */ *************** *** 12,37 **** #define PROGNAME XCal #endif #ifdef VER_VEC ! char version[] = "XCal Version 1.2, released Sat May 5 16:15:20 BST 1990"; #endif #ifdef VER_DEF ! #define VERSION "XCal Version 1.2, released Sat May 5 16:15:20 BST 1990" #endif /* SCCS files * +1.5 Makefile ! +3.3 xcal.c ! +1.5 xcal.man ! +3.2 xcal.h +3.1 xcal_popup.c +3.4 xcal_strip.c +3.2 xcal_help.c +3.3 xcal_edit.c +1.4 XCal.ad ! +1.2 Imakefile +1.1 README ! +1.4 CHANGES ! +1.2 patchlevel.h * */ --- 12,37 ---- #define PROGNAME XCal #endif #ifdef VER_VEC ! char version[] = "XCal Version 1.3, released Sat Jun 23 19:41:41 BST 1990"; #endif #ifdef VER_DEF ! #define VERSION "XCal Version 1.3, released Sat Jun 23 19:41:41 BST 1990" #endif /* SCCS files * +1.5 Makefile ! +3.4 xcal.c ! +1.6 xcal.man ! +3.3 xcal.h +3.1 xcal_popup.c +3.4 xcal_strip.c +3.2 xcal_help.c +3.3 xcal_edit.c +1.4 XCal.ad ! +1.3 Imakefile +1.1 README ! +1.5 CHANGES ! +1.3 patchlevel.h * */ *** Imakefile~ Sat Jun 23 19:47:06 1990 --- Imakefile Sat Jun 23 19:41:51 1990 *************** *** 1,4 **** --- 1,5 ---- LOCAL_LIBRARIES = XawClientLibs + INCS = xcal.h SRCS = xcal.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c version.c OBJS = xcal.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o version.o OSMAJORVERSION = OSMajorVersion *** CHANGES~ Sat Jun 23 19:46:33 1990 --- CHANGES Sat Jun 23 19:41:52 1990 *************** *** 1,5 **** ! Changes: CHANGES 1.4 5/5/90 xcal_edit.c Fix bug where colour mapping on days failed to change when data is deleted or added. --- 1,18 ---- ! Changes: CHANGES 1.5 6/23/90 + ---------------------------- 1.5 + + xcal.h Add initialCalendar/initialEdit switches + Support for better start-up options... from + From: Rod Whitby + + xcal.c Add hooks and code to perform startuo + + Imakefile Corrected + + xcal.man Add new lines supporting initialCalendar/initialEdit + + ---------------------------- 1.4 xcal_edit.c Fix bug where colour mapping on days failed to change when data is deleted or added. *** xcal.c~ Sat Jun 23 19:48:29 1990 --- xcal.c Sat Jun 23 19:41:46 1990 *************** *** 1,5 **** #ifndef lint ! static char *sccsid = "@(#)xcal.c 3.3 (Hillside Systems) 5/2/90"; static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems"; #endif lint /*** --- 1,5 ---- #ifndef lint ! static char *sccsid = "@(#)xcal.c 3.4 (Hillside Systems) 6/23/90"; static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems"; #endif lint /*** *************** *** 77,82 **** --- 77,86 ---- offset(calCompat), XtRString, "False" }, {"giveHelp", "GiveHelp", XtRBoolean, sizeof(Boolean), offset(giveHelp), XtRString, "True" }, + {"initialCalendar", "InitialCalendar", XtRBoolean, sizeof(Boolean), + offset(initialCalendar), XtRString, "False" }, + {"initialEdit", "InitialEdit", XtRBoolean, sizeof(Boolean), + offset(initialEdit), XtRString, "False" }, {"markForeground", "MarkForeground", XtRPixel, sizeof(Pixel), offset(marked.fg), XtRString, "White" }, {"markBackground", "MarkBackground", XtRPixel, sizeof(Pixel), *************** *** 263,268 **** --- 267,285 ---- XtAugmentTranslations(lab, XtParseTranslationTable(defTranslations)); XtMapWidget(toplevel); + + if (appResources.initialCalendar) { + DoCalendar(lab, NULL, NULL); + } + + if (appResources.initialEdit) { + MonthEntry *me; + me = GetMonthEntry(today.year, today.month); + if (me->me_have[today.day]) { + StartEditing(lab, &today); + } + } + XtMainLoop(); } *** xcal.h~ Sat Jun 23 19:49:26 1990 --- xcal.h Sat Jun 23 19:41:47 1990 *************** *** 1,5 **** /* ! * xcal.h 3.2 5/2/90 * * Header file for the xcal program */ --- 1,5 ---- /* ! * xcal.h 3.3 6/23/90 * * Header file for the xcal program */ *************** *** 44,49 **** --- 44,51 ---- Boolean markToday; /* Mark today with today's colours */ Boolean calCompat; /* True if handle files like xcalendar */ Boolean giveHelp; /* True if help is needed (default) */ + Boolean initialCalendar;/* Pop up Calendar on startup if True */ + Boolean initialEdit; /* Pop up today's Edit on startup if True */ String mon[12]; /* Long month names */ String smon[12]; /* Short month names */ String day[7]; /* day names */ *** xcal.man~ Sat Jun 23 19:48:56 1990 --- xcal.man Sat Jun 23 19:41:46 1990 *************** *** 212,217 **** --- 212,229 ---- If False, help buttons disappear and the initial message is not printed. Default: True. .TP + .B InitialCalendar + If True then the calendar for this month is automatically displayed on + startup. + If False, the calendar is not automatically displayed. + Default: False. + .TP + .B InitialEdit + If True then an edit window for today is automatically displayed on + startup if a file exists for today's date. + If False, the edit window is not automatically displayed. + Default: False. + .TP .B UseWmTitle If True display the month and the year at the head of each strip. This information is duplicated if your window manager uses titles dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.