v12i081: xcal3.2, Patch1, Part01/01

Peter Collinson pc at hillside.co.uk
Tue May 7 15:12:33 AEST 1991


Submitted-by: Peter Collinson <pc at hillside.co.uk>
Posting-number: Volume 12, Issue 81
Archive-name: xcal/patch1
Patch-To: xcal: Volume 10, Issue 99-101

--------
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 diffs below should only by applied to xcal 3.2 posted to the net
as comp.sources.x, Volume 10 Issue 99-101. If you are unsure of the
version, check the file version.c - this should contain the full truth.

Oh yes, what are the changes? These are documented in the CHANGES file
(see below) - now more detailed because of someone's complaints.

I did this all in January and had hoped to add a number of more
things to xcal and have a formidable mail folder full of fixes,
suggestions and ideas. I do want to do something when the date strip
gets too big for the screen, this is probably the biggest complaint.

I will eventually get around to dealing with fixes and new ideas. This
patch set is being produced mostly because a number of people have
asked for a way of dealing with regular events. Xcal purists will find
that the basic date box now contains todays day as a string. The box
grows alarmingly. You can mimic previous behaviour by using resources.
Personally, I like it.

Thanks to the many people who have mailed to say thanks and added
ideas to xcal. Sorry to the people who I refused to listen to or whose
ideas I haven't used.


Patch-To: xcal: Volume 10, Issue 99-101

------------------------- patch from here --------------
Prereq: 0
*** patchlevel.h~	Fri Mar 22 23:34:53 1991
--- patchlevel.h	Fri Mar 22 23:48:23 1991
***************
*** 1 ****
! #define PATCHLEVEL 0
--- 1 ----
! #define PATCHLEVEL 1
*** CHANGES~	Fri Mar 22 23:34:58 1991
--- CHANGES	Fri Mar 22 23:48:26 1991
***************
*** 1,6 ****
! Changes:	CHANGES	2.2	12/5/90
  
! Xcal - Version 3.1 Issued to comp.sources.x
  
  	Adds the memo functionality and the Stick/Unpin feature
  	for alarms.
--- 1,69 ----
! Changes:      CHANGES     2.12     91/03/22
  
! --------------------------- 3.3
! 
! 	Implement the ability to deal with regular weekly events.
! 	This is part of the memo system. Today's current events are
! 	shown as part of the memo panel. They can be edited by hitting
! 	a button and bringing up a special strip with an entry for
! 	each day. These regular event files are integrated into
! 	the alarm system.
! 
! 	Allow today's name: Monday, Tuesday etc to appear in the top
! 	level widget, the header of an edit window and the title of
! 	the memo box. This is controlled by the Order and Format
! 	resources and so previous behaviour can be maintained. Beware
! 	that this redefines the names of the days so
! 		Sunday maps to Sunday
! 	and a new short name is used for the abbreviated form
! 		Sun maps to Sun
! 	used in date strips.
! 
! 	Ensure that middle and right button translations work in the
! 	memo button in the top level widget (suggested by Casey
! 	Leedom).
! 
! 	New Imakefile from Casey Leedom. This has support for pscal.
! 	New pscal/Imakefile.
! 
! 	Add initialMemo resource so the memo box can popup at startup
! 	time - (suggested by G. W. Pigman III)
! 
! 	Steven Plite pointed out that the year display is
! 	inconsistent. To allow choice, add three new resources:
! 		dateYearIsTwoDigits
! 		memoYearIsTwoDigits
! 		editYearIsTwoDigits
! 	You can now choose how you would like to have your year
! 	displayed in the various places.
! 	Defaults to showing four digits.
! 
! 	System V release 4 fixes from Dave McCraken.
! 	Alters: xcal_alarm.c, xcal_cal.c, *.bm xcal.c
! 
! 	The memo box quit button causes a Save File
! 	dialogue box to be popped if the memo data has been
! 	altered and not saved. The behaviour of this was wrong
! 	when there was no memo data.	Reported by Greg Bond.
! 	Fixed by changing tests in xcal_memo.c.
! 
! 	Proper length of a directory entry under SYSV is 
! 	strlen(dp->d_name) not strlen(dp->d_name)+1.
! 	Changed xcal_edit.c 			(Dave McCraken)
! 
! 	Eliminated double definition of GetMemoFile() and incorrect
! 	definition of MemoHelp() in xcal_memo.c (David C Lawrence)
! 
! --------------------------- 3.2 
! 
! Xcal - Version 3.2 Issued to comp.sources.x
! 
! 	Fixes some stupid bugs
! 	Ensures that update code works properly
! 
! ---------------------------- 3.1
! 
! Xcal - Version 3.1 Issued to comp.sources.x (un-intentionally)
  
  	Adds the memo functionality and the Stick/Unpin feature
  	for alarms.
*** README~	Fri Mar 22 23:34:53 1991
--- README	Fri Mar 22 23:48:23 1991
***************
*** 26,37 ****
  program. So you can generate pretty printed calendars whenever you
  like - assuming that you have a PostScript printer.
  
! This is release 3.2.
  The history is:
  	Release 1.1  posted to comp.sources.x
  		+ two patches
  	Release 2.1  circulated privately
! 	Release 3.1  circulated privately
  
  Caveats
  
--- 26,38 ----
  program. So you can generate pretty printed calendars whenever you
  like - assuming that you have a PostScript printer.
  
! This is release 3.3
  The history is:
  	Release 1.1  posted to comp.sources.x
  		+ two patches
  	Release 2.1  circulated privately
! 	Release 3.1  posted unintentionally to comp.sources.x
! 	Release 3.2  posted to comp.sources.x
  
  Caveats
  
***************
*** 48,54 ****
  Fax: +44 227 762554
  Email: pc at hillside.co.uk
  
! 18/December/1990
  
  Fixes/enhancements welcomed....
  
--- 49,55 ----
  Fax: +44 227 762554
  Email: pc at hillside.co.uk
  
! 22/March/1990
  
  Fixes/enhancements welcomed....
  
*** Imakefile~	Fri Mar 22 23:34:48 1991
--- Imakefile	Fri Mar 22 23:48:20 1991
***************
*** 1,22 ****
! LOCAL_LIBRARIES = XawClientLibs
!            INCS = xcal.h
!            SRCS = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c version.c
!            OBJS = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o version.o
   OSMAJORVERSION = OSMajorVersion
   OSMINORVERSION = OSMinorVersion
!       DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) -DVER_VEC
  
  
! AllTarget(xcal)
! NormalProgramTarget(xcal,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES), /**/)
  
! AllTarget(xcal_cal)
! NormalProgramTarget(xcal_cal, xcal_cal.o,/**/,/**/,/**/);
  
! InstallProgram(xcal, $(BINDIR))
! InstallManPage(xcal, $(MANDIR))
! InstallProgram(xcal_cal, $(BINDIR))
! InstallManPage(xcal_cal, $(MANDIR))
  InstallAppDefaults(XCal)
  
! DependTarget()
--- 1,35 ----
! /*
!  * Define InstallPsCal if you want to have pscal compiled and installed as
!  * part of the xcal compilation and installation.
!  */
! /* #define InstallPsCal */
! 
   OSMAJORVERSION = OSMajorVersion
   OSMINORVERSION = OSMinorVersion
!         DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \
! 		  -DOSMINORVERSION=$(OSMINORVERSION) \
! 		  -DVER_VEC
  
+           SRCS1 = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c \
+ 		  xcal_strip.c xcal_memo.c version.c
+           OBJS1 = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o \
+ 		  xcal_strip.o xcal_memo.o version.o
  
!           SRCS2 = xcal_cal.c
!           OBJS2 = xcal_cal.o
  
!        PROGRAMS = xcal xcal_cal
  
! ComplexProgramTarget_1(xcal, XawClientLibs, /**/)
! ComplexProgramTarget_2(xcal_cal, /**/, /**/)
  InstallAppDefaults(XCal)
  
! #ifdef InstallPsCal
! #define IHaveSubdirs
! #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
! 
!         SUBDIRS = pscal
! 
! MakeSubdirs($(SUBDIRS))
! DependSubdirs($(SUBDIRS))
! #endif
*** Makefile~	Fri Mar 22 23:34:55 1991
--- Makefile	Fri Mar 22 23:48:24 1991
***************
*** 225,273 ****
  ###########################################################################
  # start of Imakefile
  
- LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
-            INCS = xcal.h
-            SRCS = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c version.c
-            OBJS = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o version.o
   OSMAJORVERSION = 4
   OSMINORVERSION = 1
!       DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) -DVER_VEC
  
! all:: xcal
  
! xcal: $(OBJS) $(DEPLIBS)
! 	$(RM) $@
! 	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
  
! clean::
! 	$(RM) xcal
  
! all:: xcal_cal
  
! xcal_cal:  xcal_cal.o
  	$(RM) $@
! 	$(CC) -o $@  xcal_cal.o $(LDOPTIONS)  $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
  
- clean::
- 	$(RM) xcal_cal;
- 
  install:: xcal
! 	$(INSTALL) -c $(INSTPGMFLAGS)   xcal  $(BINDIR)
  
  install.man:: xcal.man
! 	$(INSTALL) -c $(INSTMANFLAGS) xcal.man  $(MANDIR)/xcal.n
  
  install:: xcal_cal
! 	$(INSTALL) -c $(INSTPGMFLAGS)   xcal_cal  $(BINDIR)
  
  install.man:: xcal_cal.man
