bzs%bu-cs.bu.edu@buita.bu.edu (Barry Shein) (04/02/88)
Or is that ex-mac? -Barry Shein, Boston University #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: README Makefile apple main.c new.c init.c utils.c prefs.c # callbacks.c TopLevelCallBacks.c dtop.h structs.h UserCallBacks.h # Copyright.h # Wrapped by bzs@buit4 on Fri Apr 1 22:24:00 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(430 characters\) sed "s/^X//" >README <<'END_OF_README' X XTHIS PROGRAM IS AN APRIL FOOL'S JOKE AND IS INTENDED FOR NO OTHER XPURPOSE! X XIt was written for X11R2 on a Sun3/160 running SunOS 3.4, you should Xonly have to type 'make'. X XIf you have troubles with the fonts see dtop.h and edit the various X#define's for the fonts. X XI tried very hard to avoid portability problems, particularly things Xlike non-standard fonts, cursors, colors etc but such things are Xunavoidable. X X -Barry Shein X END_OF_README if test 430 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(619 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' X# X# See Copyright.h for copyright notice X# XCFLAGS=-O XLDFLAGS= XLIBES=-lX11 XCC=cc X XSRCS=main.c new.c init.c utils.c prefs.c callbacks.c TopLevelCallBacks.c XOBJS=main.o new.o init.o utils.o prefs.o callbacks.o TopLevelCallBacks.o XHDRS=dtop.h structs.h UserCallBacks.h Copyright.h XOTHER=README Makefile apple X Xdtop: ${OBJS} X ${CC} ${LDFLAGS} -o dtop ${OBJS} ${LIBES} Xshar: X shar ${OTHER} ${SRCS} ${HDRS} > dtop.shar X Xmain.o: main.c ${HDRS} Xnew.o: new.c ${HDRS} Xinit.o: init.c ${HDRS} Xutils.o: utils.c ${HDRS} Xprefs.o: prefs.c ${HDRS} Xcallbacks.o: callbacks.c ${HDRS} XTopLevelCallBacks.o: TopLevelCallBacks.c ${HDRS} X END_OF_Makefile if test 619 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f apple -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"apple\" else echo shar: Extracting \"apple\" \(278 characters\) sed "s/^X//" >apple <<'END_OF_apple' X#define apple_width 16 X#define apple_height 16 Xstatic char apple_bits[] = { X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0x02, X 0x60, 0x0d, 0xf0, 0x1f, 0xc0, 0x07, 0xc0, 0x07, 0xf0, 0x1f, 0xf0, 0x1f, X 0xe0, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00}; END_OF_apple if test 278 -ne `wc -c <apple`; then echo shar: \"apple\" unpacked with wrong size! fi # end of overwriting check fi if test -f main.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"main.c\" else echo shar: Extracting \"main.c\" \(2500 characters\) sed "s/^X//" >main.c <<'END_OF_main.c' X#include "dtop.h" X#include "Copyright.h" X Xmain(argc,argv) int argc; char **argv; X{ X XAnyEvent event; X CALLBACK *p; X X Init(); X TopFrame = NewFrame(DefParent, X 0,0, X DisplayHeight(DefDisplay,DefScreen), X DisplayWidth(DefDisplay,DefScreen), X NewMenuBar( X NewMenu("*****", X NewMenuItem(" About the Finder...",'\0',AboutFinder), X NewMenuItem(" Chooser",'\0',DefUserCallBack), X NewMenuItem(" Control Panel",'\0',DefUserCallBack), X NewMenuItem(" Find File",'\0',DefUserCallBack), X NewMenuItem(" Key Caps",'\0',DefUserCallBack), X NULL), X NewMenu("File", X NewMenuItem(" New Folder",'N',DefUserCallBack), X NewMenuItem(" Open",'O',DefUserCallBack), X NewMenuItem(" Print",'\0',DefUserCallBack), X NewMenuItem(" Close",'W',DefUserCallBack), X NewMenuItem(" Get Info",'I',DefUserCallBack), X NewMenuItem(" Duplicate",'D',DefUserCallBack), X NewMenuItem(" Put Away",'\0',DefUserCallBack), X NewMenuItem(" Page Setup...",'\0',DefUserCallBack), X NewMenuItem(" Print Catalog...",'\0',DefUserCallBack), X NewMenuItem(" Eject",'E',DefUserCallBack), X NULL), X NewMenu("Edit", X NewMenuItem(" Undo",'Z',DefUserCallBack), X NewMenuItem(" Cut",'K',DefUserCallBack), X NewMenuItem(" Copy",'C',DefUserCallBack), X NewMenuItem(" Paste",'P',DefUserCallBack), X NewMenuItem(" Clear",'\0',DefUserCallBack), X NewMenuItem(" Select All",'A',DefUserCallBack), X NewMenuItem(" Show Clipboard",'\0',DefUserCallBack), X NULL), X NewMenu("View", X NewMenuItem(" by Small Icon",'\0',DefUserCallBack), X NewMenuItem(" by Icon",'\0',DefUserCallBack), X NewMenuItem(" by Name",'\0',DefUserCallBack), X NewMenuItem(" by Date",'\0',DefUserCallBack), X NewMenuItem(" by Size",'\0',DefUserCallBack), X NewMenuItem(" by Kind",'\0',DefUserCallBack), X NULL), X NewMenu("Special", X NewMenuItem(" Clean Up Window",'\0',DefUserCallBack), X NewMenuItem(" Empty Trash",'\0',DefUserCallBack), X NewMenuItem(" Erase Disk",'\0',DefUserCallBack), X NewMenuItem(" Set Startup...",'\0',DefUserCallBack), X NewMenuItem(" Restart",'\0',DefUserCallBack), X NewMenuItem(" Shutdown",'\0',ShutDown), X NULL), X NULL)); X InitFrame(TopFrame); X while(1) { X XNextEvent(DefDisplay,&event); X if(XFindContext(event.display,event.window,NULL,(caddr_t *)&p) X == XCSUCCESS) X if((p->CallBack)(&event,p) < 0) X break; X } X exit(0); X} END_OF_main.c if test 2500 -ne `wc -c <main.c`; then echo shar: \"main.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f new.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"new.c\" else echo shar: Extracting \"new.c\" \(7102 characters\) sed "s/^X//" >new.c <<'END_OF_new.c' X#include "dtop.h" X#include "Copyright.h" X X/* X * The various failures for no memory need to be gone over with X * a fine toothcomb. The basic idea is we always goto a local label X * MemFree: and that frees up anything we allocated before the failure X * and then return(NULL). The mfree() and strfree() utils check to see X * if they've been passed a NULL pointer and if so do nothing so you X * don't have to add checks for that. X * X * What we really need are free routines for each object, I'm sure X * if a memory failure occurred there would be a lot of leakage X * but hey, enough is enough for a damn joke! X */ X XSTRING * XNewString(cp) char *cp; X{ X STRING *sp; X X if((sp = (STRING *)calloc(1,sizeof(STRING))) == NULL) X goto MemErr; X if(cp == NULL) X return(sp); X sp->len = strlen(cp); X if((sp->str = (char *)malloc(sp->len+1)) == NULL) X goto MemErr; X strcpy(sp->str,cp); X return(sp); X MemErr: X mfree(sp->str); X mfree(sp); X return(NULL); X} X XWINDOW * XNewWindow() X{ X WINDOW *wp; X X if((wp = (WINDOW *)calloc(1,sizeof(*wp))) == NULL) X return(NULL); X wp->dpy = DefDisplay; X wp->screen = DefScreen; X wp->parent = DefParent; X wp->depth = DefDepth; X wp->bwidth = DefBorderWidth; X wp->class = DefClass; X wp->vis = DefVisual; X wp->vmask = DefVmask; X wp->xswa = &DefXswa; X return(wp); X} X XMENUBAR * XNewMenuBarV(mp,n) MENU **mp; int n; X{ X MENUBAR *bp; X register MENU **p; X X if((bp = (MENUBAR *)calloc(1,sizeof(MENUBAR))) == NULL) X goto MemErr; X if((bp->items = (MENU **)malloc(n * sizeof(MENU *))) == NULL) X goto MemErr; X if((bp->wp = (WINDOW *)NewWindow()) == NULL) X goto MemErr; X bp->n = n; X p = bp->items; X while(n--) X *p++ = *mp++; X return(bp); X MemErr: X mfree(bp->wp); X mfree(bp->items); X mfree(bp); X return(NULL); X} X XMENUBAR * XNewMenuBar(va_alist) va_dcl X{ X MENU *menuv[MAXMENU]; X int n; X va_list ap; X X va_start(ap); X for(n=0; (n < MAXMENU) && ((menuv[n] = va_arg(ap,MENU *)) != NULL);n++) X ; X va_end(ap); X return(NewMenuBarV(menuv,n)); X} X XFRAME * XNewFrame(parent,x,y,h,w,mp) Window parent; int x,y,h,w; MENUBAR *mp; X{ X FRAME *fp = NULL; X WINDOW *wp = NULL; X X if((fp = (FRAME *)calloc(1,sizeof(*fp))) == NULL) X goto MemErr; X if((fp->frame = NewWindow()) == NULL) X goto MemErr; X if((fp->dtop = NewWindow()) == NULL) X goto MemErr; X wp = fp->frame; X wp->x = x; X wp->y = y; X wp->ht = h; X wp->wd = w; X X fp->menubar = mp; X wp = fp->menubar->wp; X /* Remember, these will be relative to the parent frame */ X wp->x = 0; X wp->y = 0; X wp->ht = (MenuBarFont->max_bounds.ascent+MenuBarFont->max_bounds.descent)*2; X wp->wd = fp->frame->wd; X X wp = fp->dtop; X wp->x = 0; X wp->y = fp->menubar->wp->ht + 2*(fp->menubar->wp->bwidth); X wp->ht = fp->frame->ht - wp->y - 2*(fp->menubar->wp->bwidth); X wp->wd = w; X wp->xswa = (XSetWindowAttributes *) calloc(1,sizeof(XSetWindowAttributes)); X bcopy(DefXswa,wp->xswa,sizeof(XSetWindowAttributes)); X wp->vmask = CWBackPixmap|CWBorderPixel; X X return(fp); X MemErr: X mfree(fp->frame); X mfree(fp); X mfree(fp->dtop); X return(NULL); X} X XMENUITEM * XNewMenuItem(title,key,function) char *title, key; int (*function)(); X{ X MENUITEM *mp; X int i; X X if((mp = (MENUITEM *)calloc(1,sizeof(*mp))) == NULL) X goto MemErr; X if((mp->title = NewString(title)) == NULL) X goto MemErr; X if((mp->wp = NewWindow()) == NULL) X goto MemErr; X mp->key = key; X mp->CallBack = DefCMenuItem; X mp->UserCallBack = function; X return(mp); X MemErr: X mfree(mp->title->str); X mfree(mp->wp); X mfree(mp); X return(NULL); X} X X XMENU * XNewMenuV(title,menuv,n) char *title; MENUITEM **menuv; int n; X{ X MENUITEM **mip; X MENU *mp = NULL; X X if((mp = (MENU *)malloc(sizeof(*mp))) == NULL) X goto MemErr; X if((mp->items = (MENUITEM **)malloc(sizeof(MENUITEM *) * n)) == NULL) X goto MemErr; X if((mp->wp = NewWindow()) == NULL) X goto MemErr; X if((mp->mw = NewWindow()) == NULL) X goto MemErr; X mp->n = n; X X if((mp->title = NewString(title)) == NULL) X goto MemErr; X mip = mp->items; X while(n--) X *mip++ = *menuv++; X return(mp); X MemErr: X strfree(mp->title); X mfree(mp->mw); X mfree(mp->wp); X mfree(mp->items); X mfree(mp); X} XMENU * XNewMenu(va_alist) va_dcl X{ X char *title; X MENUITEM *menuv[MAXMENU]; X int n; X va_list ap; X X va_start(ap); X title = va_arg(ap,char *); X for(n=0; (n < MAXMENU) && ((menuv[n] = va_arg(ap,MENUITEM *)) != NULL);n++) X ; X va_end(ap); X return(NewMenuV(title,menuv,n)); X} X XMESSAGEBAR * XNewMessageBar(left,center,right) char *left, *center, *right; X{ X MESSAGEBAR *mp; X X if((mp = (MESSAGEBAR *)calloc(1,sizeof(MESSAGEBAR))) == NULL) X return(NULL); X if((mp->wp = NewWindow()) == NULL) X goto MemErr; X if((mp->left = NewString(left)) == NULL) X goto MemErr; X if((mp->center = NewString(center)) == NULL) X goto MemErr; X if((mp->right = NewString(right)) == NULL) X goto MemErr; X return(mp); X MemErr: X strfree(mp->left); X strfree(mp->center); X strfree(mp->right); X mfree(mp->wp); X mfree(mp); X return(NULL); X} X XTITLEBAR * XNewTitleBar(title) char *title; X{ X TITLEBAR *tp; X X if((tp = (TITLEBAR *)calloc(1,sizeof(TITLEBAR))) == NULL) X return(NULL); X if((tp->wp = NewWindow()) == NULL) X goto MemErr; X if((tp->text = NewString(title)) == NULL) X goto MemErr; X if((tp->close = NewWindow()) == NULL) X goto MemErr; X if((tp->expand = NewWindow()) == NULL) X goto MemErr; X return(tp); X MemErr: X mfree(tp->wp); X strfree(tp->text); X mfree(tp->close); X mfree(tp->expand); X return(NULL); X} X XSCROLLBAR * XNewScrollBar() X{ X SCROLLBAR *sp; X X if((sp = (SCROLLBAR *)calloc(1,sizeof(SCROLLBAR))) == NULL) X return(NULL); X if((sp->wp = NewWindow()) == NULL) X goto MemErr; X if((sp->UpArrow = NewWindow()) == NULL) X goto MemErr; X if((sp->DnArrow = NewWindow()) == NULL) X goto MemErr; X if((sp->Thumb = NewWindow()) == NULL) X goto MemErr; X if((sp->Bar = NewWindow()) == NULL) X goto MemErr; X return(sp); X MemErr: X mfree(sp->UpArrow); X mfree(sp->DnArrow); X mfree(sp->Thumb); X mfree(sp->Bar); X mfree(sp); X return(NULL); X} X XTEXTWINDOW * XNewTextWindow() X{ X TEXTWINDOW *tp; X X if((tp = (TEXTWINDOW *)calloc(1,sizeof(TEXTWINDOW))) == NULL) X return(NULL); X if((tp->wp = NewWindow()) == NULL) X return(NULL); X return(tp); X} X XPANE * XNewPane(title,x,y,width,height,msg,hscrollp,vscrollp) Xchar *title; Xint x,y,width,height; XMESSAGEBAR *msg; Xint hscrollp,vscrollp; X{ X PANE *pp; X WINDOW *wp; X X if((pp = (PANE *)calloc(1,sizeof(PANE))) == NULL) X return(NULL); X if((pp->wp = NewWindow()) == NULL) X goto MemErr; X if(title != NULL) X if((pp->title = NewTitleBar(title)) == NULL) X goto MemErr; X pp->message = msg; /* could be NULL but that's ok */ X if(hscrollp) X if((pp->hscroll = NewScrollBar()) == NULL) X goto MemErr; X if(vscrollp) X if((pp->vscroll = NewScrollBar()) == NULL) X goto MemErr; X if((pp->text = NewTextWindow()) == NULL) X goto MemErr; X X wp = pp->wp; X wp->x = x; X wp->y = y; X wp->wd = width; X wp->ht = height; X X return(pp); X MemErr: X mfree(pp->wp); X mfree(pp->title); X mfree(pp->hscroll); X mfree(pp->vscroll); X mfree(pp->text); X return(NULL); X} X X END_OF_new.c if test 7102 -ne `wc -c <new.c`; then echo shar: \"new.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f init.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"init.c\" else echo shar: Extracting \"init.c\" \(9355 characters\) sed "s/^X//" >init.c <<'END_OF_init.c' X#include "dtop.h" X#include "Copyright.h" X X#include <X11/bitmaps/gray> X XInit() X{ X char *cp; X XGCValues gcv; X unsigned long gvmask; X X if((DefDisplay = XOpenDisplay(NULL)) == NULL) { X fprintf(stderr,"No X?\n"); X exit(1); X } X DefParent = DefaultRootWindow(DefDisplay); X DefScreen = DefaultScreen(DefDisplay); X DefVisual = DefaultVisual(DefDisplay,DefScreen); X DefFg = BlackPixel(DefDisplay,DefScreen); X DefBg = WhitePixel(DefDisplay,DefScreen); X DefBorderWidth = DEFBORDERWIDTH; X DefDepth = DefaultDepth(DefDisplay,DefScreen); X DefClass = DEFCLASS; X X GetPreferences(); X X cursor = XCreateFontCursor(DefDisplay,XC_left_ptr); X X if((cp = LookupPreference("BorderWidth")) != NULL) X DefBorderWidth = atoi(cp); X X if((cp = LookupPreference("ReverseVideo")) != NULL) X if((*cp == 't') || (*cp == 'T')) { X DefFg = WhitePixel(DefDisplay,DefScreen); X DefBg = BlackPixel(DefDisplay,DefScreen); X } X DefXswa.background_pixel = DefBg; X DefXswa.border_pixel = DefFg; X DefVmask = DEFVMASK; X X if((MenuBarFontName = LookupPreference("MenuBarFont")) == NULL) X MenuBarFontName = DEFMENUBARFONT; X if((MenuFontName = LookupPreference("MenuFont")) == NULL) X MenuFontName = DEFMENUFONT; X if((TitleFontName = LookupPreference("TitleFont")) == NULL) X TitleFontName = DEFTITLEFONT; X if((TextFontName = LookupPreference("TextFont")) == NULL) X TextFontName = DEFTITLEFONT; X if((IconFontName = LookupPreference("IconFont")) == NULL) X IconFontName = DEFICONFONT; X if((DefFontName = LookupPreference("DefaultFont")) == NULL) X DefFontName = DEFFONT; X X if((DefFont = XLoadQueryFont(DefDisplay,DefFontName)) == NULL) { X DefFontName = DEFFONT; X DefFont = XLoadQueryFont(DefDisplay,DefFontName); X } X if((MenuBarFont = XLoadQueryFont(DefDisplay,MenuBarFontName)) == NULL) X if((MenuBarFont = DefFont) == NULL) X goto fontlose; X if((MenuFont = XLoadQueryFont(DefDisplay,MenuFontName)) == NULL) X if((MenuFont = DefFont) == NULL) X goto fontlose; X if((TitleFont = XLoadQueryFont(DefDisplay,TitleFontName)) == NULL) X goto fontlose; X if((TextFont = XLoadQueryFont(DefDisplay,TextFontName)) == NULL) X goto fontlose; X if((IconFont = XLoadQueryFont(DefDisplay,IconFontName)) == NULL) X goto fontlose; X X gvmask = GCFunction|GCForeground|GCBackground|GCFont|GCGraphicsExposures; X gcv.function = GXcopy; X gcv.foreground = DefFg; X gcv.background = DefBg; X gcv.graphics_exposures = False; X gcv.font = MenuBarFont->fid; X X MenuBarGC = XCreateGC(DefDisplay,DefParent,gvmask,&gcv); X gcv.function = GXinvert; X IMenuBarGC = XCreateGC(DefDisplay,DefParent,gvmask,&gcv); X X gcv.function = GXcopy; X gcv.font = MenuFont->fid; X MenuGC = XCreateGC(DefDisplay,DefParent,gvmask,&gcv); X gcv.function = GXinvert; X IMenuGC = XCreateGC(DefDisplay,DefParent,gvmask,&gcv); X X X /* Callbacks */ X CFrame = DefCFrame; X CMenuBar = DefCMenuBar; X CMenuItem = DefCMenuItem; X CTitleBar = DefCTitleBar; X CTextWindow = DefCTextWindow; X X return; X X fontlose: X fprintf(stderr,"Sorry, tried real hard to open some font but couldn't\n"); X exit(1); X X} X XFRAME * XInitFrame(fp) FRAME *fp; X{ X WINDOW *wp; X int i; X MENU **mp; X int CMenuB(); X XSizeHints xsize; X X wp = fp->frame; X wp->w = XCreateWindow(wp->dpy, X wp->parent, X wp->x,wp->y, X wp->wd,wp->ht, X wp->bwidth,wp->depth, X wp->class, X wp->vis,wp->vmask, X wp->xswa); X X bzero(&xsize,sizeof(xsize)); X xsize.flags = USPosition|USSize; X xsize.x = wp->x; X xsize.y = wp->y; X xsize.width = wp->wd; X xsize.height = wp->ht; X XSetNormalHints(wp->dpy,wp->w,&xsize); X X XDefineCursor(wp->dpy,wp->w,cursor); X X XChangeProperty(wp->dpy,wp->w,XA_WM_NAME,XA_STRING,8, X PropModeReplace,"Apple Fool's!",strlen("Apple Fool's!")); X fp->CallBack = CFrame; X XSaveContext(wp->dpy,wp->w,NULL,(caddr_t)fp); X XSelectInput(wp->dpy,wp->w,LeaveWindowMask|ButtonReleaseMask); X X wp = fp->menubar->wp; X wp->w = XCreateWindow(wp->dpy, X wp->parent = fp->frame->w, X wp->x,wp->y, X wp->wd,wp->ht, X wp->bwidth,wp->depth, X wp->class, X wp->vis,wp->vmask, X wp->xswa); X X if(GrayPixmap == NULL) X GrayPixmap = XCreateBitmapFromData(wp->dpy,wp->w, X gray_bits,gray_width,gray_height); X X wp = fp->dtop; X wp->xswa->background_pixmap = GrayPixmap; X wp->w = XCreateWindow(wp->dpy, X wp->parent = fp->frame->w, X wp->x,wp->y, X wp->wd,wp->ht, X wp->bwidth,wp->depth, X wp->class, X wp->vis,wp->vmask, X wp->xswa); X X InitMenuBar(fp); X XMapWindow(fp->frame->dpy,fp->frame->w); X XMapWindow(fp->dtop->dpy,fp->dtop->w); X XMapWindow(fp->menubar->wp->dpy,fp->menubar->wp->w); X for(i=0,mp=fp->menubar->items; i < fp->menubar->n;i++,mp++) X XMapWindow((*mp)->wp->dpy,(*mp)->wp->w); X return(fp); X} X XInitMenuBar(fp) FRAME *fp; X{ X MENUBAR *mp = fp->menubar; X MENU **menup; X WINDOW *wp; X int i; X int last; X X for(i=0,last=mp->wp->ht/2,menup = mp->items; i < mp->n;i++,menup++) { X wp = (*menup)->wp; X wp->x = last; X wp->y = 0; X wp->wd = 2*XTextWidth(MenuBarFont,(*menup)->title->str, X (*menup)->title->len); X wp->ht = mp->wp->ht; X last += wp->wd; X wp->w = XCreateWindow(wp->dpy, X wp->parent = mp->wp->w, X wp->x,wp->y, X wp->wd,wp->ht, X wp->bwidth = 0,wp->depth, X wp->class, X wp->vis,wp->vmask, X wp->xswa); X X (*menup)->CallBack = CMenuBar; X X XSaveContext(wp->dpy,wp->w,NULL,(caddr_t)*menup); X XSelectInput(wp->dpy,wp->w, X ExposureMask| X ButtonPressMask|ButtonReleaseMask| X EnterWindowMask|LeaveWindowMask); X InitMenu(*menup,fp->frame,wp->x,fp->dtop->y/*wp->ht+wp->bwidth*/); X } X} XInitMenu(mp,pp,x,y) MENU *mp; WINDOW *pp; int x,y; X{ X register MENUITEM **mip; X register int i; X int mx, ht, slop; X register WINDOW *wp; X X ht = 2*(MenuFont->max_bounds.ascent+MenuFont->max_bounds.descent); X X for(i=0,mx=0,mip=mp->items; i < mp->n; i++,mip++) { X if(((*mip)->wp->wd = XTextWidth(MenuFont,(*mip)->title->str, X (*mip)->title->len)) > mx) X mx = (*mip)->wp->wd; X (*mip)->wp->ht = ht; X (*mip)->mp = mp; X } X mx += MenuFont->max_bounds.width; /* a little slop to the right */ X wp = mp->mw; X wp->w = XCreateWindow(wp->dpy, X pp->w, X x,y, X mx,mp->n*ht, X wp->bwidth,wp->depth, X wp->class, X wp->vis,wp->vmask, X wp->xswa); X X for(i=0,mip=mp->items; i < mp->n; i++,mip++) { X wp = (*mip)->wp; X wp->w = XCreateWindow(wp->dpy, X mp->mw->w, X 0,i*ht+wp->bwidth, X wp->wd = mx,ht, X wp->bwidth = 0,wp->depth, X wp->class, X wp->vis,wp->vmask, X wp->xswa); X XSaveContext(wp->dpy,wp->w,NULL,(caddr_t)*mip); X XSelectInput(wp->dpy,wp->w, X ExposureMask| X ButtonPressMask|ButtonReleaseMask| X EnterWindowMask|LeaveWindowMask); X } X} XInitPane(pp,fp) PANE *pp; FRAME *fp; X{ X WINDOW *wp; X X wp = pp->wp; X wp->parent = fp->dtop->w; X wp->w = XCreateWindow(wp->dpy,wp->parent, X wp->x,wp->y, X wp->wd,wp->ht, X wp->bwidth,wp->depth, X wp->class, X wp->vis, X wp->vmask, X wp->xswa); X if(pp->title != NULL) X InitTitleBar(pp->title,pp); X if(pp->message != NULL) X InitMessageBar(pp->message,wp); X if(pp->hscroll != NULL) X InitHscroll(pp->hscroll,wp); X if(pp->vscroll != NULL) X InitVscroll(pp->vscroll,wp); X InitTextWindow(pp); X return; X} XInitTitleBar(tp,Pp) TITLEBAR *tp; PANE *Pp; X{ X WINDOW *wp; X WINDOW *pp; X int ht; X int bx; X X pp = Pp->wp; X wp = tp->wp; X ht = 2*(TitleFont->max_bounds.ascent+TitleFont->max_bounds.descent); X wp->w = XCreateWindow(wp->dpy,pp->w, X wp->x = 0,wp->y = 0, X wp->wd = pp->wd,wp->ht = ht, X wp->bwidth,wp->depth, X wp->class,wp->vis, X wp->vmask,wp->xswa); X Pp->CallBack = CTitleBar; X XSaveContext(wp->dpy,wp->w,NULL,(caddr_t)Pp); X XSelectInput(wp->dpy,wp->w,ExposureMask); X X bx = 2*ht/3; X wp = tp->expand; X wp->w = XCreateWindow(wp->dpy,tp->wp->w, X wp->x = tp->wp->wd - (ht/2+bx),wp->y = (5+ht)/6, X wp->wd = bx,wp->ht = bx, X wp->bwidth,wp->depth, X wp->class,wp->vis, X wp->vmask,wp->xswa); X X wp = tp->close; X wp->w = XCreateWindow(wp->dpy,tp->wp->w, X wp->x = ht/2,wp->y = (5+ht)/6, X wp->wd = bx,wp->ht = bx, X wp->bwidth,wp->depth, X wp->class,wp->vis, X wp->vmask,wp->xswa); X XSaveContext(wp->dpy,wp->w,NULL,(caddr_t)Pp); X XSelectInput(wp->dpy,wp->w, X ButtonPressMask|ButtonReleaseMask| X LeaveWindowMask|EnterWindowMask); X} XInitMessageBar() X{ X} XInitHscroll() X{ X} XInitVscroll() X{ X} XInitTextWindow(pp) PANE *pp; X{ X TEXTWINDOW *tp; X WINDOW *wp, *twp; X XGCValues gcv; X int gvmask; X X tp = pp->text; X wp = tp->wp; X twp = pp->title->wp; X wp->w = XCreateWindow(wp->dpy,pp->wp->w, X 0,twp->ht+2*twp->bwidth, X wp->wd = pp->wp->wd, X wp->ht = pp->wp->ht-(twp->ht+2*twp->bwidth), X wp->bwidth,wp->depth, X wp->class,wp->vis, X wp->vmask,wp->xswa); X tp->font = TextFont; X tp->CallBack = CTextWindow; X gvmask = GCFunction|GCForeground|GCBackground|GCFont|GCGraphicsExposures; X gcv.function = GXcopy; X gcv.foreground = DefFg; X gcv.background = DefBg; X gcv.graphics_exposures = False; X gcv.font = TextFont->fid; X tp->TextGC = XCreateGC(DefDisplay,DefParent,gvmask,&gcv); X XSaveContext(wp->dpy,wp->w,NULL,(caddr_t)tp); X XSelectInput(wp->dpy,wp->w,ExposureMask); X} XTextTextWindow(pp,lpp,n) PANE *pp; register char **lpp; register int n; X{ X TEXTWINDOW *tp; X register char **cpp; X X tp = pp->text; X tp->nlines = n; X cpp = tp->lines = (char **)malloc(n*sizeof(char *)); X for(;n-- > 0;cpp++,lpp++) X *cpp = *lpp; X} END_OF_init.c if test 9355 -ne `wc -c <init.c`; then echo shar: \"init.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f utils.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"utils.c\" else echo shar: Extracting \"utils.c\" \(2671 characters\) sed "s/^X//" >utils.c <<'END_OF_utils.c' X#include "dtop.h" X#include "Copyright.h" X#include <ctype.h> X Xvoid Xmfree(p) char *p; X{ X if(p != NULL) X free(p); X} X Xvoid Xstrfree(p) STRING *p; X{ X if(p != NULL) { X mfree(p->str); X mfree(p); X } X} X Xchar * Xspanwhite(cp) register char *cp; X{ X while(isspace(*cp)) X cp++; X return(cp); X} Xchar * Xbrkwhite(cp) register char *cp; X{ X while(*cp && !isspace(*cp)) X cp++; X return(cp); X} Xchar * XGetString(cp,fp) register char *cp; FILE *fp; X{ X static char str[BUFSIZ]; X char buf[BUFSIZ]; X register char *sp; X X cp++; /* Should be pointing to a double quote */ X sp = str; X *sp = '\0'; X while((sp != &str[BUFSIZ]) && (*cp != '"')) { X if(*cp == '\0') { X if(fgets(buf,BUFSIZ,fp) == NULL) X break; X cp = buf; X continue; X } X if(*cp == '\\') X switch(++cp) { X X case 'n': X *sp++ = '\n'; X break; X case 'r': X *sp++ = '\r'; X break; X case 't': X *sp++ = '\t'; X break; X default: X if(isdigit(*cp)) { X int i; X X i = *cp++ - '\0'; X if(isdigit(*cp)) X i = (i << 3) + (*cp++ - '0'); X if(isdigit(*cp)) X i = (i << 3) + (*cp++ - '0'); X *sp++ = i; X } X else X *sp++ = *cp++; X } X } X *sp = '\0'; X return(str); X} X/* X * Case independant match X */ Xeqstr(s1,s2) register char *s1, *s2; X{ X while((islower(*s1) ? toupper(*s1) : *s1) == X (islower(*s2) ? toupper(*s2) : *s2)) X if(*s1 == '\0') X return(TRUE); X return(FALSE); X} X XInvertWindow(wp,gc) WINDOW *wp; GC gc; X{ X return(XFillRectangle(wp->dpy,wp->w, X gc, X 0,0, X wp->wd,wp->ht)); X} X X/* X * This assumes one display! X */ Xunsigned int XMouseButtons() X{ X Window r,c; X int rx, ry, wx, wy; X unsigned int mask; X X mask = 0; X XQueryPointer(DefDisplay,DefParent,&r,&c,&rx,&ry,&wx,&wy,&mask); X return(mask); X} X XActivatePane(pp) PANE *pp; X{ X XMapWindow(pp->wp->dpy,pp->wp->w); X XMapSubwindows(pp->wp->dpy,pp->wp->w); X XMapSubwindows(pp->title->wp->dpy,pp->title->wp->w); X} X Xstatic char *EvNames[] = { X "Unknown 0", X "Unknown 1", X "KeyPress", X "KeyRelease", X "ButtonPress", X "ButtonRelease", X "MotionNotify", X "EnterNotify", X "LeaveNotify", X "FocusIn", X "FocusOut", X "KeymapNotify", X "Expose", X "GraphicsExpose", X "NoExpose", X "VisibilityNotify", X "CreateNotify", X "DestroyNotify", X "UnmapNotify", X "MapNotify", X "MapRequest", X "ReparentNotify", X "ConfigureNotify", X "ConfigureRequest", X "GravityNotify", X "ResizeRequest", X "CirculateNotify", X "CirculateRequest", X "PropertyNotify", X "SelectionClear", X "SelectionRequest", X "SelectionNotify", X "ColormapNotify", X "ClientMessage", X "MappingNotify" X}; X Xchar * XEvName(n) int n; X{ X if(n >= LASTEvent) X return("(Event Out of Range)"); X else X return(EvNames[n]); X} X END_OF_utils.c if test 2671 -ne `wc -c <utils.c`; then echo shar: \"utils.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f prefs.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"prefs.c\" else echo shar: Extracting \"prefs.c\" \(1797 characters\) sed "s/^X//" >prefs.c <<'END_OF_prefs.c' X#include "dtop.h" X#include "Copyright.h" X#include <pwd.h> X X/* X * Never tried, total crock X */ Xvoid XGetPreferences() X{ X char *getenv(), *getlogin(); X char *home, *user; X struct passwd *pwd; X FILE *fp; X int i; X char buf[BUFSIZ]; X X if((PrefFile = getenv("DTOPRC")) == NULL) { X if((home = getenv("HOME")) == NULL) { X if((user = getlogin()) == NULL) { X if((pwd = getpwuid(getuid())) == NULL) { X goto lose; X } X } X else if((pwd = getpwent(user)) == NULL) X goto lose; X home = pwd->pw_dir; X } X i = strlen(home); X strcpy(buf,home); X if(buf[i-1] != '/') X strcat(buf,"/"); X strcat(buf,PREFFILE); X if((PrefFile = (char *)malloc(strlen(buf)+1)) == NULL) X return; X strcpy(PrefFile,buf); X } X if((fp = fopen(PrefFile,"r")) == NULL) X return; X ReadPrefFile(fp); X fclose(fp); X return; X lose: X fprintf(stderr,"Who are you?!\n"); X return; X} X Xvoid XReadPrefFile(fp) FILE *fp; X{ X char buf[BUFSIZ]; X register char *bp, *cp; X register struct Preferences *P = Preferences; X X NPreferences = 0; X while(fgets(bp = buf,BUFSIZ,fp) != NULL) { X bp = spanwhite(bp); X if(!*bp || *bp == '#') X continue; X cp = bp; X bp = brkwhite(bp); X *bp++ = '\0'; X if((P->name = (char *)malloc(strlen(cp)+1)) == NULL) X break; X strcpy(P->name,cp); X bp = spanwhite(bp); X cp = bp; X if(*cp == '"') X cp = GetString(cp,fp); X else { X bp = brkwhite(bp); X *bp = '\0'; X } X if((P->value = (char *)malloc(strlen(cp)+1)) == NULL) X break; X strcpy(P->value,cp); X NPreferences++; X P++; X } X} Xchar * XLookupPreference(name) char *name; X{ X register struct Preferences *P = Preferences; X register int i; X X for(i=0; i < NPreferences; i++,P++) X if(eqstr(P->name,name)) X return(P->value); X return(NULL); X} END_OF_prefs.c if test 1797 -ne `wc -c <prefs.c`; then echo shar: \"prefs.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f callbacks.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"callbacks.c\" else echo shar: Extracting \"callbacks.c\" \(5305 characters\) sed "s/^X//" >callbacks.c <<'END_OF_callbacks.c' X#include "dtop.h" X#include "apple" X#include "Copyright.h" X X/* X * You have entered a maze of twisting passages, all different X */ X X#define BUTTONMASK (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) X Xstatic MENU *active; X Xstatic void XKillActiveMenu() X{ X if(active != NULL) { X InvertWindow(active->wp,IMenuGC); X XUnmapSubwindows(active->mw->dpy,active->mw->w); X XUnmapWindow(active->mw->dpy,active->mw->w); X active = NULL; X } X return; X} X XDefCFrame(ep,fp) XAnyEvent *ep; FRAME *fp; X{ X switch(ep->type) { X case LeaveNotify: X case ButtonRelease: X KillActiveMenu(); X break; X default: X break; X } X return(0); X} X XDefCMenuBar(ep,mp) XAnyEvent *ep; MENU *mp; X{ X static Pixmap Apple = NULL; X register WINDOW *wp; X int i; X XEvent event; X X wp = mp->wp; X switch(ep->type) { X X case Expose: X if(strncmp(mp->title->str,"*****",5) == 0) { X if(Apple == NULL) { X Apple = XCreateBitmapFromData(mp->wp->dpy, X mp->wp->w, X apple_bits,apple_width,apple_height); X } X XCopyArea(wp->dpy,Apple,wp->w, X MenuBarGC, X 0,0,apple_width,apple_height, X wp->wd/4,wp->ht/4); X } X else X XDrawString(wp->dpy,wp->w, X MenuBarGC, X wp->wd/4,(3*wp->ht)/4, X mp->title->str,mp->title->len); X break; X X case ButtonRelease: X KillActiveMenu(); X break; X X case ButtonPress: X InvertWindow(wp,IMenuBarGC); X active = mp; X XMapWindow(mp->mw->dpy,mp->mw->w); X XMapSubwindows(mp->mw->dpy,mp->mw->w); X break; X X case LeaveNotify: X XUngrabPointer(wp->dpy,CurrentTime); X break; X X case EnterNotify: X if(MouseButtons() & BUTTONMASK) { X if(active != mp) { X KillActiveMenu(); X InvertWindow(wp,IMenuBarGC); X } X active = mp; X XMapWindow(mp->mw->dpy,mp->mw->w); X XMapSubwindows(mp->mw->dpy,mp->mw->w); X } X XSync(wp->dpy,0); X XCheckTypedWindowEvent(wp->dpy,wp->w,Expose,&event); X break; X X default: X break; X } X return(0); X} XDefCMenuItem(ep,mip) XAnyEvent *ep; MENUITEM *mip; X{ X WINDOW *wp; X int ret; X X wp = mip->wp; X X switch(ep->type) { X X case Expose: X XDrawString(wp->dpy,wp->w, X MenuGC, X 0,(3*wp->ht)/4, X mip->title->str,mip->title->len); X break; X case EnterNotify: X if(MouseButtons() & BUTTONMASK) X InvertWindow(wp,IMenuBarGC); X break; X case LeaveNotify: X if(MouseButtons() & BUTTONMASK) X InvertWindow(wp,IMenuBarGC); X break; X case ButtonRelease: X KillActiveMenu(); X return((mip->UserCallBack)(ep,mip)); X default: X break; X } X return(0); X} XDefUserCallBack(ep,mip) XAnyEvent *ep; MENUITEM *mip; X{ X printf("user: %s\n",mip->title->str); X return(0); X} XDefCTitleBar(ep,pp) XAnyEvent *ep; PANE *pp; X{ X int i,y, incr; X WINDOW *wp; X WINDOW *clp; X TITLEBAR *tp; X XButtonReleasedEvent *eb; X X tp = pp->title; X if(ep->window == tp->close->w) { X clp = tp->close; X switch(ep->type) { X X case ButtonPress: X StarPress(tp->close); X break; X X case ButtonRelease: X eb = (XButtonReleasedEvent *)ep; X if((eb->x < 0) || (eb->x > clp->wd) || (eb->y < 0) || (eb->y > clp->ht)) X XClearWindow(clp->dpy,clp->w); X else { X XUnmapSubwindows(pp->wp->dpy,pp->wp->w); X XUnmapWindow(pp->wp->dpy,pp->wp->w); X } X break; X X case LeaveNotify: X if(MouseButtons() & BUTTONMASK) X XClearWindow(clp->dpy,clp->w); X break; X X case EnterNotify: X if(MouseButtons() & BUTTONMASK) X StarPress(tp->close); X break; X } X } X else { X switch(ep->type) { X X case Expose: X wp = tp->wp; X incr = (2*wp->ht/3)/5; X for(i=0,y=(5+wp->ht)/6; i < 6; y += incr,i++) X XDrawLine(wp->dpy,wp->w,MenuGC,0,y,wp->wd,y); X i = XTextWidth(TitleFont,tp->text->str,tp->text->len); X XClearArea(wp->dpy,wp->w, X (wp->wd/2)-i/2,0, X i,wp->ht, X False); X XDrawString(wp->dpy,wp->w, X MenuBarGC, X (wp->wd/2)-i/2,2*wp->ht/3, X tp->text->str,tp->text->len); X wp = tp->expand; X XDrawLine(wp->dpy,wp->w,MenuGC, X 0,2*wp->ht/3,2*wp->wd/3,2*wp->ht/3); X XDrawLine(wp->dpy,wp->w,MenuGC, X 2*wp->wd/3,0,2*wp->wd/3,2*wp->ht/3); X break; X default: X break; X } X } X return(0); X} X/* X * Should probably be redone w/ one of those batching functions X */ XStarPress(wp) WINDOW *wp; X{ X XDrawLine(wp->dpy,wp->w,MenuGC, X 0,wp->ht/2,wp->wd/3,wp->ht/2); X XDrawLine(wp->dpy,wp->w,MenuGC, X wp->wd/2,0,wp->wd/2,wp->ht/3); X XDrawLine(wp->dpy,wp->w,MenuGC, X (2*wp->wd)/3,wp->ht/2,wp->wd,wp->ht/2); X XDrawLine(wp->dpy,wp->w,MenuGC, X wp->wd/2,(2*wp->ht)/3,wp->wd/2,wp->ht); X X XDrawLine(wp->dpy,wp->w,MenuGC, X wp->wd/6,wp->ht/6,wp->wd/3,wp->ht/3); X XDrawLine(wp->dpy,wp->w,MenuGC, X (5*wp->wd)/6,wp->ht/6,(2*wp->wd)/3,wp->ht/3); X XDrawLine(wp->dpy,wp->w,MenuGC, X (5*wp->wd)/6,(5*wp->ht)/6,(2*wp->wd)/3,(2*wp->ht)/3); X XDrawLine(wp->dpy,wp->w,MenuGC, X wp->wd/6,(5*wp->ht)/6,wp->wd/3,(2*wp->ht)/3); X} X/* X * Should use array of STRINGs in textwindow X */ XDefCTextWindow(ep,tp) XAnyEvent *ep; TEXTWINDOW *tp; X{ X WINDOW *wp; X int ht, y; X register int i; X register char **pp; X X wp = tp->wp; X ht = tp->font->max_bounds.ascent+tp->font->max_bounds.descent; X y = ht; X for(i=0,pp=tp->lines;i < tp->nlines; i++,pp++) { X XDrawString(wp->dpy,wp->w, X tp->TextGC, X 0,y,*pp,strlen(*pp)); X if((y += ht) >= wp->ht) X break; X } X return(0); X} END_OF_callbacks.c if test 5305 -ne `wc -c <callbacks.c`; then echo shar: \"callbacks.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f TopLevelCallBacks.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"TopLevelCallBacks.c\" else echo shar: Extracting \"TopLevelCallBacks.c\" \(662 characters\) sed "s/^X//" >TopLevelCallBacks.c <<'END_OF_TopLevelCallBacks.c' X#include "dtop.h" X#include "Copyright.h" X Xchar *Joke[] = { X "", X " APRIL FOOLS!", X "", X " Now select Shutdown in the 'Special' Menu to quit", X}; X#define NJOKE 4 X XShutDown(ep,mip) XAnyEvent *ep; MENUITEM *mip; X{ X return(-1); /* will cause an exit from top-level */ X} XAboutFinder(ep,mip) XAnyEvent *ep; MENUITEM *mip; X{ X static int init = False; X static PANE *pp; X PANE *NewPane(); X X if(!init) { X pp = NewPane(" The Apple Fool Finder ", X TopFrame->dtop->wd/4,TopFrame->dtop->ht/4, X TopFrame->dtop->wd/2,TopFrame->dtop->ht/2, X NULL,False,False); X InitPane(pp,TopFrame); X TextTextWindow(pp,Joke,NJOKE); X } X ActivatePane(pp); X return(0); X} END_OF_TopLevelCallBacks.c if test 662 -ne `wc -c <TopLevelCallBacks.c`; then echo shar: \"TopLevelCallBacks.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f dtop.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dtop.h\" else echo shar: Extracting \"dtop.h\" \(2355 characters\) sed "s/^X//" >dtop.h <<'END_OF_dtop.h' X#include <stdio.h> X#include <varargs.h> X#include <X11/Xlib.h> X#include <X11/Xatom.h> X#include <X11/Xutil.h> X#include <X11/cursorfont.h> X X#include "Copyright.h" X X#include "structs.h" X XXSetWindowAttributes DefXswa; Xint DefVmask; X#define DEFVMASK CWBackPixel|CWBorderPixel X XCursor cursor; XVisual *DefVisual; XDisplay *DefDisplay; Xint DefScreen; Xint DefFg, DefBg; XWindow DefParent; Xint DefBorderWidth; X#define DEFBORDERWIDTH 1 Xint DefDepth; Xunsigned int DefClass; X#define DEFCLASS InputOutput X XFRAME *TopFrame; X XGC MenuBarGC; XGC IMenuBarGC; XGC MenuGC; XGC IMenuGC; X XXFontStruct *MenuBarFont; Xchar *MenuBarFontName; X#define DEFMENUBARFONT "fg-16" XXFontStruct *MenuFont; Xchar *MenuFontName; X#define DEFMENUFONT "fg-16" XXFontStruct *TitleFont; Xchar *TitleFontName; X#define DEFTITLEFONT "fg-16" XXFontStruct *TextFont; Xchar *TextFontName; X#define DEFTEXTFONT "fg-18" XXFontStruct *IconFont; Xchar *IconFontName; X#define DEFICONFONT "helvetica-medium8" X/* X * In case all else fails X */ XXFontStruct *DefFont; Xchar *DefFontName; X#define DEFFONT "fg-16" X X#define MAXMENU 100 X XSTRING *Newstring(); XWINDOW *NewWindow(); XMENUBAR *NewMenuBarV(), *NewMenuBar(); XFRAME *NewFrame(); XMENUITEM *NewMenuItem(); XMENU *NewMenuV(), *NewMenu(); XMESSAGEBAR *NewMessageBar(); X Xvoid mfree(), strfree(); Xchar *brkwhite(), *spanwhite(), *GetString(); Xchar *EvName(); Xunsigned int MouseButtons(); Xint InvertWindow(); X XFRAME *InitFrame(); X Xchar *PrefFile; X#define PREFFILE ".dtoprc" X#define MAXPREFS 512 X Xstruct Preferences { X char *name; X char *value; X} Preferences[MAXPREFS]; Xint NPreferences; X Xvoid GetPreferences(), ReadPrefFile(); Xchar *LookupPreference(); X X#ifndef TRUE X#define TRUE 1 X#endif X#ifndef FALSE X#define FALSE 0 X#endif X XPixmap GrayPixmap; X X/* Callbacks */ Xint DefCMenuBar(); Xint (*CMenuBar)(); Xint DefCMenuItem(); Xint (*CMenuItem)(); Xint DefCFrame(); Xint (*CFrame)(); Xint DefUserCallBack(); Xint (*CTitleBar)(); Xint DefCTitleBar(); Xint (*CTextWindow)(); Xint DefCTextWindow(); X X/* in-core Directory structure */ X X/* File types */ Xtypedef enum { X UNKNOWN, X TEXT, X OBJECT, X EXEC, X SHELL, X C, X FORTRAN, X LISP, X PASCAL, X DIRTYPE, X CDEVICE, X BDEVICE, X SOCKET, X FIFO, X SYMLINK X } FILETYPE; Xtypedef struct { X STRING *name; X FILETYPE type; X long size; X} DIRENTRY; X Xtypedef struct { X STRING *name; X int n; X DIRENTRY **dir; X} DIRECTORY; X X#include "UserCallBacks.h" END_OF_dtop.h if test 2355 -ne `wc -c <dtop.h`; then echo shar: \"dtop.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f structs.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"structs.h\" else echo shar: Extracting \"structs.h\" \(1682 characters\) sed "s/^X//" >structs.h <<'END_OF_structs.h' X X#include "Copyright.h" X Xtypedef struct { X int len; X char *str; X} STRING; X Xtypedef struct { X Display *dpy; X int screen; X Window w; X Window parent; X int x,y,ht,wd; X int depth; X int bwidth; X unsigned int class; X Visual *vis; X int vmask; X XSetWindowAttributes *xswa; X} WINDOW; X Xtypedef struct { X int (*CallBack)(); X WINDOW *wp; X WINDOW *UpArrow; X WINDOW *DnArrow; X WINDOW *Thumb; X WINDOW *Bar; X} SCROLLBAR; X Xtypedef struct { X int (*CallBack)(); X WINDOW *wp; X STRING *text; X WINDOW *close; X WINDOW *expand; X} TITLEBAR; X Xtypedef struct { X WINDOW *wp; X STRING *left, *center, *right; X} MESSAGEBAR; X Xtypedef struct { X int (*CallBack)(); X int (*UserCallBack)(); X struct Menu *mp; X WINDOW *wp; X STRING *title; X char key; X} MENUITEM; X Xtypedef struct Menu { X int (*CallBack)(); X STRING *title; X WINDOW *wp; X WINDOW *mw; X int n; X MENUITEM **items; X} MENU; X Xtypedef struct { X int (*CallBack)(); X WINDOW *wp; X int n; X MENU **items; X} MENUBAR; X Xtypedef struct { X int (*CallBack)(); X WINDOW *wp; X int nlines; X char **lines; X XFontStruct *font; X GC TextGC; X int top, bot; X} TEXTWINDOW; X Xtypedef struct { X int (*CallBack)(); X WINDOW *wp; X TITLEBAR *title; X MESSAGEBAR *message; X SCROLLBAR *hscroll; X SCROLLBAR *vscroll; X TEXTWINDOW *text; X} PANE; X Xtypedef struct { X int (*CallBack)(); X WINDOW *frame; X WINDOW *dtop; X MENUBAR *menubar; X} FRAME; X X/* X * This type only exists for coercion with other types X * when stored thru XStoreContext(). X * Note that the first element of all structs used this X * way must be the CallBack routine. X * I wonder if this is portable, probably only 98% X */ Xtypedef struct { X int (*CallBack)(); X} CALLBACK; END_OF_structs.h if test 1682 -ne `wc -c <structs.h`; then echo shar: \"structs.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f UserCallBacks.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"UserCallBacks.h\" else echo shar: Extracting \"UserCallBacks.h\" \(36 characters\) sed "s/^X//" >UserCallBacks.h <<'END_OF_UserCallBacks.h' X Xint ShutDown(); Xint AboutFinder(); END_OF_UserCallBacks.h if test 36 -ne `wc -c <UserCallBacks.h`; then echo shar: \"UserCallBacks.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f Copyright.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Copyright.h\" else echo shar: Extracting \"Copyright.h\" \(300 characters\) sed "s/^X//" >Copyright.h <<'END_OF_Copyright.h' X/* X * Copyright Barry Shein, (c) 1988 X * X * Removal or modification of this copyright notice will X * be considered a copyright infringement! X * X * This program was written as an April Fool's joke and X * is not intended to be used or distributed for any other X * purpose, original or modified. X * X */ END_OF_Copyright.h if test 300 -ne `wc -c <Copyright.h`; then echo shar: \"Copyright.h\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of shell archive. exit 0
root@uokmet.UUCP (04/05/88)
>echo shar: Extracting \"README\" \(430 characters\) >sed "s/^X//" >README <<'END_OF_README' >X >XTHIS PROGRAM IS AN APRIL FOOL'S JOKE AND IS INTENDED FOR NO OTHER >XPURPOSE! If it is posted as an April Fool's joke, it is *VERY EXPENSIVE* and not funny! == kwthomas ==