[comp.sources.x] v07i028: xcal, Patch1, Part01/01

pc@hillside.co.uk (Peter Collinson) (05/07/90)

Submitted-by: Peter Collinson <pc@hillside.co.uk>
Posting-number: Volume 7, Issue 28
Archive-name: xcal/patch1
Patch-To: xcal: Volume 7, Issue 1-2

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 are the result of various people getting back to me
with typos, fixes and request for changes to xcal. For details see the
CHANGES file which is created by this posting.

Thanks to all of you who responded.

PS. Potential unpackers of the orginal postings should change the line:

	cat "#define PATCHLEVEL 0" > patchlevel.h
to
	echo "#define PATCHLEVEL 0" > patchlevel.h

------------------------- patch from here --------------
Prereq: 0
*** patchlevel.h~	Sat May  5 16:37:37 1990
--- patchlevel.h	Sat May  5 16:16:25 1990
***************
*** 1 ****
! #define PATCHLEVEL 0
--- 1 ----
! #define PATCHLEVEL 1
*** version.c~	Sat May  5 16:20:29 1990
--- version.c	Sat May  5 16:36:59 1990
***************
*** 1,10 ****
  #ifndef lint
! static char *sccsid = "@(#)version.c	1.1 (Hillside Systems) 4/28/90";
  #endif  lint
  /*
   *	Version control file
!  *	version.c	1.1	4/28/90
!  *	Automatically created on Sat Apr 28 17:09:34 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.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
   */
***************
*** 12,35 ****
  #define	PROGNAME	XCal
  #endif
  #ifdef	VER_VEC
! char	version[] = "XCal Version 1.1, released Sat Apr 28 17:09:34 BST 1990";
  #endif
  #ifdef	VER_DEF
! #define	VERSION	"XCal Version 1.1, released Sat Apr 28 17:09:34 BST 1990"
  #endif
  
  /*	SCCS files
   *
  +1.5	Makefile
! +3.2	xcal.c
! +1.3	xcal.man
! +3.1	xcal.h
  +3.1	xcal_popup.c
! +3.3	xcal_strip.c
  +3.2	xcal_help.c
! +3.1	xcal_edit.c
! +1.2	XCal.ad
  +1.2	Imakefile
  +1.1	README
   *
   */
--- 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
   *
   */
*** XCal.ad~	Sat May  5 16:28:47 1990
--- XCal.ad	Sat May  5 16:15:30 1990
***************
*** 1,8 ****
  XCal*Font: lucidasanstypewriter-12
  XCal*info.Font: lucidasans-10
  XCal.fontToday: lucidasanstypewriter-12
! XCal.MarkForeground: Black
! XCal.MarkBackground: White
  XCal.edit.geometry: 300x150
  XCal*text.scrollVertical: WhenNeeded
  XCal*text.scrollHorizontal: WhenNeeded
--- 1,9 ----
  XCal*Font: lucidasanstypewriter-12
  XCal*info.Font: lucidasans-10
  XCal.fontToday: lucidasanstypewriter-12
! ! See below
! !XCal.MarkForeground: Black
! !XCal.MarkBackground: White
  XCal.edit.geometry: 300x150
  XCal*text.scrollVertical: WhenNeeded
  XCal*text.scrollHorizontal: WhenNeeded
***************
*** 29,31 ****
--- 30,54 ----
  XCal*check.yes.Label: yes
  XCal*check.no.Label: no
  XCal*help*helpQuit.Label: quit
