olafh%berthold.UUCP%TUB.BITNET@mitvma.mit.edu (Olaf Heimburger) (11/14/90)
Submitted-by: olafh%berthold.UUCP%TUB.BITNET@mitvma.mit.edu (Olaf Heimburger) Posting-number: Volume 10, Issue 32 Archive-name: xchrom/part01 moderator's note: This is a repost of xchrom -- as just about all of you have generously pointed out, there was character tranformations in transmission from the original author and I didn't catch it. --dan #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # made 11/06/1990 10:39 UTC by olafh@GECKO # Source directory /usr2/BS/olafh/src/Xchrom1.5 # # existing files will NOT be overwritten unless -c is specified # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1854 -rw-r--r-- README # 386 -rw-r--r-- Imakefile # 928 -rw-r--r-- Makefile.std # 4448 -rw-r--r-- xchrom.man # 2783 -rw-r--r-- Xchrom.h # 1175 -rw-r--r-- XchromP.h # 21 -rw-r--r-- patchlevel.h # 2270 -rw-r--r-- xchrom.xbm # 2285 -rw-r--r-- xchrom_mask.xbm # 12033 -rw-r--r-- Xchrom.c # 3344 -rw-r--r-- xchrom.c # # ============= README ============== if test -f 'README' -a X"$1" != X"-c"; then echo 'x - skipping README (File already exists)' else echo 'x - extracting README (Text)' sed 's/^X//' << 'SHAR_EOF' > 'README' && X This is xchrom, version 1, patchlevel 5. X CHANGES: X X - Improved Imakefile. Thanks to Dan A. Greening <dgreen@watson.BITNET>. X X - Xchrom dumps core when invoked with an argument. Fixed. X X - Toolkit options like -title or -name won't be overriden anymore. X X - New command line option and resource for dynamic frame X width changes. X X - New command line option and resource for dynamic changes X between black disc and color-time-circle. X X - New command line option and resource for the difference X between system time and current time. X X - Many layout changes in all source files. X X - Fixed spelling. X ------------------------------------------------------------------------------- X This is xchrom, version 1, patchlevel 4. X On a chronometer time is shown by hands and numerals. Differently on CHROMACHRON, the color-time-clock: Its face is not a dial but a color-time-circle, over which a black disk revolves with a piece cut out as large as a color segment. The disk revolves with the speed of one color area per hour. The disk cut-out indicates the time. If, for example, this stands on yellow, it is 12 noon. The more to be seen of the following color, the nearer the next hour. X The use of ICCCM-compliant window managers is now supported. There is an -D flag in the Makefile.std and Imakefile. For further information see these files. X To compile, just run make and watch it go. X There is a Makefile.std for those who don't like, have or, understand imake. X Copyright (c) 1990, Olaf Heimburger. Permission to use and copy. X Enjoy! X * Olaf Heimburger, H. Berthold AG, Software Development, Berlin (Germany) * uucp: ...!pyramid!tub!olaf (US) ...!mcvax!unido!tub!olaf (Europe) * <olaf@tub.UUCP> <olaf@db0tui6.BITNET> <olaf@tub.BITNET> <olafh%berthold@tub> * VOICE: +49 30 7 79 54 64 FAX: +49 30 7 79 53 06 SHAR_EOF chmod 0644 README || echo 'restore of README failed' Wc_c="`wc -c < 'README'`" test 1854 -eq "$Wc_c" || echo 'README: original size 1854, current size' "$Wc_c" fi # ============= Imakefile ============== if test -f 'Imakefile' -a X"$1" != X"-c"; then echo 'x - skipping Imakefile (File already exists)' else echo 'x - extracting Imakefile (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' && /**/# /**/# -DICCCM_COMP -- if the window manager is ICCCM-compliant (tested under /**/# OpenWindows 2.0) /**/# DEFINES = -DICCCM_COMP SYS_LIBRARIES = -lm DEPLIBS = $(DEPXTOOLLIB) $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTOOLLIB) $(XMULIB) $(EXTENSIONLIB) $(XLIB) X SRCS = Xchrom.c xchrom.c OBJS = Xchrom.o xchrom.o X ComplexProgramTarget(xchrom) SHAR_EOF chmod 0644 Imakefile || echo 'restore of Imakefile failed' Wc_c="`wc -c < 'Imakefile'`" test 386 -eq "$Wc_c" || echo 'Imakefile: original size 386, current size' "$Wc_c" fi # ============= Makefile.std ============== if test -f 'Makefile.std' -a X"$1" != X"-c"; then echo 'x - skipping Makefile.std (File already exists)' else echo 'x - extracting Makefile.std (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Makefile.std' && # Last edited: Thu Nov 1 14:12:27 1990 by olafh (Olaf Heimburger) on GECKO # Please read the accompanying README file before running Make SRCS= Xchrom.c xchrom.c OBJS= Xchrom.o xchrom.o HFILES= Xchrom.h XchromP.h patchlevel.h xchrom.xbm xchrom_mask.xbm X SHARFLAGS= -c X # # -DICCCM_COMP -- if the window manager is ICCCM compliant (tested under # OpenWindows 2.0) # CFLAGS= -O -DICCCM_COMP LDFLAGS= LIBS= -lXmu -lXt -lX11 -lm X all: xchrom X xchrom: $(OBJS) X cc $(LDFLAGS) $(OBJS) $(LIBS) -o xchrom X clean: X rm -f $(OBJS) *~ core xchrom X xchrom.shar: X shar $(SHARFLAGS) README Imakefile Makefile.std xchrom.man \ X $(HFILES) $(SRCS) > $@ X xchrom.shar.uu: xchrom.shar X cat xchrom.shar | uuencode xchrom.shar > $@ X xchrom.tar.Z: X tar cvf - Imakefile README Makefile.std xchrom.man $(HFILES) $(SRCS) | \ X compress > $@ X XXchrom.o: Xchrom.c Xchrom.h XchromP.h xchrom.o: xchrom.c xchrom.xbm xchrom_mask.xbm patchlevel.h SHAR_EOF chmod 0644 Makefile.std || echo 'restore of Makefile.std failed' Wc_c="`wc -c < 'Makefile.std'`" test 928 -eq "$Wc_c" || echo 'Makefile.std: original size 928, current size' "$Wc_c" fi # ============= xchrom.man ============== if test -f 'xchrom.man' -a X"$1" != X"-c"; then echo 'x - skipping xchrom.man (File already exists)' else echo 'x - extracting xchrom.man (Text)' sed 's/^X//' << 'SHAR_EOF' > 'xchrom.man' && .TH XCHROM 1 "1 September 1988" "X Version 11" .SH NAME xchrom - CHROMACHRON like clock for X .SH SYNOPSIS .B xchrom [-\fIstartoffset n\fP] [-\fImaskoffset n\fP] [-\fItimeoffset n\fP] [-\fItoolkitoption\fP ...] .SH DESCRIPTION The .I xchrom program displays the time in the CHROMACHRON format. The time is updated on a per minute basis. This program is nothing more than a wrapper around the xchrom widget not associated with any particular widget set. .PP On a chronometer time is shown by hands and numerals. Differently on CHROMACHRON, the color-time-clock: Its face is not a dial but a color-time-circle, over which a black disk revolves with a piece cut out as large as a color segment. The disk revolves with the speed of one color area per hour. The disk cut-out indicates the time. If, for example, this stands on yellow, it is 12 noon. The more to be seen of the following color, the nearer the next hour. .sp .SH OPTIONS .I Xchrom supports the following command line options: .TP 8 .B -startoffset n Specifies the frame width between color-time-circle and window border. .TP 8 .B -maskoffset n Specifies the width between the color-time-circle border and the revolving disk. The default is 4 pixels. .TP 8 .B -timeoffset n Specifies the difference between system time and current time. It was often discovered that the system time and current time differ (e.g. 2 minutes on the author's system). .LP .I Xchrom also accepts all of the standard X Toolkit command line options. .SH X DEFAULTS It understands all of the core resource names and classes as well as: .TP 8 .B foreground (\fPclass\fB Foreground) Specifies the color for the frame and the slice mask. Using the class specifies the color for all things that normally would appear in the foreground color. The default is ``black'' since the core default for background is ``white.'' .TP 8 .B startOffset (\fPclass\fB StartOffset) Specifies the frame width between color-time-circle and window border. The default is 10 pixels. .TP 8 .B maskOffset (\fPclass\fB MaskOffset) Specifies the width between the color-time-circle border and the revolving disk. The default is 4 pixels. .TP 8 .B timeOffset (\fPclass\fB TimeOffset) Specifies the difference between the system time and the current time. The default value is 0. .TP 8 .B twelveOClock (\fPclass\fB TwelveOClock) Specifies the color for the twelve o'clock time slice. The default is ``yellow''. .TP 8 .B oneOClock (\fPclass\fB OneOClock) Specifies the color for the one o'clock time slice. The default is ``orange''. .TP 8 .B twoOClock (\fPclass\fB TwoOClock) Specifies the color for the two o'clock time slice. The default is ``pink''. .TP 8 .B threeOClock (\fPclass\fB ThreeOClock) Specifies the color for the three o'clock time slice. The default is ``red''. .TP 8 .B fourOClock (\fPclass\fB FourOClock) Specifies the color for the four o'clock time slice. The default is ``light pink''. .TP 8 .B fiveOClock (\fPclass\fB FiveOClock) Specifies the color for the five o'clock time slice. The default is ``violet''. .TP 8 .B sixOClock (\fPclass\fB SixOClock) Specifies the color for the six o'clock time slice. The default is ``royal blue''. .TP 8 .B sevenOClock (\fPclass\fB SevenOClock) Specifies the color for the seven o'clock time slice. The default is ``dark green''. .TP 8 .B eightOClock (\fPclass\fB EightOClock) Specifies the color for the eight o'clock time slice. The default is ``turquiose''. .TP 8 .B nineOClock (\fPclass\fB NineOClock) Specifies the color for the nine o'clock time slice. The default is ``brown''. .TP 8 .B tenOClock (\fPclass\fB TenOClock) Specifies the color for the ten o'clock time slice. The default is ``light yellow''. .TP 8 .B elevenOClock (\fPclass\fB ElevenOClock) Specifies the color for the eleven o'clock time slice. The default is ``wheat''. .SH ENVIRONMENT .PP .TP 8 .B DISPLAY to get the default host and display number. .TP 8 .B XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH "SEE ALSO" XX(1), xrdb(1), time(3C). .SH BUGS The colors are chosen in a best fit manner. It is possible that not every color server supports the default colors. If that happens use the ~/.Xdefaults file to set the nearest approximation of your server. .SH COPYRIGHT Copyright (c) 1990, Olaf Heimburger. Permission to use and copy. .SH AUTHOR .nf Olaf Heimburger --- <olaf@tub.BITNET>, <olafh@berthold.de> .fi SHAR_EOF chmod 0644 xchrom.man || echo 'restore of xchrom.man failed' Wc_c="`wc -c < 'xchrom.man'`" test 4448 -eq "$Wc_c" || echo 'xchrom.man: original size 4448, current size' "$Wc_c" fi # ============= Xchrom.h ============== if test -f 'Xchrom.h' -a X"$1" != X"-c"; then echo 'x - skipping Xchrom.h (File already exists)' else echo 'x - extracting Xchrom.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Xchrom.h' && /* X * Xchrom.h -- a CHROMACHRON clock widget. public header. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Tue Nov 6 10:26:52 1990 by olafh (Olaf Heimburger) on GECKO X */ #ifndef _XtXchrom_h #define _XtXchrom_h X /* Parameters: X */ X #define XARCMAGIC 64 #define STARTCORNER 10 #define NUMFIELDS 12 #define SLICEANGLE 30 #define STARTDEGREES 105 #define MASKDEGREES 330 #define BACKCOLOR NUMFIELDS #define SLICEMASK NUMFIELDS #define MASKOFFSET 4 #define MINSIZE 120 #define MINWIDTH MINSIZE #define MINHEIGHT MINSIZE X #ifndef XtDefaultForeground #define XtDefaultForeground "Black" #endif X #ifndef XtNstartOffset #define XtNstartOffset "startOffset" #endif #ifndef XtCStartOffset #define XtCStartOffset "StartOffset" #endif #ifndef XtNmaskOffset #define XtNmaskOffset "maskOffset" #endif #ifndef XtCMaskOffset #define XtCMaskOffset "MaskOffset" #endif #ifndef XtNtimeOffset #define XtNtimeOffset "timeOffset" #endif #ifndef XtCTimeOffset #define XtCTimeOffset "TimeOffset" #endif #ifndef XtNtwelveOClock #define XtNtwelveOClock "twelveOClock" #endif #ifndef XtCTwelveOClock #define XtCTwelveOClock "TwelveOClock" #endif #ifndef XtNoneOClock #define XtNoneOClock "oneOClock" #endif #ifndef XtCOneOClock #define XtCOneOClock "OneOClock" #endif #ifndef XtNtwoOClock #define XtNtwoOClock "twoOClock" #endif #ifndef XtCTwoOClock #define XtCTwoOClock "TwoOClock" #endif #ifndef XtNthreeOClock #define XtNthreeOClock "threeOClock" #endif #ifndef XtCThreeOClock #define XtCThreeOClock "ThreeOClock" #endif #ifndef XtNfourOClock #define XtNfourOClock "fourOClock" #endif #ifndef XtCFourOClock #define XtCFourOClock "FourOClock" #endif #ifndef XtNfiveOClock #define XtNfiveOClock "fiveOClock" #endif #ifndef XtCFiveOClock #define XtCFiveOClock "FiveOClock" #endif #ifndef XtNsixOClock #define XtNsixOClock "sixOClock" #endif #ifndef XtCSixOClock #define XtCSixOClock "SixOClock" #endif #ifndef XtNsevenOClock #define XtNsevenOClock "sevenOClock" #endif #ifndef XtCSevenOClock #define XtCSevenOClock "SevenOClock" #endif #ifndef XtNeightOClock #define XtNeightOClock "eightOClock" #endif #ifndef XtCEightOClock #define XtCEightOClock "EightOClock" #endif #ifndef XtNnineOClock #define XtNnineOClock "nineOClock" #endif #ifndef XtCNineOClock #define XtCNineOClock "NineOClock" #endif #ifndef XtNtenOClock #define XtNtenOClock "tenOClock" #endif #ifndef XtCTenOClock #define XtCTenOClock "TenOClock" #endif #ifndef XtNelevenOClock #define XtNelevenOClock "elevenOClock" #endif #ifndef XtCElevenOClock #define XtCElevenOClock "ElevenOClock" #endif X X typedef struct _XchromRec *XchromWidget; typedef struct _XchromClassRec *XchromWidgetClass; X extern WidgetClass xchromWidgetClass; X #endif /* _XtXchrom_h */ SHAR_EOF chmod 0644 Xchrom.h || echo 'restore of Xchrom.h failed' Wc_c="`wc -c < 'Xchrom.h'`" test 2783 -eq "$Wc_c" || echo 'Xchrom.h: original size 2783, current size' "$Wc_c" fi # ============= XchromP.h ============== if test -f 'XchromP.h' -a X"$1" != X"-c"; then echo 'x - skipping XchromP.h (File already exists)' else echo 'x - extracting XchromP.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'XchromP.h' && /* X * XchromP.h -- a CHROMACHRON clock widget. private header. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Thu Nov 1 12:52:19 1990 by olafh (Olaf Heimburger) on GECKO X */ #ifndef _XtXchromP_h #define _XtXchromP_h X #include <X11/CoreP.h> #include "Xchrom.h" X typedef struct { X Pixel foreground; X Pixel color[NUMFIELDS]; X int startOffset; X int maskOffset; X int timeOffset; /* in minutes */ X /* non-resources (e.g. user can't set) */ X XtIntervalId intervalId; X GC colors[NUMFIELDS + 1]; X Pixmap colorPixmap; X XArc slices[NUMFIELDS + 1]; X int savedHour; X int savedMin; X int arcSize; X Dimension squareSize; X Pixmap wdwPixmap; X int offset; X int minOffset; X int hourOffset; } XchromPart; X typedef struct _XchromRec { X CorePart core; X XchromPart xchrom; } XchromRec; X typedef struct {int dummy;} XchromClassPart; X typedef struct _XchromClassRec { X CoreClassPart core_class; X XchromClassPart xchrom_class; } XchromClassRec; X extern XchromClassRec xchromClassRec; X #endif _XtXchromP_h SHAR_EOF chmod 0644 XchromP.h || echo 'restore of XchromP.h failed' Wc_c="`wc -c < 'XchromP.h'`" test 1175 -eq "$Wc_c" || echo 'XchromP.h: original size 1175, current size' "$Wc_c" fi # ============= patchlevel.h ============== if test -f 'patchlevel.h' -a X"$1" != X"-c"; then echo 'x - skipping patchlevel.h (File already exists)' else echo 'x - extracting patchlevel.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' && #define PATCHLEVEL 5 SHAR_EOF chmod 0644 patchlevel.h || echo 'restore of patchlevel.h failed' Wc_c="`wc -c < 'patchlevel.h'`" test 21 -eq "$Wc_c" || echo 'patchlevel.h: original size 21, current size' "$Wc_c" fi # ============= xchrom.xbm ============== if test -f 'xchrom.xbm' -a X"$1" != X"-c"; then echo 'x - skipping xchrom.xbm (File already exists)' else echo 'x - extracting xchrom.xbm (Text)' sed 's/^X//' << 'SHAR_EOF' > 'xchrom.xbm' && #define xchrom_width 50 #define xchrom_height 50 static char xchrom_bits[] = { X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, X 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x06, 0x00, 0x00, X 0x00, 0x00, 0x80, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x06, X 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x06, 0x00, 0xe0, 0x01, 0x00, 0x80, X 0x01, 0x06, 0x00, 0xfc, 0x01, 0x00, 0x80, 0x01, 0x06, 0x00, 0xff, 0x01, X 0x00, 0x80, 0x01, 0x06, 0xc0, 0xff, 0x01, 0x18, 0x80, 0x01, 0x06, 0xe0, X 0xff, 0x01, 0x3c, 0x80, 0x01, 0x06, 0xf0, 0xff, 0x01, 0x7c, 0x80, 0x01, X 0x06, 0xf8, 0xff, 0x01, 0xfe, 0x80, 0x01, 0x06, 0xfc, 0xff, 0x01, 0xfe, X 0x81, 0x01, 0x06, 0xfe, 0xff, 0x01, 0xff, 0x83, 0x01, 0x06, 0xfe, 0xff, X 0x81, 0xff, 0x83, 0x01, 0x06, 0xff, 0xff, 0x81, 0xff, 0x87, 0x01, 0x06, X 0xff, 0xff, 0xc1, 0xff, 0x87, 0x01, 0x86, 0xff, 0xff, 0xc1, 0xff, 0x8f, X 0x01, 0x86, 0xff, 0xff, 0xe1, 0xff, 0x8f, 0x01, 0x86, 0xff, 0xff, 0xe1, X 0xff, 0x8f, 0x01, 0xc6, 0xff, 0xff, 0xf1, 0xff, 0x9f, 0x01, 0xc6, 0xff, X 0xff, 0xf9, 0xff, 0x9f, 0x01, 0xc6, 0xff, 0xff, 0xf9, 0xff, 0x9f, 0x01, X 0xc6, 0xff, 0xff, 0xfd, 0xff, 0x9f, 0x01, 0xc6, 0xff, 0xff, 0xfd, 0xff, X 0x9f, 0x01, 0xc6, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x01, 0xc6, 0xff, 0xff, X 0xff, 0xff, 0x9f, 0x01, 0xc6, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x01, 0xc6, X 0xff, 0xff, 0xff, 0xff, 0x9f, 0x01, 0x86, 0xff, 0xff, 0xff, 0xff, 0x8f, X 0x01, 0x86, 0xff, 0xff, 0xff, 0xff, 0x8f, 0x01, 0x86, 0xff, 0xff, 0xff, X 0xff, 0x8f, 0x01, 0x06, 0xff, 0xff, 0xff, 0xff, 0x87, 0x01, 0x06, 0xff, X 0xff, 0xff, 0xff, 0x87, 0x01, 0x06, 0xfe, 0xff, 0xff, 0xff, 0x83, 0x01, X 0x06, 0xfe, 0xff, 0xff, 0xff, 0x83, 0x01, 0x06, 0xfc, 0xff, 0xff, 0xff, X 0x81, 0x01, 0x06, 0xf8, 0xff, 0xff, 0xff, 0x80, 0x01, 0x06, 0xf0, 0xff, X 0xff, 0x7f, 0x80, 0x01, 0x06, 0xe0, 0xff, 0xff, 0x3f, 0x80, 0x01, 0x06, X 0xc0, 0xff, 0xff, 0x1f, 0x80, 0x01, 0x06, 0x00, 0xff, 0xff, 0x07, 0x80, X 0x01, 0x06, 0x00, 0xfc, 0xff, 0x01, 0x80, 0x01, 0x06, 0x00, 0xe0, 0x3f, X 0x00, 0x80, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x06, 0x00, X 0x00, 0x00, 0x00, 0x80, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, X 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00}; SHAR_EOF chmod 0644 xchrom.xbm || echo 'restore of xchrom.xbm failed' Wc_c="`wc -c < 'xchrom.xbm'`" test 2270 -eq "$Wc_c" || echo 'xchrom.xbm: original size 2270, current size' "$Wc_c" fi # ============= xchrom_mask.xbm ============== if test -f 'xchrom_mask.xbm' -a X"$1" != X"-c"; then echo 'x - skipping xchrom_mask.xbm (File already exists)' else echo 'x - extracting xchrom_mask.xbm (Text)' sed 's/^X//' << 'SHAR_EOF' > 'xchrom_mask.xbm' && #define xchrom_mask_width 50 #define xchrom_mask_height 50 static char xchrom_mask_bits[] = { X 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, X 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, X 0xff, 0xff, 0xff, 0x03, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x0f, X 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0xe0, 0x01, 0x00, 0xc0, X 0x03, 0x0f, 0x00, 0xfc, 0x01, 0x00, 0xc0, 0x03, 0x0f, 0x00, 0xff, 0x01, X 0x00, 0xc0, 0x03, 0x0f, 0xc0, 0xff, 0x01, 0x18, 0xc0, 0x03, 0x0f, 0xe0, X 0xff, 0x01, 0x3c, 0xc0, 0x03, 0x0f, 0xf0, 0xff, 0x01, 0x7c, 0xc0, 0x03, X 0x0f, 0xf8, 0xff, 0x01, 0xfe, 0xc0, 0x03, 0x0f, 0xfc, 0xff, 0x01, 0xfe, X 0xc1, 0x03, 0x0f, 0xfe, 0xff, 0x01, 0xff, 0xc3, 0x03, 0x0f, 0xfe, 0xff, X 0x81, 0xff, 0xc3, 0x03, 0x0f, 0xff, 0xff, 0x81, 0xff, 0xc7, 0x03, 0x0f, X 0xff, 0xff, 0xc1, 0xff, 0xc7, 0x03, 0x8f, 0xff, 0xff, 0xc1, 0xff, 0xcf, X 0x03, 0x8f, 0xff, 0xff, 0xe1, 0xff, 0xcf, 0x03, 0x8f, 0xff, 0xff, 0xe1, X 0xff, 0xcf, 0x03, 0xcf, 0xff, 0xff, 0xf1, 0xff, 0xdf, 0x03, 0xcf, 0xff, X 0xff, 0xf9, 0xff, 0xdf, 0x03, 0xcf, 0xff, 0xff, 0xf9, 0xff, 0xdf, 0x03, X 0xcf, 0xff, 0xff, 0xfd, 0xff, 0xdf, 0x03, 0xcf, 0xff, 0xff, 0xfd, 0xff, X 0xdf, 0x03, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x03, 0xcf, 0xff, 0xff, X 0xff, 0xff, 0xdf, 0x03, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x03, 0xcf, X 0xff, 0xff, 0xff, 0xff, 0xdf, 0x03, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xcf, X 0x03, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x03, 0x8f, 0xff, 0xff, 0xff, X 0xff, 0xcf, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x03, 0x0f, 0xff, X 0xff, 0xff, 0xff, 0xc7, 0x03, 0x0f, 0xfe, 0xff, 0xff, 0xff, 0xc3, 0x03, X 0x0f, 0xfe, 0xff, 0xff, 0xff, 0xc3, 0x03, 0x0f, 0xfc, 0xff, 0xff, 0xff, X 0xc1, 0x03, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xc0, 0x03, 0x0f, 0xf0, 0xff, X 0xff, 0x7f, 0xc0, 0x03, 0x0f, 0xe0, 0xff, 0xff, 0x3f, 0xc0, 0x03, 0x0f, X 0xc0, 0xff, 0xff, 0x1f, 0xc0, 0x03, 0x0f, 0x00, 0xff, 0xff, 0x07, 0xc0, X 0x03, 0x0f, 0x00, 0xfc, 0xff, 0x01, 0xc0, 0x03, 0x0f, 0x00, 0xe0, 0x3f, X 0x00, 0xc0, 0x03, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xff, 0xff, X 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, X 0xff, 0x03}; SHAR_EOF chmod 0644 xchrom_mask.xbm || echo 'restore of xchrom_mask.xbm failed' Wc_c="`wc -c < 'xchrom_mask.xbm'`" test 2285 -eq "$Wc_c" || echo 'xchrom_mask.xbm: original size 2285, current size' "$Wc_c" fi # ============= Xchrom.c ============== if test -f 'Xchrom.c' -a X"$1" != X"-c"; then echo 'x - skipping Xchrom.c (File already exists)' else echo 'x - extracting Xchrom.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Xchrom.c' && /* X * Xchrom.c -- a CHROMACHRON clock widget. implementation module. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Tue Nov 6 11:16:24 1990 by olafh (Olaf Heimburger) on GECKO X */ X #include <stdio.h> #include <math.h> #include <X11/IntrinsicP.h> #include <X11/Xos.h> #include <X11/StringDefs.h> #include "XchromP.h" X static void Initialize (), Resize (), Realize (), Destroy (), X Redisplay (), Timeout (), GetGC (), GetColorGC (), ShowTime (); X static Boolean SetValues (); X static Dimension winWidth = MINWIDTH; static Dimension winHeight = MINHEIGHT; static int sOffset = STARTCORNER; static int mOffset = MASKOFFSET; static int tOffset = 0; /* believe system clock */ X static int sliceAngles[NUMFIELDS] = { X 75, /* twelve */ X 45, /* one */ X 15, /* two */ X 345, /* three */ X 315, /* four */ X 285, /* five */ X 255, /* six */ X 225, /* seven */ X 195, /* eight */ X 165, /* nine */ X 135, /* ten */ X 105, /* eleven */ }; X static XtResource resources[] = { X { XtNwidth, XtCWidth, XtRDimension, sizeof (Dimension), X XtOffset (Widget, core.width), XtRDimension, (caddr_t)&winWidth }, X { XtNheight, XtCHeight, XtRDimension, sizeof (Dimension), X XtOffset (Widget, core.height), XtRDimension, (caddr_t)&winHeight }, X { XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.foreground), XtRString, X XtDefaultForeground}, X { XtNstartOffset, XtCStartOffset, XtRInt, sizeof (int), X XtOffset (XchromWidget, xchrom.startOffset), XtRInt, X (caddr_t)&sOffset}, X { XtNmaskOffset, XtCMaskOffset, XtRInt, sizeof (int), X XtOffset (XchromWidget, xchrom.maskOffset), XtRInt, (caddr_t)&mOffset}, X { XtNtimeOffset, XtCTimeOffset, XtRInt, sizeof (int), X XtOffset (XchromWidget, xchrom.timeOffset), XtRInt, (caddr_t)&tOffset}, X { XtNtwelveOClock, XtCTwelveOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[0]), XtRString, "Yellow"}, X { XtNoneOClock, XtCOneOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[1]), XtRString, "Orange"}, X { XtNtwoOClock, XtCTwoOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[2]), XtRString, "Pink"}, X { XtNthreeOClock, XtCThreeOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[3]), XtRString, "Red"}, X { XtNfourOClock, XtCFourOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[4]), XtRString, "LightPink"}, X { XtNfiveOClock, XtCFiveOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[5]), XtRString, "Violet"}, X { XtNsixOClock, XtCSixOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[6]), XtRString, "RoyalBlue"}, X { XtNsevenOClock, XtCSevenOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[7]), XtRString, "DarkGreen"}, X { XtNeightOClock, XtCEightOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[8]), XtRString, "Turquoise"}, X { XtNnineOClock, XtCNineOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[9]), XtRString, "Brown"}, X { XtNtenOClock, XtCTenOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[10]), XtRString, "LightYellow"}, X { XtNelevenOClock, XtCElevenOClock, XtRPixel, sizeof (Pixel), X XtOffset (XchromWidget, xchrom.color[11]), XtRString, "Wheat"}, }; X XXchromClassRec xchromClassRec = { X { /* core fields */ X /* superclass */ &widgetClassRec, X /* class_name */ "Xchrom", X /* widget_size */ sizeof (XchromRec), X /* class_initialize */ NULL, X /* class_part_initialize */ NULL, X /* class_inited */ FALSE, X /* initialize */ Initialize, X /* initialize_hook */ NULL, X /* realize */ Realize, X /* actions */ NULL, X /* num_actions */ 0, X /* resources */ resources, X /* resource_count */ XtNumber (resources), X /* xrm_class */ NULL, X /* compress_motion */ TRUE, X /* compress_exposure */ TRUE, X /* compress_enterleave */ TRUE, X /* visible_interest */ FALSE, X /* destroy */ Destroy, X /* resize */ Resize, X /* expose */ Redisplay, X /* set_values */ SetValues, X /* set_values_hook */ NULL, X /* set_values_almost */ XtInheritSetValuesAlmost, X /* get_values_hook */ NULL, X /* accept_focus */ NULL, X /* version */ XtVersion, X /* callback_private */ NULL, X /* tm_table */ NULL, X /* query_geometry */ NULL, X } }; X WidgetClass xchromWidgetClass = (WidgetClass) &xchromClassRec; X /* ARGSUSED */ static void Initialize (request, new) X XchromWidget request; X XchromWidget new; { X if (new) { X int i; X new->xchrom.intervalId = None; X new->xchrom.wdwPixmap = new->xchrom.colorPixmap = None; X /* X * initialize the color table X */ X for (i = 0; i < NUMFIELDS; ++i) { X GetColorGC (new, i); X } X /* X * Initialize the angles for the slices. X */ X for (i = 0; i < NUMFIELDS; ++i) { X new->xchrom.slices[i].angle1 = (short)(sliceAngles[i] * XARCMAGIC); X new->xchrom.slices[i].angle2 = (short)(SLICEANGLE * XARCMAGIC); X } X new->xchrom.slices[SLICEMASK].angle1 = STARTDEGREES * XARCMAGIC; X new->xchrom.slices[SLICEMASK].angle2 = MASKDEGREES * XARCMAGIC; X new->xchrom.slices[SLICEMASK].x = X new->xchrom.slices[SLICEMASK].y = X new->xchrom.startOffset + new->xchrom.maskOffset; X new->xchrom.minOffset = new->xchrom.timeOffset % 60; X new->xchrom.hourOffset = new->xchrom.timeOffset / 60; X } X GetGC (new); } X static void GetColorGC (w, i) X XchromWidget w; X int i; { X if (w && i >= 0 && i < NUMFIELDS) { X XGCValues gcv; X XtGCMask mask = GCForeground | GCBackground | GCFunction; X gcv.background = WhitePixel (XtDisplay (w), X DefaultScreen (XtDisplay (w))); X gcv.function = GXcopy; X gcv.foreground = w->xchrom.color[i]; X w->xchrom.colors[i] = XtGetGC ((Widget)w, mask, &gcv); X } } X static void GetGC (w) X XchromWidget w; { X if (w) { X XGCValues gcv; X XtGCMask mask = GCForeground | GCBackground | GCFunction; X gcv.background = w->core.background_pixel; X gcv.foreground = w->xchrom.foreground; X gcv.function = GXcopy; X w->xchrom.colors[BACKCOLOR] = XtGetGC ((Widget)w, mask, &gcv); X } } X static void CreatePixmaps (w) X XchromWidget w; { X if (w) { X /* X * Create the pixmap's and clear 'em. X */ X Display *dpy = XtDisplay (w); X Window win = XtWindow (w); X GC tmpGC; X XGCValues gcv; X XtGCMask mask = GCForeground | GCBackground | GCFunction; X if (w->xchrom.colorPixmap != None) { X XFreePixmap (dpy, w->xchrom.colorPixmap); X } X if (w->xchrom.wdwPixmap != None) { X XFreePixmap (dpy, w->xchrom.wdwPixmap); X } X gcv.foreground = WhitePixel (dpy, DefaultScreen (dpy)); X gcv.background = BlackPixel (dpy, DefaultScreen (dpy)); X gcv.function = GXcopy; X tmpGC = XtGetGC (w, mask, &gcv); X w->xchrom.colorPixmap = X XCreatePixmap (dpy, win, w->xchrom.arcSize, w->xchrom.arcSize, X DefaultDepth (dpy, DefaultScreen (dpy))); X XFillRectangle (dpy, w->xchrom.colorPixmap, tmpGC, 0, 0, X w->xchrom.arcSize, w->xchrom.arcSize); X w->xchrom.wdwPixmap = X XCreatePixmap (dpy, win, w->core.width, w->core.height, X DefaultDepth (dpy, DefaultScreen (dpy))); X XFillRectangle (dpy, w->xchrom.wdwPixmap, tmpGC, 0, 0, w->core.width, X w->core.height); X XtReleaseGC (w, tmpGC); X } } X static void Realize (w, valueMask, attrs) X Widget w; X XtValueMask *valueMask; X XSetWindowAttributes *attrs; { X *valueMask |= CWBitGravity; X attrs->bit_gravity = ForgetGravity; X XtCreateWindow(w, InputOutput, (Visual*)CopyFromParent, *valueMask, X attrs); X Resize(w); } X static void Destroy (w) X XchromWidget w; { X int n; X X if (w->xchrom.intervalId) { X XtRemoveTimeOut (w->xchrom.intervalId); X } X for (n = 0; n < NUMFIELDS + 1; ++n) { X XtReleaseGC (w, w->xchrom.colors[n]); X } X if (w->xchrom.colorPixmap) { X XFreePixmap (XtDisplay (w), w->xchrom.colorPixmap); X } X if (w->xchrom.wdwPixmap) { X XFreePixmap (XtDisplay (w), w->xchrom.wdwPixmap); X } } X /* ARGSUSED */ static void Resize (w) X XchromWidget w; { X if (XtIsRealized (w)) { X Display *dpy = XtDisplay (w); X int width = w->core.width; X int height = w->core.height; X /* X * Get the minimum size of the square X */ X w->xchrom.squareSize = X ((width > height) ? height : width) - (w->xchrom.startOffset * 2); X if (w->xchrom.squareSize > 0) { X XRectangle rect; X int i = 0; X int halfSize = w->xchrom.squareSize / 2; X w->xchrom.arcSize = X ((int)sqrt ((float)((halfSize * halfSize) X + (halfSize * halfSize))) * 2) + 3; X w->xchrom.offset = X (int)((w->xchrom.arcSize - w->xchrom.squareSize) / 2); X CreatePixmaps (w); X /* X * Fill the color pixmap X */ X for (i = 0; i < NUMFIELDS; ++i) { X w->xchrom.slices[i].x = w->xchrom.slices[i].y = 0; X w->xchrom.slices[i].width = w->xchrom.slices[i].height = X w->xchrom.arcSize; X XFillArcs (dpy, w->xchrom.colorPixmap, w->xchrom.colors[i], X &w->xchrom.slices[i], 1); X } X /* X * Fill the background X */ X rect.x = 0; X rect.y = 0; X rect.width = width; X rect.height = height; X XFillRectangles (dpy, w->xchrom.wdwPixmap, X w->xchrom.colors[BACKCOLOR], &rect, 1); X /* X * Set the slice mask size. X */ X w->xchrom.slices[SLICEMASK].width = X w->xchrom.slices[SLICEMASK].height = X w->xchrom.squareSize - (w->xchrom.maskOffset * 2); X } X } } X /* ARGSUSED */ static void Redisplay (w) X XchromWidget w; { X if (XtIsRealized (w)) { X long t = time (0); X if (w->xchrom.intervalId != None) { X XtRemoveTimeOut (w->xchrom.intervalId); X w->xchrom.intervalId = NULL; X } X ShowTime (w); X w->xchrom.intervalId = X XtAddTimeOut ((unsigned long)(60 - (t % 60)) * 1000, Timeout, w); X } } X static void ShowTime (w) X XchromWidget w; { X long t = time (0); X register struct tm *lTime = localtime (&t); X X /* X * Clear the previous slice mask. X */ X XCopyArea (XtDisplay (w), w->xchrom.colorPixmap, w->xchrom.wdwPixmap, X w->xchrom.colors[BACKCOLOR], w->xchrom.offset, w->xchrom.offset, X w->xchrom.squareSize, w->xchrom.squareSize, X w->xchrom.startOffset, w->xchrom.startOffset); X /* X * Calculate current position of slice mask X */ X if (lTime) { X int min = lTime->tm_min + w->xchrom.minOffset; X int hour = (lTime->tm_hour + w->xchrom.hourOffset) % NUMFIELDS; X if (w->xchrom.savedHour != hour || w->xchrom.savedMin != min) { X w->xchrom.slices[SLICEMASK].angle1 = X (sliceAngles[hour] + SLICEANGLE) * XARCMAGIC; X /* X * Display every minute. (0.5 degrees per minute) X */ X w->xchrom.slices[SLICEMASK].angle1 -= (min) * (int)(XARCMAGIC / 2); X w->xchrom.savedHour = hour; X w->xchrom.savedMin = min; X } X } X /* X * Draw slice mask. X */ X XFillArcs (XtDisplay (w), w->xchrom.wdwPixmap, w->xchrom.colors[BACKCOLOR], X &w->xchrom.slices[SLICEMASK], 1); X /* X * Finally, show the result. X */ X XCopyArea (XtDisplay (w), w->xchrom.wdwPixmap, XtWindow (w), X w->xchrom.colors[BACKCOLOR], 0, 0, w->core.width, X w->core.height, 0, 0); X XFlush (XtDisplay (w)); } X static void Timeout (w, id) X XchromWidget w; X XtIntervalId *id; { X ShowTime (w); X w->xchrom.intervalId = XtAddTimeOut (60000, Timeout, w); } X /* ARGSUSED */ static Boolean SetValues (current, request, new) X XchromWidget current, request, new; { X Boolean redraw = False; X int i; X if (new->xchrom.foreground != current->xchrom.foreground X || new->core.background_pixel != current->core.background_pixel) { X XtReleaseGC (current, current->xchrom.colors[BACKCOLOR]); X GetGC (new); X redraw = True; X } X for (i = 0; i < NUMFIELDS; ++i) { X if (new->xchrom.color[i] != current->xchrom.color[i]) { X printf ("color %d changed\n", i); X XtReleaseGC (current, current->xchrom.colors[i]); X GetColorGC (new, i); X redraw = True; X } X } X if (redraw) { X Resize (new); /* pixmaps need to be redrawn */ X } X return redraw; } SHAR_EOF chmod 0644 Xchrom.c || echo 'restore of Xchrom.c failed' Wc_c="`wc -c < 'Xchrom.c'`" test 12033 -eq "$Wc_c" || echo 'Xchrom.c: original size 12033, current size' "$Wc_c" fi # ============= xchrom.c ============== if test -f 'xchrom.c' -a X"$1" != X"-c"; then echo 'x - skipping xchrom.c (File already exists)' else echo 'x - extracting xchrom.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'xchrom.c' && /* X * xchrom.c - program which uses the Xchrom widget. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Tue Nov 6 10:58:40 1990 by olafh (Olaf Heimburger) on GECKO X */ #include <stdio.h> #include <X11/Intrinsic.h> #include <X11/Shell.h> #include "Xchrom.h" #include "xchrom.xbm" #include "xchrom_mask.xbm" #include "patchlevel.h" X #ifdef ICCCM_COMP #include <X11/Xmu/Atoms.h> #endif X #define ever (;;) #define NAME "CHROMACHRON" X static char *version = "version 1"; X static XrmOptionDescRec opTable[] = { X {"-startoffset", ".Xchrom.startOffset", XrmoptionSepArg, (caddr_t)NULL}, X {"-maskoffset", ".Xchrom.maskOffset", XrmoptionSepArg, (caddr_t)NULL}, X {"-timeoffset", ".Xchrom.timeOffset", XrmoptionSepArg, (caddr_t)NULL}, }; X main (argc, argv) X int argc; X char *argv[]; { X Widget topLevel, clockW; X Arg args[2]; X Pixmap iconPixmap = None, iconMaskPixmap = None; X char *defTitle = NULL, *defIconName = NULL; X int i; #ifdef ICCCM_COMP X Atom wmDeleteWindow; X XEvent event; #endif X X topLevel = XtInitialize (argv[0], "XChrom", opTable, XtNumber (opTable), X &argc, argv); X for (i = 1; i < argc; ++i) { X if (strcmp (argv[i], "-v") == 0) { X printf ("%s, %s.%d \n", argv[0], version, PATCHLEVEL); X } X } X /* X * check title and icon name and set default name, if necessary X */ X XtSetArg (args[0], XtNtitle, &defTitle); X XtSetArg (args[1], XtNiconName, &defIconName); X XtGetValues (topLevel, args, XtNumber (args)); X if (strcmp (argv[0], defTitle) == 0) { X XtSetArg (args[0], XtNtitle, NAME); X XtSetValues (topLevel, &args[0], 1); X } X if (strcmp (argv[0], defIconName) == 0) { X XtSetArg (args[0], XtNiconName, NAME); X XtSetValues (topLevel, &args[0], 1); X } X /* X * set minimum width and height X */ X XtSetArg (args[0], XtNminWidth, MINWIDTH); X XtSetArg (args[1], XtNminHeight, MINHEIGHT); X XtSetValues (topLevel, args, XtNumber (args)); X clockW = XtCreateManagedWidget (argv[0], xchromWidgetClass, topLevel, X NULL, 0); X /* X * set the icon and icon mask bits X */ X XtSetArg (args[0], XtNiconPixmap, &iconPixmap); X XtSetArg (args[1], XtNiconMask, &iconMaskPixmap); X XtGetValues (topLevel, args, XtNumber (args)); X if (iconPixmap == None) { X args[0].value = X (XtArgVal) XCreateBitmapFromData (XtDisplay (topLevel), X (XtScreen (topLevel))->root, X xchrom_bits, xchrom_width, X xchrom_height); X XtSetValues (topLevel, &args[0], 1); X } X if (iconMaskPixmap == None) { X args[1].value = X (XtArgVal) XCreateBitmapFromData (XtDisplay (topLevel), X (XtScreen (topLevel))->root, X xchrom_mask_bits, X xchrom_mask_width, X xchrom_mask_height); X XtSetValues (topLevel, &args[1], 1); X } X XtRealizeWidget (topLevel); #ifdef ICCCM_COMP X /* X * for ICCCM compatibilty X */ X wmDeleteWindow = X XmuInternAtom (XtDisplay (topLevel), XmuMakeAtom ("WM_DELETE_WINDOW")); X (void) XSetWMProtocols (XtDisplay (topLevel), XtWindow (topLevel), X &wmDeleteWindow, 1); X for ever { X XtNextEvent (&event); X if (event.type == ClientMessage X && event.xclient.data.l[0] == wmDeleteWindow) { X XtDestroyWidget (topLevel); X exit(1); X } else { X XtDispatchEvent (&event); X } X } #else X XtMainLoop (); #endif } SHAR_EOF chmod 0644 xchrom.c || echo 'restore of xchrom.c failed' Wc_c="`wc -c < 'xchrom.c'`" test 3344 -eq "$Wc_c" || echo 'xchrom.c: original size 3344, current size' "$Wc_c" fi exit 0 dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.