! 	$(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man  $(MANDIR)/xcal_cal.n
  
  install:: XCal.ad
  	$(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal
- 
- depend::
- 	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  
  ###########################################################################
  # common rules for all Makefiles - do not edit
--- 225,284 ----
  ###########################################################################
  # start of Imakefile
  
   OSMAJORVERSION = 4
   OSMINORVERSION = 1
!         DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \
! 		  -DOSMINORVERSION=$(OSMINORVERSION) \
! 		  -DVER_VEC
  
!           SRCS1 = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c \
! 		  xcal_strip.c xcal_memo.c version.c
!           OBJS1 = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o \
! 		  xcal_strip.o xcal_memo.o version.o
  
!           SRCS2 = xcal_cal.c
!           OBJS2 = xcal_cal.o
  
!        PROGRAMS = xcal xcal_cal
  
!  OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
!  SRCS = $(SRCS1) $(SRCS2) $(SRCS3)
  
! all:: $(PROGRAMS)
! 
! xcal: $(OBJS1) $(DEPLIBS1)
  	$(RM) $@
! 	$(CC) -o $@ $(LDOPTIONS) $(OBJS1)  $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
  
  install:: xcal
! 	$(INSTALL) -c $(INSTPGMFLAGS)   xcal $(BINDIR)
  
  install.man:: xcal.man
! 	$(INSTALL) -c $(INSTMANFLAGS) xcal.man $(MANDIR)/xcal.n
  
+ depend::
+ 	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
+ 
+ lint:
+ 	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
+ lint1:
+ 	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
+ 
+ clean::
+ 	$(RM) $(PROGRAMS)
+ 
+ xcal_cal: $(OBJS2) $(DEPLIBS2)
+ 	$(RM) $@
+ 	$(CC) -o $@ $(LDOPTIONS) $(OBJS2)   $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
+ 
  install:: xcal_cal
! 	$(INSTALL) -c $(INSTPGMFLAGS)   xcal_cal $(BINDIR)
  
  install.man:: xcal_cal.man
! 	$(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man $(MANDIR)/xcal_cal.n
  
  install:: XCal.ad
  	$(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal
  
  ###########################################################################
  # common rules for all Makefiles - do not edit
*** XCal.ad~	Fri Mar 22 23:34:51 1991
--- XCal.ad	Fri Mar 22 23:48:21 1991
***************
*** 1,8 ****
  XCal.MarkForeground: Black
  XCal.MarkBackground: White
! XCal.edit.geometry: 300x150
! XCal.memo.geometry: 300x300
! XCal.alarm.geometry: 300x100+0+150
  XCal*help.geometry: 600x300
  XCal.fontToday: lucidasanstypewriter-12
  XCal*Font: lucidasanstypewriter-12
--- 1,8 ----
  XCal.MarkForeground: Black
  XCal.MarkBackground: White
! XCal.edit.geometry: 325x150
! XCal.memo.geometry: 325x300
! XCal.alarm.geometry: 325x100+0+150
  XCal*help.geometry: 600x300
  XCal.fontToday: lucidasanstypewriter-12
  XCal*Font: lucidasanstypewriter-12
***************
*** 40,45 ****
--- 40,48 ----
  XCal*alarmQuit.Label: Unpin
  XCal*alarmHold.Label: Stick
  XCal*memoTitle.Label: Edit the memo file
+ XCal*weeklyEdit.Label: Edit
+ XCal*weeklyTitle.Label: Today's regular events
+ 
  !
  ! Colours from reed wade at cs.utk.edu
  !
*** mouse.bm~	Fri Mar 22 23:34:58 1991
--- mouse.bm	Fri Mar 22 23:48:26 1991
***************
*** 1,6 ****
  #define mouse_width 16
  #define mouse_height 13
! static char mouse_bits[] = {
     0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5,
     0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
     0xff, 0xff};
--- 1,6 ----
  #define mouse_width 16
  #define mouse_height 13
! static unsigned char mouse_bits[] = {
     0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5,
     0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
     0xff, 0xff};
*** mouseaway.bm~	Fri Mar 22 23:34:58 1991
--- mouseaway.bm	Fri Mar 22 23:48:26 1991
***************
*** 1,6 ****
  #define mouseaway_width 16
  #define mouseaway_height 13
! static char mouseaway_bits[] = {
     0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5,
     0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
     0xff, 0xff};
--- 1,6 ----
  #define mouseaway_width 16
  #define mouseaway_height 13
! static unsigned char mouseaway_bits[] = {
     0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5,
     0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
     0xff, 0xff};
*** version.c~	Fri Mar 22 23:34:48 1991
--- version.c	Fri Mar 22 23:48:20 1991
***************
*** 1,10 ****
  #ifndef lint
! static char *sccsid = "@(#)version.c	3.2 (Hillside Systems) 12/18/90";
  #endif  /* lint */
  /*
   *	Version control file
!  *	version.c	3.2	12/18/90
!  *	Automatically created on Tue Dec 18 21:15:55 GMT 1990
   *	
   *	Hand edit none of this if you want freeze to continue to work
   */
--- 1,10 ----
  #ifndef lint
! static char *sccsid = "@(#)version.c	3.3 (Hillside Systems) 3/22/91";
  #endif  /* lint */
  /*
   *	Version control file
!  *	version.c	3.3	3/22/91
!  *	Automatically created on Fri Mar 22 23:48:16 GMT 1991
   *	
   *	Hand edit none of this if you want freeze to continue to work
   */
***************
*** 12,43 ****
  #define	PROGNAME	XCal
  #endif
  #ifdef	VER_VEC
! char	version[] = "XCal Version 3.2, released Tue Dec 18 21:15:55 GMT 1990";
  #endif
  #ifdef	VER_DEF
! #define	VERSION	"XCal Version 3.2, released Tue Dec 18 21:15:55 GMT 1990"
  #endif
  
  /*	SCCS files
   *
! +1.7	Imakefile
! +3.5	xcal_help.c
! +1.4	xcal_cal.c
! +1.12	xcal.man
! +1.5	xcal_memo.c
! +1.10	XCal.ad
! +1.10	xcal_alarm.c
! +3.9	xcal_edit.c
! +1.4	README
! +2.1	patchlevel.h
! +3.6	xcal_strip.c
  +1.2	xcal_cal.man
! +1.8	Makefile
! +3.4	xcal_popup.c
! +3.13	xcal.c
! +3.8	xcal.h
! +2.2	CHANGES
! +1.1	mouse.bm
! +1.1	mouseaway.bm
   *
   */
--- 12,43 ----
  #define	PROGNAME	XCal
  #endif
  #ifdef	VER_VEC
! char	version[] = "XCal Version 3.3, released Fri Mar 22 23:48:16 GMT 1991";
  #endif
  #ifdef	VER_DEF
! #define	VERSION	"XCal Version 3.3, released Fri Mar 22 23:48:16 GMT 1991"
  #endif
  
  /*	SCCS files
   *
! +1.9	Imakefile
! +3.6	xcal_help.c
! +1.6	xcal_cal.c
! +1.17	xcal.man
! +1.11	xcal_memo.c
! +1.13	XCal.ad
! +1.13	xcal_alarm.c
! +3.15	xcal_edit.c
! +1.6	README
! +2.2	patchlevel.h
! +3.10	xcal_strip.c
  +1.2	xcal_cal.man
! +1.10	Makefile
! +3.5	xcal_popup.c
! +3.22	xcal.c
! +3.14	xcal.h
! +2.12	CHANGES
! +1.2	mouse.bm
! +1.2	mouseaway.bm
   *
   */
*** xcal.c~	Fri Mar 22 23:34:56 1991
--- xcal.c	Fri Mar 22 23:48:25 1991
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal.c	3.13 (Hillside Systems) 12/7/90";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal.c	3.22 (Hillside Systems) 1/16/91";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
***************
*** 13,18 ****
--- 13,19 ----
  	-format str	use str as a display format
  	-order	ord	set the argument order to this
  	-debug		run quickly incrementing time - 1 day per sec
+ 	-alarmscan	print alarm debug info
  * libraries used:
  	libXaw.a, libXmu.a libXt.a libX11.a
  * compile time parameters:
***************
*** 91,96 ****
--- 92,99 ----
  	offset(initialCalendar), XtRString, "False" },
  {"initialEdit", "InitialEdit", XtRBoolean, sizeof(Boolean),
  	offset(initialEdit), XtRString, "False" },
+ {"initialMemo", "InitialMemo", XtRBoolean, sizeof(Boolean),
+ 	offset(initialMemo), XtRString, "False" },
  {"markForeground", "MarkForeground", XtRPixel, sizeof(Pixel),
  	offset(marked.fg), XtRString, "White" },
  {"markBackground", "MarkBackground", XtRPixel, sizeof(Pixel),
***************
*** 104,112 ****
  {"todayBackground", "TodayBackground", XtRPixel, sizeof(Pixel),
  	offset(today.bg), XtRString, "Black" },
  {"format", "Format",XtRString, sizeof(String),
! 	offset(opfmt), XtRString, "%2d %s %d"},
  {"order", "Order", XtRString, sizeof(String),
! 	offset(order), XtRString, "dmy"},
  {"directory", "Directory", XtRString, sizeof(String),
  	offset(directory), XtRString, "Calendar"},
  {"textBufferSize", "TextBufferSize", XtRInt, sizeof(int),
--- 107,121 ----
  {"todayBackground", "TodayBackground", XtRPixel, sizeof(Pixel),
  	offset(today.bg), XtRString, "Black" },
  {"format", "Format",XtRString, sizeof(String),
! 	offset(opfmt), XtRString, "%s %2d %s %d"},
  {"order", "Order", XtRString, sizeof(String),
! 	offset(order), XtRString, "wdmy"},
! {"dateYearIsTwoDigits", "DateYearIsTwoDigits", XtRBoolean, sizeof(Boolean),
! 	offset(dateYearIs2), XtRString, "False" },
! {"editYearIsTwoDigits", "EditYearIsTwoDigits", XtRBoolean, sizeof(Boolean),
! 	offset(editYearIs2), XtRString, "False" },
! {"memoYearIsTwoDigits", "MemoYearIsTwoDigits", XtRBoolean, sizeof(Boolean),
! 	offset(memoYearIs2), XtRString, "False" },
  {"directory", "Directory", XtRString, sizeof(String),
  	offset(directory), XtRString, "Calendar"},
  {"textBufferSize", "TextBufferSize", XtRInt, sizeof(int),
***************
*** 164,182 ****
  {"dec", "Dec", XtRString, sizeof(String),
  	offset(smon[11]), XtRString, "Dec"},
  {"sunday", "Sunday", XtRString, sizeof(String),
! 	offset(day[0]), XtRString, "Sun"},
  {"monday", "Monday", XtRString, sizeof(String),
! 	offset(day[1]), XtRString, "Mon"},
  {"tuesday", "Tuesday", XtRString, sizeof(String),
! 	offset(day[2]), XtRString, "Tue"},
  {"wednesday", "Wednesday", XtRString, sizeof(String),
! 	offset(day[3]), XtRString, "Wed"},
  {"thursday", "Thursday", XtRString, sizeof(String),
! 	offset(day[4]), XtRString, "Thu"},
  {"friday", "Friday", XtRString, sizeof(String),
! 	offset(day[5]), XtRString, "Fri"},
  {"saturday", "Saturday", XtRString, sizeof(String),
! 	offset(day[6]), XtRString, "Sat"},
  {"alarms", "Alarms", XtRBoolean, sizeof(Boolean),
  	offset(alarms), XtRString, "True"},
  {"update", "Update", XtRInt, sizeof(int),
--- 173,207 ----
  {"dec", "Dec", XtRString, sizeof(String),
  	offset(smon[11]), XtRString, "Dec"},
  {"sunday", "Sunday", XtRString, sizeof(String),
! 	offset(day[0]), XtRString, "Sunday"},
  {"monday", "Monday", XtRString, sizeof(String),
! 	offset(day[1]), XtRString, "Monday"},
  {"tuesday", "Tuesday", XtRString, sizeof(String),
! 	offset(day[2]), XtRString, "Tuesday"},
  {"wednesday", "Wednesday", XtRString, sizeof(String),
! 	offset(day[3]), XtRString, "Wednesday"},
  {"thursday", "Thursday", XtRString, sizeof(String),
! 	offset(day[4]), XtRString, "Thursday"},
  {"friday", "Friday", XtRString, sizeof(String),
! 	offset(day[5]), XtRString, "Friday"},
  {"saturday", "Saturday", XtRString, sizeof(String),
! 	offset(day[6]), XtRString, "Saturday"},
! {"sun", "Sun", XtRString, sizeof(String),
! 	offset(sday[0]), XtRString, "Sun"},
! {"mon", "Mon", XtRString, sizeof(String),
! 	offset(sday[1]), XtRString, "Mon"},
! {"tue", "Tue", XtRString, sizeof(String),
! 	offset(sday[2]), XtRString, "Tue"},
! {"wed", "Wed", XtRString, sizeof(String),
! 	offset(sday[3]), XtRString, "Wed"},
! {"thu", "Thu", XtRString, sizeof(String),
! 	offset(sday[4]), XtRString, "Thu"},
! {"fri", "Fri", XtRString, sizeof(String),
! 	offset(sday[5]), XtRString, "Fri"},
! {"sat", "Sat", XtRString, sizeof(String),
! 	offset(sday[6]), XtRString, "Sat"},
! {"weekly", "Weekly", XtRString, sizeof(String),
! 	offset(weekly), XtRString, "Weekly"},
  {"alarms", "Alarms", XtRBoolean, sizeof(Boolean),
  	offset(alarms), XtRString, "True"},
  {"update", "Update", XtRInt, sizeof(int),
***************
*** 231,240 ****
  /*
   *	Forward routines local to this file
   */
! void	MkDate();
! void	DebugMkDate();
! void	DoTemplate();
! void	DecodeOrder();
  #include "mouse.bm"
  #include "mouseaway.bm"
  
--- 256,267 ----
  /*
   *	Forward routines local to this file
   */
! static void	MkDate();
! static void	DebugMkDate();
! static void	DoTemplate();
! static void	DecodeOrder();
! static void	PixInit();
! 
  #include "mouse.bm"
  #include "mouseaway.bm"
  
***************
*** 362,367 ****
--- 389,396 ----
  	}
  	XtAddActions(appActions, 3);	/* register actions */
  	XtAugmentTranslations(lab, XtParseTranslationTable(defTranslations));
+ 	if (appResources.useMemo)
+ 		XtAugmentTranslations(memo, XtParseTranslationTable(defTranslations));
  
  	XtMapWidget(toplevel);
  
***************
*** 377,390 ****
--- 406,424 ----
  			StartEditing(lab, &today);
  	}
  
+ 	if (appResources.useMemo && appResources.initialMemo)
+ 		DoMemo(memo, NULL, NULL);
+ 		
  	InitAlarms();
  	
  	XtMainLoop();
+ 	exit(0);
  }
  
  /*
   *	Initialise Pixmaps
   */
+ static void
  PixInit(toplevel)
  	Widget	toplevel;
  {
***************
*** 392,406 ****
  
  	MouseOnPix = XCreateBitmapFromData(theDisplay,
  			      DefaultRootWindow(theDisplay),
! 			      mouse_bits, mouse_width, mouse_height);
  	MouseOffPix = XCreateBitmapFromData(theDisplay,
  			      DefaultRootWindow(theDisplay),
! 			      mouseaway_bits, mouseaway_width, mouseaway_height);
  }
  
  /*
   *	Flip mouse state
   */
  MouseShow(w, OnOff)
  	Widget	w;
  	Boolean OnOff;
--- 426,441 ----
  
  	MouseOnPix = XCreateBitmapFromData(theDisplay,
  			      DefaultRootWindow(theDisplay),
! 			      (char *)mouse_bits, mouse_width, mouse_height);
  	MouseOffPix = XCreateBitmapFromData(theDisplay,
  			      DefaultRootWindow(theDisplay),
! 			      (char *)mouseaway_bits, mouseaway_width, mouseaway_height);
  }
  
  /*
   *	Flip mouse state
   */
+ void
  MouseShow(w, OnOff)
  	Widget	w;
  	Boolean OnOff;
***************
*** 417,422 ****
--- 452,458 ----
   */
  void
  Leave(retval)
+ 	int retval;
  {	exit(retval);
  }
  
***************
*** 440,445 ****
--- 476,482 ----
  	dp->day = tm->tm_mday;
  	dp->month = tm->tm_mon;
  	dp->year = tm->tm_year + 1900;
+ 	dp->wday = tm->tm_wday;
  }
  
  
***************
*** 454,466 ****
  	if (timedOut)
  		yesterday = today;
  		
! 	ti = time(0);
  	tm = localtime(&ti);
  
  	ConvDate(tm, &today);
  
! 	PlaceStr(date_area,
! 			tm->tm_mday, appResources.mon[tm->tm_mon], tm->tm_year);
  	XtSetValues(w, wargs, 1);
  
  	if (timedOut)
--- 491,503 ----
  	if (timedOut)
  		yesterday = today;
  		
! 	(void) time(&ti);
  	tm = localtime(&ti);
  
  	ConvDate(tm, &today);
  
! 	PlaceStr(date_area, &today, appResources.dateYearIs2);
! 
  	XtSetValues(w, wargs, 1);
  
  	if (timedOut)
***************
*** 486,499 ****
  		yesterday = today;
  		
  	if (ti == 0)
! 		ti = time(0);
  	else	ti += 24*60*60;
  	
  	tm = localtime(&ti);
  	ConvDate(tm, &today);
  	
! 	PlaceStr(date_area,
! 		  tm->tm_mday, appResources.mon[tm->tm_mon], tm->tm_year);
  	XtSetValues(w, wargs, 1);
  
  	if (timedOut)
--- 523,536 ----
  		yesterday = today;
  		
  	if (ti == 0)
! 		(void) time(&ti);
  	else	ti += 24*60*60;
  	
  	tm = localtime(&ti);
  	ConvDate(tm, &today);
  	
! 	PlaceStr(date_area, &today, appResources.dateYearIs2);
! 
  	XtSetValues(w, wargs, 1);
  
  	if (timedOut)
***************
*** 513,529 ****
   */
  static void
  DoTemplate()
! {	int	maxmon;
  	int	i;
  	int	len;
  	char	trial[BUFSIZ];
  
  
! 	for (maxmon = i = 0; i < 12; i++)
! 	{	PlaceStr(trial, 99, appResources.mon[i], 99);
  		len = strlen(trial);
! 		if (len > maxmon)
! 		{	maxmon = len;
  			strcpy(date_area, trial);
  		}
  	}
--- 550,578 ----
   */
  static void
  DoTemplate()
! {	int	max;
  	int	i;
  	int	len;
  	char	trial[BUFSIZ];
+ 	Date	da;
  
+ 	da.day = 99;
+ 	da.year = 9999;
  
! 	for (da.wday = max = i = 0; i < 7; i++)
! 	{	len = strlen(appResources.day[i]);
! 		if (len > max)
! 		{	max = len;
! 			da.wday = i;
! 		}
! 	}
! 
! 	for (max = i = 0; i < 12; i++)
! 	{	da.month = i;
! 		PlaceStr(trial, &da, appResources.dateYearIs2);
  		len = strlen(trial);
! 		if (len > max)
! 		{	max = len;
  			strcpy(date_area, trial);
  		}
  	}
***************
*** 536,565 ****
  DecodeOrder()
  {
  	register char	*p;
! 
  	p = appResources.order;
  
! 	if (*p == 'd' && strcmp(p, "dmy") == 0)
! 		appResources.val_order = O_DMY;
  	else
  	if (*p == 'y')
! 	{	if (strcmp(p, "ymd") == 0)
! 			appResources.val_order = O_YMD;
  		else
! 		if (strcmp(p, "ydm") == 0)
! 			appResources.val_order = O_YDM;
  		else
! 			appResources.val_order = -1;
  	}
  	else
! 	if (*p == 'm' && strcmp(p, "mdy") == 0)
! 		appResources.val_order = O_MDY;
  	else
! 		appResources.val_order = -1;
! 	if (appResources.val_order == -1)
  	{	fprintf(stderr, "Unknown order: %s\n", p);
! 		appResources.val_order = O_DMY;
  	}
  }
  			
  /*
--- 585,626 ----
  DecodeOrder()
  {
  	register char	*p;
! 	int	order = 0;
! 	int	addweekday = 0;
! 	
  	p = appResources.order;
  
! 	if (*p == 'w')
! 	{	addweekday = O_WEEKLEFT;
! 		p++;
! 	}
! 	
! 	if (*p == 'd' && strncmp(p, "dmy", 3) == 0)
! 		order = O_DMY;
  	else
  	if (*p == 'y')
! 	{	if (strncmp(p, "ymd", 3) == 0)
! 			order = O_YMD;
  		else
! 		if (strncmp(p, "ydm", 3) == 0)
! 			order = O_YDM;
  		else
! 			order = -1;
  	}
  	else
! 	if (*p == 'm' && strncmp(p, "mdy", 3) == 0)
! 		order = O_MDY;
  	else
! 		order = -1;
! 	if (order == -1)
  	{	fprintf(stderr, "Unknown order: %s\n", p);
! 		order = O_DMY;
  	}
+ 
+ 	if (addweekday == 0 && p[3] == 'w')
+ 		addweekday = O_WEEKRIGHT;
+ 
+ 	appResources.val_order = order | addweekday;
  }
  			
  /*
***************
*** 566,581 ****
   *	make a string
   */
  void
! PlaceStr(dest, d, m, y)
  	String	dest;
! 	int	d;
! 	String	m;
! 	int	y;
  {
  	register String fmt;
  
  	if (y > 99 && y < 1900)
  		y -= 100;
  		
  	fmt = appResources.opfmt;
  	
--- 627,648 ----
   *	make a string
   */
  void
! PlaceStr(dest, da, is2)
  	String	dest;
! 	Date	*da;
! 	Boolean is2;
  {
  	register String fmt;
+ 	int	d = da->day;
+ 	String	m = appResources.mon[da->month];
+ 	int	y = da->year;
+ 	String	w = appResources.day[da->wday];
  
  	if (y > 99 && y < 1900)
  		y -= 100;
+ 
+ 	if (is2)
+ 		y %= 100;
  		
  	fmt = appResources.opfmt;
  	
***************
*** 584,597 ****
--- 651,688 ----
  	case O_DMY:		/* default */
  		(void) sprintf(dest, fmt, d, m, y);
  		break;
+ 	case O_DMY|O_WEEKLEFT:
+ 		(void) sprintf(dest, fmt, w, d, m, y);
+ 		break;
+ 	case O_DMY|O_WEEKRIGHT:
+ 		(void) sprintf(dest, fmt, d, m, y, w);
+ 		break;
  	case O_YMD:		/* Year/Month/Day */
  		(void) sprintf(dest, fmt, y, m, d);
  		break;
+ 	case O_YMD|O_WEEKLEFT:	/* Year/Month/Day */
+ 		(void) sprintf(dest, fmt, w, y, m, d);
+ 		break;
+ 	case O_YMD|O_WEEKRIGHT:	/* Year/Month/Day */
+ 		(void) sprintf(dest, fmt, y, m, d, w);
+ 		break;
  	case O_MDY:		/* Month/Day/Year */
  		(void) sprintf(dest, fmt, m, d, y);
  		break;
+ 	case O_MDY|O_WEEKLEFT:	/* Month/Day/Year */
+ 		(void) sprintf(dest, fmt, w, m, d, y);
+ 		break;
+ 	case O_MDY|O_WEEKRIGHT:	/* Month/Day/Year */
+ 		(void) sprintf(dest, fmt, m, d, y, w);
+ 		break;
  	case O_YDM:		/* Year/Day/Month */
  		(void) sprintf(dest, fmt, y, d, m);
+ 		break;
+ 	case O_YDM|O_WEEKLEFT:	/* Year/Day/Month */
+ 		(void) sprintf(dest, fmt, w, y, d, m);
+ 		break;
+ 	case O_YDM|O_WEEKRIGHT:	/* Year/Day/Month */
+ 		(void) sprintf(dest, fmt, y, d, m, w);
  		break;
  	}
  }
*** xcal.h~	Fri Mar 22 23:34:57 1991
--- xcal.h	Fri Mar 22 23:48:25 1991
***************
*** 1,5 ****
  /*
!  *	xcal.h	3.8	12/12/90
   *
   *	Header file for the xcal program
   */
--- 1,5 ----
  /*
!  *	xcal.h	3.14	1/16/91
   *
   *	Header file for the xcal program
   */
***************
*** 10,28 ****
   *	so undef if not true
   *	and fiddle with the definitions below
   */
! #define	LONG_IS_32_BITS
  
  /* pack year and month into Cardinals */
  #ifdef LONG_IS_32_BITS
! #define	DatePack(d, m, y)	((((d)&0x1f)<<16) | (((m)&0xf)<<12) | ((y)&0xfff))
  #define YrUnpack(v)	((v)&0xfff)
  #define MoUnpack(v)	(((v)>>12)&0xf)
  #define DyUnpack(v)	(((v)>>16)&0x1f)
! #else  LONG_IS_32_BITS
  #define	DatePack(m, y)	((((m)&0xf)<<12) | ((y)&0xfff))
  #define YrUnpack(v)	((v)&0xfff)
  #define MoUnpack(v)	(((v)>>12)&0xf)
! #endif  LONG_IS_32_BITS
  
  /*
   *	Foreground/Background colours
--- 10,32 ----
   *	so undef if not true
   *	and fiddle with the definitions below
   */
! /* #define	LONG_IS_32_BITS */
  
  /* pack year and month into Cardinals */
  #ifdef LONG_IS_32_BITS
! #define	DatePack(w, d, m, y)	((((w)&0x7)<<21) | (((d)&0x1f)<<16) | (((m)&0xf)<<12) | ((y)&0xfff))
  #define YrUnpack(v)	((v)&0xfff)
  #define MoUnpack(v)	(((v)>>12)&0xf)
  #define DyUnpack(v)	(((v)>>16)&0x1f)
! #define WdUnpack(v)	(((v)>>21)&0x7)
! #else /*  LONG_IS_32_BITS */
  #define	DatePack(m, y)	((((m)&0xf)<<12) | ((y)&0xfff))
+ #define DayPack(w, d)	((((w)&0x7)<<5) | ((d)&0x1f))
  #define YrUnpack(v)	((v)&0xfff)
  #define MoUnpack(v)	(((v)>>12)&0xf)
! #define DyUnpack(v)	((v)&0x1f)
! #define WdUnpack(v)	(((v)>>5)&0xf)
! #endif /* LONG_IS_32_BITS */
  
  /*
   *	Foreground/Background colours
***************
*** 47,55 ****
  	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 */
  	String	opfmt;		/* format for main box */
  	String	order;		/* Orders are dmy/ymd/mdy/ydm */
  	int	val_order;	/* The selected order */
--- 51,65 ----
  	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 */
+ 	Boolean	initialMemo;	/* Pop up memo box on start */
+ 	Boolean	dateYearIs2;	/* Display year as two digits in date strip  */
+ 	Boolean	editYearIs2;	/* Display year as two digits in edit strip  */
+ 	Boolean	memoYearIs2;	/* Display year as two digits in memo strip  */
  	String	mon[12];	/* Long month names */
  	String	smon[12];	/* Short month names */
! 	String	day[7];		/* Day names - full */
! 	String	sday[7];	/* Short day names */
! 	String	weekly;		/* Title of weekly edit strip */
  	String	opfmt;		/* format for main box */
  	String	order;		/* Orders are dmy/ymd/mdy/ydm */
  	int	val_order;	/* The selected order */
***************
*** 65,72 ****
  	int	update;		/* interval between peeks (60 secs) */
  	int	volume;		/* how loud to beep the alarm 0-100 */
  	int	nbeeps;		/* how many beeps for an alarm ? */
- 	long	last_size;	/* save the last time size */
- 	long	last_time;	/* save the last time file accessed */
  	int	autoquit;	/* Automatically delete message boxes */
  	String	countdown;	/* Comma separated countdown string for alarms */
  	String	cmd;		/* command to execute for every alarm */
--- 75,80 ----
***************
*** 85,94 ****
  /*
   *	Order coding inserted into val_order
   */
! #define	O_DMY	0		/* default */
! #define O_YMD	1		/* Year/Month/Day */
! #define O_MDY	2		/* Month/Day/Year */
! #define O_YDM	3		/* Year/Day/Month */
  
  /*
   *	Date structure
--- 93,105 ----
  /*
   *	Order coding inserted into val_order
   */
! #define	O_DMY		0	/* default */
! #define O_YMD		1	/* Year/Month/Day */
! #define O_MDY		2	/* Month/Day/Year */
! #define O_YDM		3	/* Year/Day/Month */
! #define	O_WEEKLEFT	4	/* Place day of the week on the left */
! #define O_WEEKRIGHT	8	/* Place day of the week on the right */
! #define	O_WEEKMASK	O_WEEKLEFT|O_WEEKRIGHT
  
  /*
   *	Date structure
***************
*** 97,102 ****
--- 108,114 ----
  {	Cardinal	day;
  	Cardinal	month;
  	Cardinal	year;
+ 	Cardinal	wday;
  } Date;
  
  /*
***************
*** 108,115 ****
--- 120,131 ----
  	Cardinal	me_month;	/* which month */
  	String		me_have[32];	/* if a file present for the day */
  					/* then will have a non-zero entry */
+ 	int		me_type;	/* type of displayed strip */
  } MonthEntry;
  
+ #define ME_MONTHLY	1		/* `Normal' monthly strip */
+ #define ME_WEEKLY	2		/* Weekly strip */
+ 
  /*
   *	An instance of the strip
   */
***************
*** 150,156 ****
--- 166,175 ----
  /*
   *	Global routines
   */
+ void	InitAlarms();
+ void	MouseShow();
  void	Leave();
+ void	Fatal();
  void	SetDate();
  void	AskLeave();
  void	DialogPopup();
***************
*** 158,171 ****
--- 177,198 ----
  void	TextCal();
  void	DoCalendar();
  void	DoMemo();
+ void	DoWeekly();
  void	MemoPoll();
  void	NewMonthStrip();
  void	InitMonthEntries();
  void	ChangeHighlight();
  void	NoEditIsPossible();
+ void	NoDayEditIsPossible();
  void	StartEditing();
  MonthEntry *GetMonthEntry();
+ MonthEntry *GetWeeklyEntry();
  void	AlarmFilePoll();
  String	ReadCalendarFile();
  void	UpdateMemo();
  void	PlaceStr();
+ String	MakeWeeklyName();
+ String	GetWeeklyFile();
+ Boolean	NeedTop();
+ 
+ time_t	time();
*** xcal.man~	Fri Mar 22 23:34:50 1991
--- xcal.man	Fri Mar 22 23:48:21 1991
***************
*** 21,28 ****
  program.
  The format of the command box may be altered using the resource manager, so you
  are not stuck with my preferred format.
! A small button in the top level window can be pressed to inspect todays
! appointments and also to edit or display a memo file.
  .LP
  The calendar and notebook functions are accessed by clicking the mouse
  buttons inside date portion of the command window.
--- 21,31 ----
  program.
  The format of the command box may be altered using the resource manager, so you
  are not stuck with my preferred format.
! A small button in the top level window can be pressed to
! inspect appointments for today.
! This generates a panel showing information from the calendar file for today and
! information from a set of seven daily files holding regular commitments.
! Finally, the memo panel displays and allows the edit of a memo file.
  .LP
  The calendar and notebook functions are accessed by clicking the mouse
  buttons inside date portion of the command window.
***************
*** 113,123 ****
  .I Xcal
  is accessed by pressing the non-date portion of the command window.
  Currently this shows a bitmap diagram of three mouse buttons.
! Clicking the left mouse button in this area brings up a complex panel.
  The top half of the panel displays the information held in the diary
  for today; you cannot edit the data from here \- and must open the
  diary strip to change the data.
! The bottom half of the panel is an edit window displaying the contents
  of a file usually called `memo' in the Calendar directory.
  The idea of this panel is to allow you to access your current information
  in one button click.
--- 116,132 ----
  .I Xcal
  is accessed by pressing the non-date portion of the command window.
  Currently this shows a bitmap diagram of three mouse buttons.
! Clicking the left mouse button in this area brings up a complex panel,
! clicking on the button again will pop is back down again.
  The top half of the panel displays the information held in the diary
  for today; you cannot edit the data from here \- and must open the
  diary strip to change the data.
! The next section of the panel displays the information held in the
! weekly files.
! Again you cannot directly change the text in this area, you must
! press on the Edit button to bring up a strip enabling you to
! change things.
! The bottom portion of the panel is an edit window displaying the contents
  of a file usually called `memo' in the Calendar directory.
  The idea of this panel is to allow you to access your current information
  in one button click.
***************
*** 197,202 ****
--- 206,224 ----
  			info	command containing the file data
  .EE
  .LP
+ The weekly popup strip is:
+ .EX
+ weekly				the popup shell
+ 	weekly			panel containing the strip
+ 		header		label containing the title
+ 		action		form containing quit and help
+ 			quit	command containing exit button
+ 			help	command generating help
+ 		shortday	form containing days
+ 			label	label containing day of the week
+ 			info	command containing the file data
+ .EE
+ .LP
  The Edit Window is:
  .EX
  edit				the popup shell
***************
*** 203,209 ****
  	panel			the panel inside the shell
  		title		the form containing the first line
  			quit	the exit button
! .EE
  .LP
  The Help Window is:
  .EX
--- 225,231 ----
  	panel			the panel inside the shell
  		title		the form containing the first line
  			quit	the exit button
! .EE	
  .LP
  The Help Window is:
  .EX
***************
*** 234,239 ****
--- 256,265 ----
  			help	the help button
  			date	display today's date
  		display		text from today's date file
+ 		weeklyMemo	form for the Memo title line
+ 			weeklyEdit	Edit button
+ 			weeklyTitle	Title area
+ 2		display		text from today's weekly file
  		memoMiddle	Middle line form widget
  			save	Save button
  			memoTitle	text title of middle line
***************
*** 299,316 ****
  If true display the output in reverse video.
  .IP
  .B Format
! The \fIprintf\fP string used to create the contents of the top command
! button.
! The default is "%2d %s %d", the arguments to this command are presented
  in a default order: day, month string and year.
! The order is controlled by the Order resource which contains the default
! string "dmy".
! These two resources should allow all forms of date printing.
  .TP
  .B Order
! Legal combinations are: dmy, ymd, mdy, ydm.
! The default is dmy.
  .TP
  .B MarkBackground
  The background colour for highlighting entries.
  Default Black.
--- 325,371 ----
  If true display the output in reverse video.
  .IP
  .B Format
! The \fIprintf\fP format used to create the contents of the top command button,
! the title in an edit window and the title in the memo window.
! The default is "%s %2d %s %d", the arguments to this command are presented
  in a default order: day, month string and year.
! The order is controlled by the Order resource, this contains the default
! string "wdmy".
  .TP
  .B Order
! This resource gives the order that various arguments are presented to the
! printf using the format string defined above.
! Legal combinations using day, month and year are: dmy, ymd, mdy, ydm.
! The name of today can be inserted at the start of the string by
! using one of the formats: wdmy, wymd, wmdy, wydm.
! It can be entered at the end by using on of the formats: dmyw, ymdw, mdyw, ydmw.
! In case you are wondering the `w' stands for `day' of the week.
! Beware that altering this resource from
! the default may force you to change the format string,
! see the previous resource.
! The default is wdmy.
  .TP
+ .B DateYearIsTwoDigits
+ The display of the year in the date strip is controlled
+ the format above.
+ If this resource is true then the year will be displayed as a two
+ digit number; if false the whole four digits will be displayed.
+ Default: False.
+ .TP
+ .B EditYearIsTwoDigits
+ The display of the year in the edit boxes is controlled by
+ the format above.
+ If this resource is true then the year will be displayed as a two
+ digit number; if false the whole four digits will be displayed.
+ Default: False.
+ .TP
+ .B MemoYearIsTwoDigits
+ The display of the year in the memo box is controlled
+ the format above.
+ If this resource is true then the year will be displayed as a two
+ digit number; if false the whole four digits will be displayed.
+ Default: False.
+ .TP
  .B MarkBackground
  The background colour for highlighting entries.
  Default Black.
***************
*** 362,367 ****
--- 417,426 ----
  If False, the edit window is not automatically displayed.
  Default: False.
  .TP
+ .B InitialMemo
+ If True then the memo window is automatically displayed on startup.
+ 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
***************
*** 485,491 ****
  .B Sunday
  .B Monday
  and so on.
! The names of the days, these are currently set to a three character short form.
  .SH FILES
  .PP
   $HOME/Calendar/*
--- 544,560 ----
  .B Sunday
  .B Monday
  and so on.
! The \fIlong\fP names of the days: Sunday, Monday etc.
! These are used in titles: the top level widget, the title of an edit window
! and the memo frame.
! .TP
! .B Sun
! .B Mon
! and so on.
! The short names of the days \- used in date strips.
! .TP
! .B Weekly
! The word `Weekly' used in various places.
  .SH FILES
  .PP
   $HOME/Calendar/*
***************
*** 496,501 ****
--- 565,576 ----
  .TP
  xy<Year>
  A year directory.
+ .TP
+ xw<Day>
+ A data file for the weekly code, one per day.
+ .TP
+ memo
+ The memo file.
  .LP
  The standard resource database can be found in /usr/lib/X11/app-defaults/Xcal.
  Assuming that this is where the system admin installed it.
***************
*** 514,519 ****
--- 589,596 ----
  Countdown does not work in the early hours of the morning, if you have a
  ten minute countdown and an alarm set at 0005 \- then you will not get
  warning at 2325.
+ .LP
+ Alarms set at 0000 probably won't work.
  .SH AUTHOR
  .LP
  Copyright 1989,1990 by Peter Collinson, Hillside Systems
*** xcal_alarm.c~	Fri Mar 22 23:34:52 1991
--- xcal_alarm.c	Fri Mar 22 23:48:22 1991
***************
*** 1,5 ****
  #ifndef lint
! static char    *sccsid = "@(#)xcal_alarm.c	1.10 (Hillside Systems) 12/12/90";
  static char    *copyright = "@(#)Copyright 1989/1990 Mark Majhor, Peter Collinson";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char    *sccsid = "@(#)xcal_alarm.c	1.13 (Hillside Systems) 1/16/91";
  static char    *copyright = "@(#)Copyright 1989/1990 Mark Majhor, Peter Collinson";
  #endif  /* lint */
  /***
***************
*** 44,54 ****
  #define scrollVertical	0x02
  #endif
  
! static struct stat stbuf;
! static Boolean  false = False;
! static Boolean  true = True;
! static char    *LocalMapStem;
! static Boolean  LocalFoundCalendarFile;
  static Alarm	head;
  static int	*countDown;
  static int	countDownCt;
--- 44,51 ----
  #define scrollVertical	0x02
  #endif
  
! static char	*LocalMapStem;
! static char	*TodayFile;
  static Alarm	head;
  static int	*countDown;
  static int	countDownCt;
***************
*** 169,175 ****
  	struct	tm	*tm;
  {
  	time_t	ti;
! 	struct	stat stbuf;
  	char	*home;
  	char	buf[256];
  	char	*getenv();
--- 166,172 ----
  	struct	tm	*tm;
  {
  	time_t	ti;
! 	int	files;
  	char	*home;
  	char	buf[256];
  	char	*getenv();
***************
*** 209,236 ****
  		if (LocalMapStem)
  			XtFree(LocalMapStem);
  		LocalMapStem = XtNewString(buf);
! 		dprintf("Todays Filename = %s\n", LocalMapStem);
  	}
  
  	/*
  	 *	check for file existence
  	 */
! 	if (access(LocalMapStem, F_OK))
! 	{	FreeAlarmList();
! 		UpdateMemo();
! 		return;
! 	}
  
! 	if (stat(LocalMapStem, &stbuf) < 0)
! 		Fatal("Panic: cannot stat %s\n", LocalMapStem);
  
! 	if (stbuf.st_size != appResources.last_size ||
! 	    stbuf.st_mtime > appResources.last_time)
! 	{	appResources.last_size = stbuf.st_size;
! 		appResources.last_time = stbuf.st_mtime;
! 		AlarmScan(LocalMapStem, tm, MINUTES(tm->tm_hour, tm->tm_min));
! 		UpdateMemo();
  	}
  }
  
  static void
--- 206,240 ----
  		if (LocalMapStem)
  			XtFree(LocalMapStem);
  		LocalMapStem = XtNewString(buf);
! 		dprintf("Todays Daily Filename = %s\n", LocalMapStem);
! 
! 		if (TodayFile)
! 			XtFree(TodayFile);
! 
! 		TodayFile = MakeWeeklyName(today.wday);
  	}
  
+ 	files = 0;
  	/*
  	 *	check for file existence
  	 */
! 	if (access(LocalMapStem, F_OK) == 0)
! 		files = 1;
! 	if (access(TodayFile, F_OK) == 0)
! 		files |= 2;
  
! 	FreeAlarmList();
  
! 	if (files)
! 	{	if (files&1)
! 			AlarmScan(LocalMapStem, tm, MINUTES(tm->tm_hour, tm->tm_min));
! 		if (files&2)
! 			AlarmScan(TodayFile, tm, MINUTES(tm->tm_hour, tm->tm_min));
  	}
+ 	else
+ 		dprintf("No files to scan");
+ 
+ 	UpdateMemo();
  }
  
  static void
***************
*** 247,256 ****
  	Boolean		isAction;
  
  
! 	dprintf("Scanning data file\n");
  
- 	FreeAlarmList();
- 
  	if ((fp = fopen(file, "r")) == NULL)
  	{	fprintf(stderr, "Unexpected failure to open: %s\n", file);
  		exit(1);
--- 251,258 ----
  	Boolean		isAction;
  
  
! 	dprintf("Scanning data file %s\n", file);
  
  	if ((fp = fopen(file, "r")) == NULL)
  	{	fprintf(stderr, "Unexpected failure to open: %s\n", file);
  		exit(1);
***************
*** 308,314 ****
  {
  
  	Alarm		*al, *prev, *new;
- 	int            bo;
  	char           *XtMalloc();
  	int		al_hr, al_mn, mm;
  	int		loop;
--- 310,315 ----
***************
*** 393,399 ****
  		LookSp,	LoseSp,	Store,	AllDone
  	} state;
  	register int    c = 0;
! 	int             hr, mn;
  	char           *destp;
  
  	if (feof(fin))
--- 394,400 ----
  		LookSp,	LoseSp,	Store,	AllDone
  	} state;
  	register int    c = 0;
! 	int             hr = 0, mn = 0;
  	char           *destp;
  
  	if (feof(fin))
***************
*** 522,528 ****
  {
  	Alarm	*sc;
  	int	togo;
- 	int	mwanted;
  	
  	for (sc = head.next; sc; sc = sc->next)
  	{	togo = sc->alarm_mm - mnow;
--- 523,528 ----
***************
*** 586,592 ****
  beep()
  {
  	register Display *dpy = XtDisplay(toplevel);
- 	register Window win = XtWindow(toplevel);
  	int i;
  
  	for (i = 0; i < appResources.nbeeps; i++)
--- 586,591 ----
*** xcal_cal.c~	Fri Mar 22 23:34:49 1991
--- xcal_cal.c	Fri Mar 22 23:48:20 1991
***************
*** 45,54 ****
  #include <ctype.h>
  #include <sys/param.h>
  #include <sys/types.h>
  #include <sys/dir.h>
  #include <time.h>
- #include <strings.h>
  
  char	*directory	= "Calendar";
  char	*file		= ".xcal";
  char	*home;
--- 45,63 ----
  #include <ctype.h>
  #include <sys/param.h>
  #include <sys/types.h>
+ #ifdef SYSV
+ #include <dirent.h>
+ #include <string.h>
+ #else
+ #include <strings.h>
+ #endif
  #include <sys/dir.h>
  #include <time.h>
  
+ 
+ #ifdef SYSV
+ #define	index	strchr
+ #endif
  char	*directory	= "Calendar";
  char	*file		= ".xcal";
  char	*home;
*** xcal_edit.c~	Fri Mar 22 23:34:53 1991
--- xcal_edit.c	Fri Mar 22 23:48:22 1991
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_edit.c	3.9 (Hillside Systems) 12/13/90";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_edit.c	3.15 (Hillside Systems) 1/16/91";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
***************
*** 63,68 ****
--- 63,70 ----
  #define mw_month mw_me.me_month
  #define mw_have	mw_me.me_have
  
+ #define	StripType(mw)	(mw->mw_me.me_type)
+ 
  static MeWrap *WrapBase;		/* base of the list */
  static MeWrap *WrapEnd;			/* the last one in the list */
  
***************
*** 84,89 ****
--- 86,92 ----
  static MeWrap *MeWrapSearch();
  static	void DeRegisterMonth();
  static Boolean WriteCalendarFile();
+ static Boolean WriteWeeklyFile();
  static void DeleteCalendarFile();
  static void SetAllButtons();
  static void TextChanged();
***************
*** 93,98 ****
--- 96,102 ----
  static void CheckDia();
  static void YesCheck();
  static void NoCheck();
+ static int DayMatch();
  void	StartDayEditor();
  void	Fatal();
  
***************
*** 202,209 ****
  	while ((dp = readdir(dirp)) != NULL)
  	{
  #ifdef SYSV
! 		int d_namlen = strlen(dp->d_name) +1;
! 		switch(d_namlen)
  #else
  		switch(dp->d_namlen)
  #endif
--- 206,212 ----
  	while ((dp = readdir(dirp)) != NULL)
  	{
  #ifdef SYSV
! 		switch(strlen(dp->d_name))
  #else
  		switch(dp->d_namlen)
  #endif
***************
*** 272,277 ****
--- 275,341 ----
  }
  
  /*
+  *	Get the entry for the weekly strip
+  *	Files are xw<Day> in the Calendar directory
+  */
+ MonthEntry *
+ GetWeeklyEntry(yr, mo)
+ 	Cardinal	yr;
+ 	Cardinal	mo;
+ {
+ 	MeWrap		*mw;
+ 	int		da;
+ 	DIR		*dirp;
+ #ifdef SYSV
+ 	struct	dirent	*dp;
+ #else
+ 	struct	direct	*dp;
+ #endif
+ 
+ 	if ((mw = MeWrapSearch(0, 0)) == NULL)
+ 		mw = NewMeWrap(0, 0);
+ 
+ 	if (!FoundCalendarDir)
+ 		return(&mw->mw_me);
+ 
+ 	if ((dirp = opendir(".")) == NULL)
+ 		Fatal("Cannot open directory: %s", MapStem);
+ 
+ 	for (da = 0; da < 7; da++)
+ 		if (mw->mw_have[da])
+ 		{	XtFree(mw->mw_have[da]);
+ 			mw->mw_have[da] = NULL;
+ 		}
+ 
+ 	while ((dp = readdir(dirp)) != NULL)
+ 	{
+ 		if (dp->d_name[0] == 'x' &&
+ 		    dp->d_name[1] == 'w' &&
+ 		    ((da = DayMatch(&dp->d_name[2])) != -1))
+ 		{
+ 			mw->mw_have[da] = ReadCalendarFile(NULL, dp->d_name);
+ 		}
+ 	}
+ 	closedir(dirp);
+ 	return(&mw->mw_me);
+ }
+ 
+ /*
+  *	Look for a short name match with a day
+  */
+ static int
+ DayMatch(day)
+ 	String	day;
+ {
+ 	register i;
+ 
+ 	for (i = 0; i < 7; i++)
+ 		if (strcmp(day, appResources.sday[i]) == 0)
+ 			return(i);
+ 	return (-1);
+ }
+ 
+ /*
   *	create a new MapWrap area
   */
  static MeWrap *
***************
*** 335,341 ****
  
  	callbacks[0].callback = DeRegisterMonth;
  #ifdef LONG_IS_32_BITS
! 	callbacks[0].closure = (caddr_t)DatePack(0, mo, yr);
  #else
  	callbacks[0].closure = (caddr_t)DatePack(mo, yr);
  #endif		
--- 399,405 ----
  
  	callbacks[0].callback = DeRegisterMonth;
  #ifdef LONG_IS_32_BITS
! 	callbacks[0].closure = (caddr_t)DatePack(0, 0, mo, yr);
  #else
  	callbacks[0].closure = (caddr_t)DatePack(mo, yr);
  #endif		
***************
*** 434,439 ****
--- 498,529 ----
  }
  
  /*
+  *	Check to see if we should create the top directory
+  */
+ Boolean
+ NeedTop()
+ {		
+ 	if (!FoundCalendarDir)
+ 	{	if (mkdir(MapStem, 0700) == -1)
+ 		{	XBell(XtDisplay(toplevel), 0);
+ 			fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem);
+ 			perror("xcal: mkdir");
+ 			fflush(stderr);
+ 			return(False);
+ 		}
+ 		if (chdir(MapStem) < 0)
+ 		{	XBell(XtDisplay(toplevel), 0);
+ 			fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem);
+ 			perror("xcal: chdir");
+ 			fflush(stderr);
+ 			return(False);
+ 		}
+ 		FoundCalendarDir = True;
+ 	}
+ 	return(True);
+ }
+ 
+ /*
   *	Write a calendar file creating any directories
   *	which are needed
   *	Return True is OK
***************
*** 454,481 ****
  	{	DeleteCalendarFile(mw, day);
  		return(True);
  	}
  	/*
- 	 *	First let's see if we have 
- 	 *	to create the toplevel directory
- 	 */
- 	if (!FoundCalendarDir)
- 	{	if (mkdir(MapStem, 0700) == -1)
- 		{	XBell(XtDisplay(toplevel), 0);
- 			fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem);
- 			perror("xcal: mkdir");
- 			fflush(stderr);
- 			return(False);
- 		}
- 		if (chdir(MapStem) < 0)
- 		{	XBell(XtDisplay(toplevel), 0);
- 			fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem);
- 			perror("xcal: chdir");
- 			fflush(stderr);
- 			return(False);
- 		}
- 		FoundCalendarDir = True;
- 	}
- 	/*
  	 *	So that looks OK
  	 *	We can now create the output file.
  	 *	However, we would like to put any new data into subdirectories
--- 544,553 ----
  	{	DeleteCalendarFile(mw, day);
  		return(True);
  	}
+ 	if (!NeedTop())
+ 		return(False);
+ 
  	/*
  	 *	So that looks OK
  	 *	We can now create the output file.
  	 *	However, we would like to put any new data into subdirectories
***************
*** 570,575 ****
--- 642,726 ----
  }
  
  /*
+  *	Write daily file out
+  */
+ static Boolean
+ WriteWeeklyFile(mw, day, contents)
+ 	register MeWrap	*mw;
+ 	Cardinal	day;
+ 	char		*contents;
+ {
+ 	int	fd;
+ 	Cardinal len;
+ 	char	*fname;
+ 
+ 	fname = MakeWeeklyName(day);
+ 	
+ 	len = strlen(contents);
+ 	if (len == 0)
+ 		(void) unlink(fname);
+ 	else
+ 	{	if ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0)
+ 		{	XBell(XtDisplay(toplevel), 0);
+ 			fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname);
+ 			perror("xcal: open");
+ 			fflush(stderr);
+ 			return(False);
+ 		}
+ 
+ 		if (write(fd, contents, len) != len)
+ 		{	XBell(XtDisplay(toplevel), 0);
+ 			fprintf(stderr, "xcal: Write error %s/%s file.\n", MapStem, fname);
+ 			perror("xcal: write");
+ 			fflush(stderr);
+ 			close(fd);
+ 			return(False);
+ 		}
+ 		close(fd);
+ 	}
+ 	/*
+ 	 *	tickle the alarm system if we have altered `today'
+ 	 */
+ 	if (today.wday == day)
+ 		AlarmFilePoll(NULL);
+ 
+ 	return(True);
+ }
+ 
+ /*
+  *	Create a standard weekly file name
+  */
+ String
+ MakeWeeklyName(day)
+ 	Cardinal day;
+ {
+ 	static	char	fname[16];
+ 
+ 	(void) sprintf(fname, "xw%s", appResources.sday[day]);
+ 	return(fname);
+ }
+ 
+ /*
+  *	Get the contents of the current Weekly file if any
+  */
+ String
+ GetWeeklyFile(day)
+ 	Cardinal day;
+ {
+ 	char	*fname;
+ 
+ 	if (FoundCalendarDir == False)
+ 		return (NULL);
+ 
+ 	fname = MakeWeeklyName(day);
+ 
+ 	if (access(fname, F_OK) < 0)
+ 		return(NULL);
+ 
+ 	return (ReadCalendarFile(NULL, fname));
+ }
+ 
+ /*
   *	Start up an editor window from the callback
   *	Pass the calling widget so we can change its contents
   *	after the edit
***************
*** 592,598 ****
  	{	if (ed->ed_day == da->day)
  		{	/* we are! */
  			/* Complain via a popup */