+ !
+ ! Colours from reed wade@cs.utk.edu
+ !
+ XCal*background:        LightSteelBlue
+ XCal*foreground:        SaddleBrown
+ XCal.MarkForeground: Black
+ XCal.MarkBackground: CornflowerBlue
+ XCal.edit.background: CornflowerBlue
+ XCal.edit.foreground: OliveGreen
+ XCal*exit.background: MediumTurquoise
+ XCal*exit.foreground: SlateGrey
+ XCal*check.background:  lavender
+ XCal*help*background: wheat
+ XCal*help*foreground: blue
+ XCal*newdate*background: plum
+ XCal*newdate*foreground: red
+ XCal*quit.background:   SteelBlue
+ XCal*quit.background:   green
+ XCal*back.background: yellow
+ XCal*next.background: yellow
+ XCal*no.background: DarkKhaki
+ XCal*yes.background: PapayaWhip
*** xcal.c~	Sat May  5 16:22:46 1990
--- xcal.c	Sat May  5 16:15:25 1990
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal.c	3.2 (Hillside Systems) 12/19/89";
  static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems";
  #endif  lint
  /***
--- 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
  /***
***************
*** 99,104 ****
--- 99,106 ----
  	offset(textbufsz), XtRString, "2048"},
  {"useWmTitle", "UseWmTitle", XtRBoolean, sizeof(Boolean),
  	offset(useWmTitle), XtRString, "True"},
+ {"minStripWidth", "MinStripWidth", XtRDimension, sizeof(Dimension),
+ 	offset(minstripwidth), XtRString, "0"},
  {"january", "January", XtRString, sizeof(String),
  	offset(mon[0]), XtRString, "January"},
  {"february", "February", XtRString, sizeof(String),
*** xcal.h~	Sat May  5 16:25:06 1990
--- xcal.h	Sat May  5 16:15:26 1990
***************
*** 1,5 ****
  /*
!  *	xcal.h	3.1	12/10/89
   *
   *	Header file for the xcal program
   */
--- 1,5 ----
  /*
!  *	xcal.h	3.2	5/2/90
   *
   *	Header file for the xcal program
   */
***************
*** 56,61 ****
--- 56,62 ----
  	String	directory;	/* Directory under home where Calendar files */
  				/* can be found */
  	int	textbufsz;	/* Text buffer size for editing */
+ 	Dimension minstripwidth; /* Minimum strip width */
  };
  
  extern	struct resources	appResources;
*** xcal.man~	Sat May  5 16:24:13 1990
--- xcal.man	Sat May  5 16:15:25 1990
***************
*** 173,182 ****
  If True enables accelerated time.
  Default: False.
  .TP
- .B ReverseVideoMark
- If True entries are marked (highlighted) in reverse video.
- Defaults True for monochrome displays and False for colour displays.
- .TP
  .B MarkBackground
  The background colour for highlighting entries.
  Default Black.
--- 173,178 ----
***************
*** 221,226 ****
--- 217,229 ----
  This information is duplicated if your window manager uses titles
  so it is nice to be able to turn it off.
  Default: True.
+ .TP
+ .B MinStripWidth
+ The width of month strips are set by the top line, which usually
+ displays the month and year.
+ The whole strip can be widened from this default value by setting this
+ resource to be non-zero.
+ Default: zero (i.e. off).
  .TP
  .B TextBufferSize
  the maximum number of bytes which we are prepared to deal with in an
