olafh%berthold.UUCP%TUB.BITNET@mitvma.mit.edu (Olaf Heimburger) (10/30/90)
Submitted-by: olafh%berthold.UUCP%TUB.BITNET@mitvma.mit.edu (Olaf Heimburger) Posting-number: Volume 10, Issue 32 Archive-name: xchrom/part01 This xchrom, version 1, patchlevel 4. 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. The use ICCCM-compliant window managers is now supported. There is an -D flag in the Makefile.std and Imakefile. For further information see these files. To compile, just run make and watch it go. There is a Makefile.std for those who don't like, have or, understand imake. Copyright (c) 1990, Olaf Heimburger. Permission to use and copy. Enjoy! * 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 ===============================> CUT HERE <==================================== #!/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 10/29/1990 12:57 UTC by olafh@GECKO # Source directory /usr2/BS/olafh/src/Xchrom # # existing files will NOT be overwritten unless -c is specified # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1156 -rw-r--r-- README # 290 -rw-r--r-- Imakefile # 857 -rw-r--r-- Makefile.std # 3477 -rw-r--r-- xchrom.man # 2457 -rw-r--r-- Xchrom.h # 998 -rw-r--r-- XchromP.h # 21 -rw-r--r-- patchlevel.h # 2270 -rw-r--r-- xchrom.xbm # 2285 -rw-r--r-- xchrom_mask.xbm # 11252 -rw-r--r-- Xchrom.c # 2522 -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 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 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 1156 -eq "$Wc_c" || echo 'README: original size 1156, 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) /**/# CFLAGS= -DICCCM_COMP LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) LDLIBS= -lm 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 290 -eq "$Wc_c" || echo 'Imakefile: original size 290, 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: Mon Oct 22 14:35:57 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 shar: X shar $(SHARFLAGS) README Imakefile Makefile.std xchrom.man \ X $(HFILES) $(SRCS) > xchrom.shar X tar: X tar cvf - Imakefile README Makefile.std xchrom.man $(HFILES) $(SRCS) | \ X compress > xchrom.tar.Z 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 857 -eq "$Wc_c" || echo 'Makefile.std: original size 857, 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 [-\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 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 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 I Xchrom believes the system clock. 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> fi SHAR_EOF chmod 0644 xchrom.man || echo 'restore of xchrom.man failed' Wc_c="`wc -c < 'xchrom.man'`" test 3477 -eq "$Wc_c" || echo 'xchrom.man: original size 3477, 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.c -- a Chrom-A-Chron clock widget. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Mon Oct 22 14:38:29 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 + (STARTCORNER * 2) X #ifndef XtNtitle #define XtNtitle "title" #endif X #ifndef XtNiconName #define XtNiconName "iconName" #endif X #ifndef XtDefaultForeground #define XtDefaultForeground "Black" #endif X #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 2457 -eq "$Wc_c" || echo 'Xchrom.h: original size 2457, 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 * Xchrom.c -- a Chrom-A-Chron clock widget. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Fri Aug 24 08:36:25 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 /* 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; 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 998 -eq "$Wc_c" || echo 'XchromP.h: original size 998, 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 4 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 Chrom-A-Chron clock widget. X * Copyright (c) Olaf Heimburger 1990 X * Last edited: Mon Oct 22 14:37:33 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; 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 $ 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 = STARTCORNER + MASKOFFSET; 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) - (STARTCORNER * 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 - (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 *l_time = 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, STARTCORNER, X STARTCORNER); X /* X * Calculate current position of slice mask X */ X if (l_time) $ X int Min = l_time->tm_min; X int Hour = l_time->tm_hour % 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 11252 -eq "$Wc_c" || echo 'Xchrom.c: original size 11252, 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: Wed Oct 24 12:10:00 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 = "xchrom, version 1"; X main(argc, argv) X int argc; X char *argv[]; $ X Widget toplevel, clock_w; X Arg args[4]; X Pixmap icon_pixmap = None; #ifdef ICCCM_COMP X Atom wm_delete_window; X XEvent event; #endif X X if (argc != 1) $ X printf ("%s Patchlevel: %s \n", Version, PATCHLEVEL); X X toplevel = XtInitialize (argv[0], "XChrom", NULL, 0, &argc, argv); X XtSetArg (args[0], XtNtitle, NAME); X XtSetArg (args[1], XtNiconName, NAME); X XtSetArg (args[2], XtNminWidth, MINWIDTH); X XtSetArg (args[3], XtNminHeight, MINHEIGHT); X XtSetValues (toplevel, args, XtNumber (args)); X clock_w = XtCreateManagedWidget (argv[0], xchromWidgetClass, toplevel, X NULL, 0); X /* X * set the icon bits X */ X XtSetArg(args[0], XtNiconPixmap, &icon_pixmap); X XtGetValues(toplevel, &args[0], 1); X if (icon_pixmap == 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 /* X * set the icon mask bits X */ X XtSetArg (args[0], XtNiconMask, &icon_pixmap); X XtGetValues (toplevel, &args[0], 1); X if (icon_pixmap == None) $ X args[0].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[0], 1); X X XtRealizeWidget (toplevel); #ifdef ICCCM_COMP X /* X * for ICCCM compatibilty X */ X wm_delete_window = X XmuInternAtom (XtDisplay (toplevel), XmuMakeAtom ("WM_DELETE_WINDOW")); X (void) XSetWMProtocols (XtDisplay (toplevel), XtWindow (toplevel), X &wm_delete_window, 1); X for ever $ X XtNextEvent (&event); X if (event.type == ClientMessage X && event.xclient.data.l[0] == wm_delete_window) $ 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 2522 -eq "$Wc_c" || echo 'xchrom.c: original size 2522, 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.