! 			NoEditIsPossible(w, da);
  			return;
  		}
  	}
--- 743,757 ----
  	{	if (ed->ed_day == da->day)
  		{	/* we are! */
  			/* Complain via a popup */
! 			switch (StripType(mw))
! 			{
! 			case ME_MONTHLY:
! 				NoEditIsPossible(w, da);
! 				break;
! 			case ME_WEEKLY:
! 				NoDayEditIsPossible(w, da->day);
! 				break;
! 			}
  			return;
  		}
  	}
***************
*** 724,730 ****
  		lw = XtCreateManagedWidget("help", commandWidgetClass, frame, args, nargs);
  	}
  
! 	PlaceStr(buf, da->day, appResources.mon[da->month], da->year);
  	nargs = 0;
  	XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  	XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
--- 883,897 ----
  		lw = XtCreateManagedWidget("help", commandWidgetClass, frame, args, nargs);
  	}
  
! 	switch (StripType(mw))
! 	{
! 	case ME_MONTHLY:
! 		PlaceStr(buf, da, appResources.editYearIs2);
! 		break;
! 	case ME_WEEKLY:
! 		(void) strcpy(buf, appResources.day[da->day]);
! 		break;
! 	}
  	nargs = 0;
  	XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  	XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
***************
*** 786,799 ****
  	register Instance *ins;
  	register MeWrap	*mw;
  	register Cardinal day;