*** xcal_edit.c~	Sat May  5 16:27:54 1990
--- xcal_edit.c	Sat May  5 16:15:29 1990
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_edit.c	3.1 (Hillside Systems) 12/10/89";
  static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems";
  #endif  lint
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_edit.c	3.3 (Hillside Systems) 5/2/90";
  static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems";
  #endif  lint
  /***
***************
*** 458,464 ****
  			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);
--- 458,464 ----
  			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);
***************
*** 480,486 ****
  
  		if (access(fname, F_OK) < 0)
  		{	if (mkdir(fname, 0700) < 0)
! 			{	XBell(XtDisplay(toplevel, 0));
  				fprintf(stderr, "xcal: Could not create: %s/%s directory.\n", MapStem, fname);
  				perror("xcal: mkdir ");
  				fflush(stderr);
--- 480,486 ----
  
  		if (access(fname, F_OK) < 0)
  		{	if (mkdir(fname, 0700) < 0)
! 			{	XBell(XtDisplay(toplevel), 0);
  				fprintf(stderr, "xcal: Could not create: %s/%s directory.\n", MapStem, fname);
  				perror("xcal: mkdir ");
  				fflush(stderr);
***************
*** 499,505 ****
  	strcat(fname, cname);
  
  	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);
--- 499,505 ----
  	strcat(fname, cname);
  
  	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);
***************
*** 507,513 ****
  	}
  
  	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);
--- 507,513 ----
  	}
  
  	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);
***************
*** 765,771 ****
  	register MeWrap	*mw;
  	register Cardinal day;
  	extern	Widget	toplevel;
! 	Arg	args[2];
  	
  	mw = ed->ed_meWrap;
  	day = ed->ed_day;
--- 765,771 ----
  	register MeWrap	*mw;
  	register Cardinal day;
  	extern	Widget	toplevel;
! 	Arg	args[3];
  	
  	mw = ed->ed_meWrap;
  	day = ed->ed_day;
***************
*** 779,789 ****
  		XtFree(mw->mw_have[day]);
  	mw->mw_have[day] = XtMalloc(strlen(ed->ed_data)+1);
  	strcpy(mw->mw_have[day], ed->ed_data);
  	XtSetArg(args[0], XtNlabel, mw->mw_have[day]);
! 	
  	for (ins = mw->mw_list; ins; ins = ins->i_next)
! 		XtSetValues(ins->i_day_info[day], args, 1);
! 
  	XtSetSensitive(ed->ed_save, False);
  }
  
--- 779,797 ----
  		XtFree(mw->mw_have[day]);
  	mw->mw_have[day] = XtMalloc(strlen(ed->ed_data)+1);
  	strcpy(mw->mw_have[day], ed->ed_data);
+ 
  	XtSetArg(args[0], XtNlabel, mw->mw_have[day]);
! 	if (*mw->mw_have[day])
! 	{	XtSetArg(args[1], XtNforeground, appResources.marked.fg);
! 		XtSetArg(args[2], XtNbackground, appResources.marked.bg);
! 	}
  	for (ins = mw->mw_list; ins; ins = ins->i_next)
! 	{	if (*mw->mw_have[day] == '\0')
! 		{	XtSetArg(args[1], XtNforeground, ins->i_col.fg);
! 			XtSetArg(args[2], XtNbackground, ins->i_col.bg);
! 		}
! 		XtSetValues(ins->i_day_info[day], args, 3);
! 	}
  	XtSetSensitive(ed->ed_save, False);
  }
  
*** xcal_strip.c~	Sat May  5 16:26:01 1990
--- xcal_strip.c	Sat May  5 16:15:27 1990
***************
*** 1,5 ****
  #ifndef lint
! static char *sccsid = "@(#)xcal_strip.c	3.3 (Hillside Systems) 2/5/90";
  static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems";
  #endif  lint
  /***
--- 1,5 ----
  #ifndef lint
! static char *sccsid = "@(#)xcal_strip.c	3.4 (Hillside Systems) 5/2/90";
  static char *copyright = "@(#)Copyright 1989 Peter Collinson, Hillside Systems";
  #endif  lint
  /***
***************
*** 164,169 ****
--- 164,174 ----
  	XtSetArg(args[0], XtNwidth, &totalWidth);
  	XtGetValues(lw, args, 1);
  	XtDestroyWidget(lw);
+ 	/*
+ 	 *	Width is affected by a resource value
+ 	 */
+ 	if (appResources.minstripwidth && appResources.minstripwidth > totalWidth)
+ 		totalWidth = appResources.minstripwidth;
  	/*
  	 *	Now set the title bar should we need it
  	 */
*** /dev/null	Sat May  5 15:32:42 1990
--- CHANGES	Sat May  5 16:15:31 1990
***************
*** 0 ****
--- 1,22 ----
+ 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.
+ 
+ xcal.h/xcal.c/xcal_strip.c
+ 		Add a new resource minStripWidth intended to allow
+ 		users to widen the strip to some value which seems
+ 		sensible. If zero the resource is unused.
+ 
+ XCal.ad		Add colour map from wade@cs.utk.edu
+ 
+ xcal_edit.c	Changes to XBell calls due to typo
+ 		Steve Alexander, Software Technologies Group
+ 		INTERACTIVE Systems Corporation, Naperville, IL
+ 		 ...!{sun,ico}!laidbak!stevea
+ 		stevea@i88.isc.com
+ 
+ 
+ Xcal - Version 1.1 Issued to the net comp.sources.x. 
+ 		xcal: Volume 7, Issue 1-2
+ 

dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.