- 	extern	Widget	toplevel;
  	Arg	args[3];
  	
  	mw = ed->ed_meWrap;
  	day = ed->ed_day;
  	
! 	if (WriteCalendarFile(mw, day, ed->ed_data) == False)
! 		return;
  	/*
  	 *	Otherwise change the displayed string
  	 */
--- 953,974 ----
  	register Instance *ins;
  	register MeWrap	*mw;
  	register Cardinal day;
  	Arg	args[3];
  	
  	mw = ed->ed_meWrap;
  	day = ed->ed_day;
  	
! 	switch (StripType(mw))
! 	{
! 	case ME_MONTHLY:
! 		if (WriteCalendarFile(mw, day, ed->ed_data) == False)
! 			return;
! 		break;
! 	case ME_WEEKLY:
! 		if (WriteWeeklyFile(mw, day, ed->ed_data) == False)
! 			return;
! 		break;
! 	}
  	/*
  	 *	Otherwise change the displayed string
  	 */
***************
*** 819,827 ****
  	/*
  	 * worry about updating the memo system
  	 */
! 	if (today.day == day && today.month == mw->mw_month &&
! 	    today.year == mw->mw_year)
! 		UpdateMemo();
  
  }
  
--- 994,1012 ----
  	/*
  	 * worry about updating the memo system
  	 */
! 
! 	switch (StripType(mw))
! 	{
! 	case ME_MONTHLY:
! 		if (today.day == day && today.month == mw->mw_month &&
! 		    today.year == mw->mw_year)
! 			UpdateMemo();
! 		break;
! 	case ME_WEEKLY:
! 		if (today.wday == day)
! 			UpdateMemo();
! 		break;
! 	}
  
  }
  
*** xcal_help.c~	Fri Mar 22 23:34:49 1991
--- xcal_help.c	Fri Mar 22 23:48:20 1991
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_help.c	3.5 (Hillside Systems) 12/7/90";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_help.c	3.6 (Hillside Systems) 1/16/91";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
***************
*** 223,225 ****
--- 223,260 ----
  
  	DisplayHelpWindow(memoHelp);
  }
+ 
+ static char weeklyHelp[] = "\
+ The weekly strip consists of a number of lines of text. \n\n\
+ Line 1: The title\n\
+ Line 2: The Quit button that removes the strip from the screen\n\
+ Line 3: The Help Button.\n\
+ 	Help can be suppressed by setting `giveHelp' to False.\n\n\
+ Then -  A line for each day in the week.\n\
+ 	Each line is two areas:\n\
+ 	The left hand side shows the day in the week\n\
+ 	The right hand side is an active button. When pressed it starts\n\
+ 	up an editor for the day. This will create a file for the day\n\
+ 	in the user's Calendar directory. The label on the button will\n\
+ 	be the first few characters of the file, if there are any.\n\
+ \n\
+ XCal was written by Peter Collinson\n\
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
+ 	
+ /* ARGSUSED */
+ void
+ WeeklyHelp(w, closure, call_data)
+ 	Widget w;
+ 	caddr_t	closure;
+ 	caddr_t call_data;
+ {
+ 	static int vadded;
+ 
+ 	if (vadded == 0)
+ 	{	vadded = 1;
+ 		addversion(weeklyHelp);
+ 	}
+ 
+ 	DisplayHelpWindow(weeklyHelp);
+ }
+ 
*** xcal_memo.c~	Fri Mar 22 23:34:51 1991
--- xcal_memo.c	Fri Mar 22 23:48:21 1991
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_memo.c	1.5 (Hillside Systems) 12/13/90";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_memo.c	1.11 (Hillside Systems) 1/16/91";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
***************
*** 53,69 ****
  	Widget	m_display;	/* widget of display title area */
  	Widget	m_text;		/* the text area */
  	Widget	m_today;	/* today's data */
  	Cardinal m_size;	/* size of the buffer */
  	char	*m_data;	/* pointer to malloc'ed data buffer */
  } MemoEdit;
  
  static	MemoEdit memo;
- String	GetMemoFile();
  
  extern	Boolean FoundCalendarDir;               /* whether the Calendar directory exists */
  
  static	String	memoContents;
  
  
  /*
   *	Internal routines
--- 53,70 ----
  	Widget	m_display;	/* widget of display title area */
  	Widget	m_text;		/* the text area */
  	Widget	m_today;	/* today's data */
+ 	Widget	m_weekly;	/* widget of text image of weekly events */
  	Cardinal m_size;	/* size of the buffer */
  	char	*m_data;	/* pointer to malloc'ed data buffer */
  } MemoEdit;
  
  static	MemoEdit memo;
  
  extern	Boolean FoundCalendarDir;               /* whether the Calendar directory exists */
  
  static	String	memoContents;
  
+ extern void MemoHelp();				/* look in xcal_help.c */
  
  /*
   *	Internal routines
***************
*** 77,83 ****
  static String GetMemoFile();
  static void SaveMemoEdits();
  static void MemoTextChanged();
- static void MemoHelp();
  static void FinishMemoEditing();
  static void YesCheck();
  static void NoCheck();
--- 78,83 ----
***************
*** 145,153 ****
  	Widget		frame;
  	Arg		args[10];
  	Cardinal	nargs;
- 	Cardinal	len;
  	String		str;
  	MonthEntry	*me;
  	char		buf[32];
  
  	/*
--- 145,153 ----
  	Widget		frame;
  	Arg		args[10];
  	Cardinal	nargs;
  	String		str;
  	MonthEntry	*me;
+ 	Dimension	charHeight;
  	char		buf[32];
  
  	/*
***************
*** 207,213 ****
  	/*
  	 *	The remaining bit here is a date label
  	 */
! 	PlaceStr(buf, today.day, appResources.mon[today.month], today.year);
  	nargs = 0;
  	XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  	XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
--- 207,213 ----
  	/*
  	 *	The remaining bit here is a date label
  	 */
! 	PlaceStr(buf, &today, appResources.memoYearIs2);
  	nargs = 0;
  	XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  	XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
***************
*** 233,244 ****
  
  		XtSetArg(args[0], XtNheight, &height);
  		XtGetValues(memo.m_today, args, 1);
  		height = height*NewlineCount(str);
  		XtSetArg(args[0], XtNheight, height);
  		XtSetValues(memo.m_today, args, 1);
  	}
! 		
  	/*
  	 *	Another form with some buttons
  	 */
  	nargs = 0;
--- 233,294 ----
  
  		XtSetArg(args[0], XtNheight, &height);
  		XtGetValues(memo.m_today, args, 1);
+ 		charHeight = height;
  		height = height*NewlineCount(str);
  		XtSetArg(args[0], XtNheight, height);
  		XtSetValues(memo.m_today, args, 1);
  	}
! 
  	/*
+ 	 *	Weekly details - the data for today + an edit button
+ 	 *	The header to this is a form
+ 	 */
+ 	nargs = 0;
+ 	XtSetArg(args[nargs], XtNshowGrip, False); nargs++;
+ 	XtSetArg(args[nargs], XtNskipAdjust, True); nargs++;
+ 	XtSetArg(args[nargs], XtNdefaultDistance, 1); nargs++;
+ 	frame = XtCreateManagedWidget("weeklyMemo", formWidgetClass, et, args, nargs);
+ 
+ 	/*
+ 	 *	Take label "edit" from resources
+ 	 */
+ 	callbacks[0].callback = DoWeekly;
+ 	callbacks[0].closure = (caddr_t)&memo;
+ 	nargs = 0;
+ 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 	XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
+ 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
+ 	XtSetArg(args[nargs], XtNright, XtChainLeft); nargs++;
+ 	lw = XtCreateManagedWidget("weeklyEdit", commandWidgetClass, frame, args, nargs);
+ 
+ 	/*
+ 	 *	Say this is a weekly commitment
+ 	 */
+ 	nargs = 0;
+ 
+ 	XtSetArg(args[nargs], XtNshowGrip, True); nargs++;
+ 	XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
+ 	XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
+ 	XtSetArg(args[nargs], XtNfromVert, NULL); nargs++;
+ 	XtSetArg(args[nargs], XtNvertDistance, 2); nargs++;
+ 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
+ 	XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
+ 	lw = XtCreateManagedWidget("weeklyTitle", labelWidgetClass, frame, args, nargs);
+ 
+ 	/*
+ 	 *	Details for today
+ 	 */
+ 	nargs = 0;
+ 	str = GetWeeklyFile(today.wday);
+ 	if (str == NULL)
+ 		str = "";
+ 	XtSetArg(args[nargs], XtNstring, str); nargs++;
+ 	XtSetArg(args[nargs], XtNdisplayCaret, False); nargs++;
+ 	XtSetArg(args[nargs], XtNeditType, XawtextRead); nargs++;
+ 	if (charHeight)
+ 		XtSetArg(args[nargs], XtNheight, NewlineCount(str)*charHeight); nargs++;
+ 	memo.m_weekly = XtCreateManagedWidget("display", asciiTextWidgetClass, et, args, nargs);
+ 	/*
  	 *	Another form with some buttons
  	 */
  	nargs = 0;
***************
*** 342,347 ****
--- 392,404 ----
  	(void) sprintf(buf, "%d %s %d", today.day, appResources.mon[today.month], today.year);
  	XtSetArg(args[0], XtNlabel, buf);
  	XtSetValues(memo.m_display, args, 1);
+ 
+ 	str = GetWeeklyFile(today.wday);
+ 	if (str == NULL)
+ 		str = "";
+ 	XtSetArg(args[0], XtNstring, str);
+ 	XtSetValues(memo.m_weekly, args, 1);
+ 
  }
  
  /*
***************
*** 441,465 ****
  	 *	First let's see if we have 
  	 *	to create the toplevel directory
  	 */
! 	if (!FoundCalendarDir)
! 	{	if (mkdir(MapStem, 0700) == -1)
! 		{	XBell(XtDisplay(toplevel), 0);
! 			fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem);
! 			perror("xcal: mkdir");
! 			fflush(stderr);
! 			return(False);
! 		}
! 		if (chdir(MapStem) < 0)
! 		{	XBell(XtDisplay(toplevel), 0);
! 			fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem);
! 			perror("xcal: chdir");
! 			fflush(stderr);
! 			return(False);
! 		}
! 		FoundCalendarDir = True;
! 	}
  
  	fname = appResources.memoFile;
  	if ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0)
  	{	XBell(XtDisplay(toplevel), 0);
  		fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname);
--- 498,508 ----
  	 *	First let's see if we have 
  	 *	to create the toplevel directory
  	 */
! 	if (!NeedTop())
! 		return (False);
  
  	fname = appResources.memoFile;
+ 
  	if ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0)
  	{	XBell(XtDisplay(toplevel), 0);
  		fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname);
***************
*** 487,493 ****
  	caddr_t call_data;
  {
  
! 	if (memoContents == NULL || strcmp(memoContents, memo.m_data))
  	{	MemoCheckExit();
  		return;
  	}
--- 530,536 ----
  	caddr_t call_data;
  {
  
! 	if (memo.m_savesens == True)
  	{	MemoCheckExit();
  		return;
  	}
*** xcal_popup.c~	Fri Mar 22 23:34:56 1991
--- xcal_popup.c	Fri Mar 22 23:48:24 1991
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_popup.c	3.4 (Hillside Systems) 12/12/90";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_popup.c	3.5 (Hillside Systems) 1/16/91";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
***************
*** 395,400 ****
--- 395,413 ----
  	static	char	errmsg[32];	
  
  	(void) sprintf(errmsg, "Already editing %d %s %d", da->day, appResources.mon[da->month], da->year);
+ 
+ 	DialogPopup(w, NoEdit, errmsg);
+ 
+ }
+ 
+ void
+ NoDayEditIsPossible(w, day)
+ 	Widget	w;
+ 	Cardinal day;
+ {
+ 	static	char	errmsg[32];	
+ 
+ 	(void) sprintf(errmsg, "Already editing %s", appResources.day[day]);
  
  	DialogPopup(w, NoEdit, errmsg);
  
*** xcal_strip.c~	Fri Mar 22 23:34:54 1991
--- xcal_strip.c	Fri Mar 22 23:48:23 1991
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_strip.c	3.6 (Hillside Systems) 12/7/90";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_strip.c	3.10 (Hillside Systems) 1/16/91";
  static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  #endif  /* lint */
  /***
***************
*** 45,55 ****
   */
  void MakeMonth();
  void	DayBack();
! #ifdef LONG_IS_32_BITS
  void	YmBack();
  #endif
  void	StripQuit();
! 
  void	MakeNewMonth();
  
  Cardinal DateSum();
--- 45,56 ----
   */
  void MakeMonth();
  void	DayBack();
! #ifndef LONG_IS_32_BITS
  void	YmBack();
  #endif
  void	StripQuit();
! void	StripHelp();
! void	WeeklyHelp();
  void	MakeNewMonth();
  
  Cardinal DateSum();
***************
*** 56,63 ****
  Cardinal NumberOfDays();
  Cardinal FirstDay();
  Cardinal JanuaryOne();
  /*
!  *	Start a strip calendar happening
   *	a callback of left button 
   */
  /* ARGSUSED */
--- 57,71 ----
  Cardinal NumberOfDays();
  Cardinal FirstDay();
  Cardinal JanuaryOne();
+ 
  /*
!  *	Local routines
!  */
! static void	CreateActionBar();
! static void	CreateWeeklyActionBar();
! 
! /*
! *	Start a strip calendar happening
   *	a callback of left button 
   */
  /* ARGSUSED */
***************
*** 70,75 ****
--- 78,100 ----
  	NewMonthStrip(&today);		/* today is global */
  }
  
+ /* ARGSUSED */
+ void
+ DoWeekly(w, closure, call_data)
+ 	Widget w;
+ 	caddr_t	closure;
+ 	caddr_t call_data;
+ {
+ 	Date	thisday;
+ 
+ 	thisday.day = 0;
+ 	thisday.month = 0;
+ 	thisday.year = 0;
+ 	thisday.wday = 0;
+ 	NewMonthStrip(&thisday);	/* today is global */
+ }
+ 
+ 
  /*
   *	Start a strip calendar happening
   *	a callback of the > or < buttons in another strip
***************
*** 112,125 ****
  	Date	*td;
  {
  	Widget		shell, mon, dw, lw, lwi, form;
! 	Arg	args[15];
  	char		nbuf[256];
  	char		iconName[80];
  	MonthEntry	*me;
  	Instance	*ins;
  	register int	i;
  	register Cardinal nargs;
  	Cardinal	thisDay;
  	String		dayStr;
  	Cardinal	numberOfDays;
  	Boolean		defaultsAreSet = False;
--- 137,152 ----
  	Date	*td;
  {
  	Widget		shell, mon, dw, lw, lwi, form;
! 	Arg		args[15];
  	char		nbuf[256];
  	char		iconName[80];
+ 	int		type;
  	MonthEntry	*me;
  	Instance	*ins;
  	register int	i;
  	register Cardinal nargs;
  	Cardinal	thisDay;
+ 	Cardinal	startLoop;
  	String		dayStr;
  	Cardinal	numberOfDays;
  	Boolean		defaultsAreSet = False;
***************
*** 129,161 ****
  	Dimension	labelH, infoH;
  	Dimension	width;
  	Dimension	totalWidth;
- 	void		StripHelp();
  
! 	(void) sprintf(iconName, "%s %d", appResources.smon[td->month], td->year);
! 
! 	XtSetArg(args[0], XtNiconName, iconName);
! 	shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1);
! 
! 	ins = RegisterMonth(td->year, td->month, shell);	
! 
! 	mon = XtCreateManagedWidget(appResources.mon[td->month], panedWidgetClass, shell, NULL, 0);
! 
! 	thisDay = FirstDay(td->month, td->year);
! 	numberOfDays = NumberOfDays(td->month, td->year);
  	/*
! 	 *	Get the map for this year
  	 */
! 	me = GetMonthEntry(td->year, td->month);
  	/*
- 	 *	Title bar is month and date
- 	 */
- 	(void) sprintf(nbuf, "%s %d", appResources.mon[td->month], td->year);
- 	/*
- 	 *	see if we will need to worry about marking today's entry
- 	 */
- 	if (appResources.markToday && td->year == today.year && td->month == today.month)
- 		markThisMonth = True;
- 	/*
  	 *	Find size of title bar
  	 *	by creating the widget and then throwing it away
  	 */
--- 156,221 ----
  	Dimension	labelH, infoH;
  	Dimension	width;
  	Dimension	totalWidth;
  
! 	type = (td->day == 0) ? ME_WEEKLY : ME_MONTHLY;
! 	
  	/*
! 	 *	There are lots of differences between
! 	 *	Months and weekly strips here.
! 	 *	Later tests are done using a switch structure
  	 */
! 	switch (type)
! 	{
! 	case ME_MONTHLY:
! 		(void) sprintf(iconName, "%s %d", appResources.smon[td->month], td->year);
! 		XtSetArg(args[0], XtNiconName, iconName);
! 		shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1);
! 		ins = RegisterMonth(td->year, td->month, shell);	
! 		mon = XtCreateManagedWidget(appResources.mon[td->month], panedWidgetClass, shell, NULL, 0);
! 		thisDay = FirstDay(td->month, td->year);
! 		numberOfDays = NumberOfDays(td->month, td->year);
! 		startLoop = 1;
! 		/*
! 		 *	Get the map for this year
! 		 */
! 		me = GetMonthEntry(td->year, td->month);
! 		me->me_type = type;
! 		/*
! 		 *	Title bar is month and date
! 		 */
! 		(void) sprintf(nbuf, "%s %d", appResources.mon[td->month], td->year);
! 		/*
! 		 *	see if we will need to worry about marking today's entry
! 		 */
! 		if (appResources.markToday && td->year == today.year && td->month == today.month)
! 			markThisMonth = True;
! 		break;
! 	case ME_WEEKLY:
! 		(void) strcpy(iconName, appResources.weekly);
! 		XtSetArg(args[0], XtNiconName, iconName);
! 		shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1);
! 		ins = RegisterMonth(0, 0, shell);	
! 		mon = XtCreateManagedWidget(iconName, panedWidgetClass, shell, NULL, 0);
! 		thisDay = 0;
! 		numberOfDays = 6;	/* test is <= */
! 		startLoop = 0;
! 		/*
! 		 *	Get the map for this year
! 		 */
! 		me = GetWeeklyEntry();
! 		me->me_type = type;
! 		/*
! 		 *	Title bar is from the resources
! 		 */
! 		strcpy(nbuf, iconName);
! 		/*
! 		 *	see if we will need to worry about marking today's entry
! 		 */
! 		if (appResources.markToday)
! 			markThisMonth = True;
! 		break;
! 	}
  	/*
  	 *	Find size of title bar
  	 *	by creating the widget and then throwing it away
  	 */
***************
*** 185,245 ****
  	XtSetArg(args[nargs], XtNdefaultDistance, 2); nargs++;
  	dw = XtCreateManagedWidget("action", formWidgetClass, mon, args, nargs);
  
! 	/*
! 	 *	back one month
! 	 *	label "<" from resources
! 	 */
! 	callbacks[0].callback = MakeNewMonth;
! 	callbacks[0].closure = (caddr_t)DateSum(td, -1);
! 	nargs = 0;
! 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
! 	XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
! 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
! 	XtSetArg(args[nargs], XtNright, XtChainLeft); nargs++;
! 	lw = XtCreateManagedWidget("back", commandWidgetClass, dw, args, nargs);
! 	ClearCallbacks();
! 
! 	/*
! 	 *	Quit button
! 	 *	label "quit" from resources
! 	 */
! 	callbacks[0].callback = StripQuit;
! 	callbacks[0].closure = (caddr_t)shell;
! 	nargs = 0;
! 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
! 	XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
! 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
! 	XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
! 	lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs);
! 	ClearCallbacks();
! 
! 	/*
! 	 *	On one month
! 	 *	label ">" from reources
! 	 */
! 	callbacks[0].callback = MakeNewMonth;
! 	callbacks[0].closure = (caddr_t)DateSum(td, 1);
! 	nargs = 0;
! 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
! 	XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
! 	XtSetArg(args[nargs], XtNleft, XtChainRight); nargs++;
! 	XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
! 	lw = XtCreateManagedWidget("next", commandWidgetClass, dw, args, nargs);
! 	ClearCallbacks();
! 
! 	/*
! 	 *	Help button
! 	 *	label help from resources
! 	 */
! 	if (appResources.giveHelp)
! 	{	
! 		callbacks[0].callback = StripHelp;
! 		callbacks[0].closure = (caddr_t)0;
! 		nargs = 0;
! 		XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
! 		XtSetArg(args[nargs], XtNshowGrip, False); nargs++;
! 		lw = XtCreateManagedWidget("help", commandWidgetClass, mon, args, nargs);
! 		ClearCallbacks();
  	}
  
  #ifdef	LONG_IS_32_BITS
--- 245,258 ----
  	XtSetArg(args[nargs], XtNdefaultDistance, 2); nargs++;
  	dw = XtCreateManagedWidget("action", formWidgetClass, mon, args, nargs);
  
! 	switch (type)
! 	{
! 	case ME_MONTHLY:
! 		CreateActionBar(shell, dw, mon, td);
! 		break;
! 	case ME_WEEKLY:
! 		CreateWeeklyActionBar(shell, dw);
! 		break;
  	}
  
  #ifdef	LONG_IS_32_BITS
***************
*** 248,265 ****
  	callbacks[0].callback = YmBack;
  	callbacks[1].callback = DayBack;
  #endif
! 	for (i = 1; i <= numberOfDays; i++)
  	{
! 		dayStr = appResources.day[thisDay];
! 		(void) sprintf(nbuf, "%2d %s", i, dayStr);
! 		thisDay = (thisDay+1)%7;
! 		
  #ifdef LONG_IS_32_BITS
! 		callbacks[0].closure = (caddr_t)DatePack(i, td->month, td->year);
  #else
  		callbacks[0].closure = (caddr_t)DatePack(td->month, td->year);
! 		callbacks[1].closure = (caddr_t)i;
  #endif		
  		/*
  		 *	Each line in the strip is
  		 *	form containing
--- 261,287 ----
  	callbacks[0].callback = YmBack;
  	callbacks[1].callback = DayBack;
  #endif
! 	for (i = startLoop; i <= numberOfDays; i++)
  	{
! 		dayStr = appResources.sday[thisDay];
! 		switch(type)
! 		{
! 		case ME_MONTHLY:
! 			(void) sprintf(nbuf, "%2d %s", i, dayStr);
! 			break;
! 		case ME_WEEKLY:
! 			(void) strcpy(nbuf, dayStr);
! 			break;
! 		}
  #ifdef LONG_IS_32_BITS
! 		callbacks[0].closure = (caddr_t)DatePack(thisDay, i, td->month, td->year);
  #else
  		callbacks[0].closure = (caddr_t)DatePack(td->month, td->year);
! 		callbacks[1].closure = (caddr_t)DayPack(thisDay, i);
  #endif		
+ 
+ 		thisDay = (thisDay+1)%7;
+ 		
  		/*
  		 *	Each line in the strip is
  		 *	form containing
***************
*** 288,294 ****
  		 *	highlighting we get them after we have created the
  		 *	widget. Then we highlight today.
  		 */
! 		if (markThisMonth && today.day == i)
  		{
  			nargs = 0;
  			XtSetArg(args[nargs], XtNforeground, &ins->i_col.fg); nargs++;
--- 310,318 ----
  		 *	highlighting we get them after we have created the
  		 *	widget. Then we highlight today.
  		 */
! 		if (markThisMonth &&
! 		    ((type == ME_MONTHLY && today.day == i) ||
! 		     (type == ME_WEEKLY && today.wday == i)))
  		{
  			nargs = 0;
  			XtSetArg(args[nargs], XtNforeground, &ins->i_col.fg); nargs++;
***************
*** 372,377 ****
--- 396,517 ----
  }
  
  /*
+  *	Create action bar for normal monthly strip
+  */
+ static void
+ CreateActionBar(shell, dw, mon, td)
+ 	Widget	shell;
+ 	Widget	dw;
+ 	Widget	mon;
+ 	Date	*td;
+ {
+ 	Widget		lw;
+ 	register Cardinal nargs;
+ 	Arg		args[8];
+ 
+ 	/*
+ 	 *	back one month
+ 	 *	label "<" from resources
+ 	 */
+ 	callbacks[0].callback = MakeNewMonth;
+ 	callbacks[0].closure = (caddr_t)DateSum(td, -1);
+ 	nargs = 0;
+ 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 	XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
+ 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
+ 	XtSetArg(args[nargs], XtNright, XtChainLeft); nargs++;
+ 	lw = XtCreateManagedWidget("back", commandWidgetClass, dw, args, nargs);
+ 	ClearCallbacks();
+ 
+ 	/*
+ 	 *	Quit button
+ 	 *	label "quit" from resources
+ 	 */
+ 	callbacks[0].callback = StripQuit;
+ 	callbacks[0].closure = (caddr_t)shell;
+ 	nargs = 0;
+ 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 	XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
+ 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
+ 	XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
+ 	lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs);
+ 	ClearCallbacks();
+ 
+ 	/*
+ 	 *	On one month
+ 	 *	label ">" from reources
+ 	 */
+ 	callbacks[0].callback = MakeNewMonth;
+ 	callbacks[0].closure = (caddr_t)DateSum(td, 1);
+ 	nargs = 0;
+ 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 	XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
+ 	XtSetArg(args[nargs], XtNleft, XtChainRight); nargs++;
+ 	XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
+ 	lw = XtCreateManagedWidget("next", commandWidgetClass, dw, args, nargs);
+ 	ClearCallbacks();
+ 
+ 	/*
+ 	 *	Help button
+ 	 *	label help from resources
+ 	 */
+ 	if (appResources.giveHelp)
+ 	{	
+ 		callbacks[0].callback = StripHelp;
+ 		callbacks[0].closure = (caddr_t)0;
+ 		nargs = 0;
+ 		XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 		XtSetArg(args[nargs], XtNshowGrip, False); nargs++;
+ 		lw = XtCreateManagedWidget("help", commandWidgetClass, mon, args, nargs);
+ 		ClearCallbacks();
+ 	}
+ }
+ 
+ /*
+  *	Create action bar for normal monthly strip
+  */
+ static void
+ CreateWeeklyActionBar(shell, dw)
+ 	Widget	shell;
+ 	Widget	dw;
+ {
+ 	Widget		lw;
+ 	register Cardinal nargs;
+ 	Arg		args[8];
+ 
+ 	/*
+ 	 *	Quit button
+ 	 *	label "quit" from resources
+ 	 */
+ 	callbacks[0].callback = StripQuit;
+ 	callbacks[0].closure = (caddr_t)shell;
+ 	nargs = 0;
+ 	XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 	XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
+ 	XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
+ 	XtSetArg(args[nargs], XtNright, appResources.giveHelp ? XtChainLeft: XtChainRight); nargs++;
+ 	lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs);
+ 	ClearCallbacks();
+ 
+ 	/*
+ 	 *	Help button
+ 	 *	label help from resources
+ 	 */
+ 	if (appResources.giveHelp)
+ 	{	
+ 		callbacks[0].callback = WeeklyHelp;
+ 		callbacks[0].closure = (caddr_t)0;
+ 		nargs = 0;
+ 		XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
+ 		XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
+ 		XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
+ 		XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
+ 		lw = XtCreateManagedWidget("help", commandWidgetClass, dw, args, nargs);
+ 		ClearCallbacks();
+ 	}
+ }
+ 
+ /*
   *	Called when the date changes to ensure that
   *	the correct day has the appropriate highlights
   */
***************
*** 445,451 ****
  		y++;
  	}
  #ifdef LONG_IS_32_BITS
! 	return(DatePack(0, m, y));
  #else
  	return(DatePack(m, y));
  #endif
--- 585,591 ----
  		y++;
  	}
  #ifdef LONG_IS_32_BITS
! 	return(DatePack(0, 0, m, y));
  #else
  	return(DatePack(m, y));
  #endif
***************
*** 465,474 ****
  #ifdef LONG_IS_32_BITS
  	callb.month = MoUnpack((Cardinal)closure);
  	callb.year = YrUnpack((Cardinal)closure);
- 	callb.day = DyUnpack((Cardinal)closure);
- #else
- 	callb.day = (Cardinal)closure;
  #endif
  	StartEditing(w, &callb);
  }
  
--- 605,613 ----
  #ifdef LONG_IS_32_BITS
  	callb.month = MoUnpack((Cardinal)closure);
  	callb.year = YrUnpack((Cardinal)closure);
  #endif
+ 	callb.day = DyUnpack((Cardinal)closure);
+ 	callb.wday = WdUnpack((Cardinal)closure);
  	StartEditing(w, &callb);
  }
  

--
Dan Heller
O'Reilly && Associates       Z-Code Software    Comp-sources-x:
Senior Writer                President          comp-sources.x at uunet.uu.net
argv at ora.com                 argv at zipcode.com



More information about the Comp.sources.x mailing list