bvs%carlisle@Sun.COM (Bruce Schwartz) (12/17/88)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # README # Makefile # draw.h # go.h # gopvt.h # comm.h # This archive created: Fri Dec 16 15:05:51 1988 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'README' then echo shar: "will not over-write existing file 'README'" else cat << \SHAR_EOF > 'README' % % This file is a product of Sun Microsystems, Inc. and is provided for % unrestricted use provided that this legend is included on all tape % media and as a part of the software program in whole or part. % Users may copy, modify or distribute this file at will. % % THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE % WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR % PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. % % This file is provided with no support and without any obligation on the % part of Sun Microsystems, Inc. to assist in its use, correction, % modification or enhancement. % % SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE % INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE % OR ANY PART THEREOF. % % In no event will Sun Microsystems, Inc. be liable for any lost revenue % or profits or other special, indirect and consequential damages, even % if Sun has been advised of the possibility of such damages. % % Sun Microsystems, Inc. % 2550 Garcia Avenue % Mountain View, California 94043 % % Copyright (C) 1988 by Sun Microsystems. All rights reserved. The files in this directory constitue NewsDraw. All files in this directory are subject to the above notice. The file SUG.ps contains a PostScript version of the talk I gave about this program at the Sun User's Group meeting in Miami in December of 1988. It may viewed using psview or NewsLine, the other program described in the talk. Bruce Schwartz Sun Microsystems December 1988 bvs@sun.com SHAR_EOF fi if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else cat << \SHAR_EOF > 'Makefile' # $Header: Makefile,v 1.9 88/12/02 10:50:43 bvs Exp $ # Copyright (C) 1988 by Sun Microsystems. All rights reserved. HS = draw.h go.h gopvt.h comm.h CPSS = psint.cps PSS = draw.ps menubar.ps GCS = circ.c line.c oval.c rect.c text.c poly.c OCS = draw.c item.c eh.c font.c go.c file.c prop.c stretch.c CS = $(GCS) $(OCS) SRCS = $(HS) $(CPSS) $(PSS) $(CS) CLEAN = *.o psint.h psint.c OFILES = draw.o psint.o eh.o go.o item.o file.o poly.o \ line.o rect.o circ.o oval.o text.o font.o stretch.o prop.o CFLAGS = -g -I/usr/NeWS/include all: $(PSS) draw wc: wc -l $(SRCS) print: enscript -2r $(SRCS) draw: $(OFILES) cc $(CFLAGS) -o draw -L/usr/NeWS/lib $(OFILES) -lcps -lm psint.o: psint.c circ.o: go.h draw.h psint.h gopvt.h draw.o: go.h draw.h psint.h eh.o: go.h draw.h psint.h go.o: go.h draw.h psint.h item.o: go.h draw.h psint.h gopvt.h line.o: go.h draw.h psint.h gopvt.h oval.o: go.h draw.h psint.h gopvt.h poly.o: go.h draw.h psint.h gopvt.h rect.o: go.h draw.h psint.h gopvt.h stretch.o: go.h draw.h psint.h gopvt.h comm.h text.o: go.h draw.h psint.h gopvt.h prop.o: psint.h comm.h $(SRCS): co $@ tar: tar cvf /dev/rst0 $(SRCS) SHARS = shar1 shar2 shar3 shar4 shar5 shar: rm -f $(SHARS) make $(SHARS) shar1: shar README Makefile $(HS) > $@ shar2: shar SUG.ps > $@ shar3: shar $(CPSS) $(PSS) > $@ shar4: shar $(GCS) > $@ shar5: shar $(OCS) > $@ clean: rm -f $(CLEAN) *.BAK rcsclean co Makefile README .SUFFIXES: .cps .cps.h: cps -i $< .cps.c: cps -i $< SHAR_EOF fi if test -f 'draw.h' then echo shar: "will not over-write existing file 'draw.h'" else cat << \SHAR_EOF > 'draw.h' /* $Header: draw.h,v 1.5 88/12/02 10:43:28 bvs Exp $ */ /* Copyright (C) 1988 by Sun Microsystems. All rights reserved. */ /* * $Header: draw.h,v 1.5 88/12/02 10:43:28 bvs Exp $ * * NewsDraw: A NeWS based Graphical Object Editor * By Bruce Schwartz * * Thanks to Charlie Burns for figuring out how to get crude * objects and inheiritance out of C. By putting most structure * definitions in the .c files, we have truely opaque objects. * In item.c/go.h/gopvt.h, we have simple inheritance. * Cheesy but effective! */ /* % % This file is a product of Sun Microsystems, Inc. and is provided for % unrestricted use provided that this legend is included on all tape % media and as a part of the software program in whole or part. % Users may copy, modify or distribute this file at will. % % THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE % WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR % PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. % % This file is provided with no support and without any obligation on the % part of Sun Microsystems, Inc. to assist in its use, correction, % modification or enhancement. % % SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE % INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE % OR ANY PART THEREOF. % % In no event will Sun Microsystems, Inc. be liable for any lost revenue % or profits or other special, indirect and consequential damages, even % if Sun has been advised of the possibility of such damages. % % Sun Microsystems, Inc. % 2550 Garcia Avenue % Mountain View, California 94043 % % Copyright (C) 1988 by Sun Microsystems. All rights reserved. */ #ifndef DRAW_H #define DRAW_H #define TRUE 1 #define FALSE 0 /* the modes -- some have graphical objects */ #define STRETCH 0 #define ROTATE 1 #define BRUSH 2 #define LINE 3 #define RECT 4 #define CIRC 5 #define OVAL 6 #define TEXT 7 #define POLY 8 #define MODEMAX 10 /* event handlers */ typedef struct { void *(*handleselect)(); /* select button */ void *(*handleadjust)(); /* adjust button */ void *(*handlekey)(); /* keystroke */ void *(*handleprop)(); /* property list change */ void *(*handlereply)(); /* server reply */ void *(*handledamage)(); /* damage event */ void *(*handlebegin)(); /* begin mode */ void *(*handleend)(); /* end mode */ } EHPROCS; EHPROCS ehprocs[MODEMAX]; #endif SHAR_EOF fi if test -f 'go.h' then echo shar: "will not over-write existing file 'go.h'" else cat << \SHAR_EOF > 'go.h' /* $Header: go.h,v 1.6 88/12/02 10:43:22 bvs Exp $ */ /* Copyright (C) 1988 by Sun Microsystems. All rights reserved. */ #ifndef GO_H #define GO_H #include "draw.h" #include "psint.h" typedef struct { void *(*holder)(); /* item pointer */ void *(*new)(); /* new item */ void *(*move)(); /* move item */ void *(*rotate)(); /* rotate item */ void *(*scale)(); /* scale item */ void *(*setpath)(); /* set path for int draw */ void *(*draw)(); /* draw on screen */ void *(*print)(); /* write postscript file */ void *(*write)(); /* write draw file */ void *(*read)(); /* read draw file */ } GOPROCS; GOPROCS goprocs[MODEMAX]; typedef struct item ITEM; typedef struct font FONT; typedef struct prop PROP; #define GONewLine(x0, y0, x1, y1) (ITEM *)goprocs[LINE].new(x0, y0, x1, y1) #define GONewRect(x0, y0, x1, y1) (ITEM *)goprocs[RECT].new(x0, y0, x1, y1) #define GONewOval(x0, y0, x1, y1) (ITEM *)goprocs[OVAL].new(x0, y0, x1, y1) #define GONewCirc(x0, y0, x1, y1) (ITEM *)goprocs[CIRC].new(x0, y0, x1, y1) #define GONewText(x0, y0,pc, pfont) (ITEM *)goprocs[TEXT].new(x0, y0, pc, pfont) #define GONewPencil(x0, y0, apoint, length) \ (ITEM *)goprocs[PENCIL].new(apoint, length) #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) #define ABS(x) (((x) > 0) ? (x) : (-(x))) #define POS(x) (((x) >= 0) ? 1 : 0) #define NEG(x) (((x) >= 0) ? 0 : 1) extern float GOItemGetRotation(); extern ITEM *GOAddItem(); extern ITEM *GODrawItem(); extern FONT *FontDefault(); float PropStrokeColor(); float PropFillColor(); float PropTextColor(); FONT *PropFont(); PROP *PropCopyOf(); PROP *PropCurrent(); PROP *PropRead(); #endif SHAR_EOF fi if test -f 'gopvt.h' then echo shar: "will not over-write existing file 'gopvt.h'" else cat << \SHAR_EOF > 'gopvt.h' /* $Header: gopvt.h,v 1.3 88/12/02 10:43:30 bvs Exp $ */ /* Copyright (C) 1988 by Sun Microsystems. All rights reserved. */ #ifndef GOPVT_H #define GOPVT_H /* graphical objects */ #define ITEMHEADER \ int type; /* type of item */ \ int flags; /* bitwise flags */ \ int x0, y0; /* bottom/left corner */ \ int x1, y1; /* top/right corner */ \ float rotation; /* degrees of rotation from canonical form */ \ int xscale; /* scaling in x dimension */ \ int yscale; /* scaling in y dimension */ \ PROP* prop ; /* properties for item */ \ ITEM* pprev; \ ITEM* pnext struct item { ITEMHEADER; }; #define X0 (pitem->x0) #define Y0 (pitem->y0) #define X1 (pitem->x1) #define Y1 (pitem->y1) #define X ((pitem->x0 + pitem->x1) / 2) #define Y ((pitem->y0 + pitem->y1) / 2) #define W ((pitem->x1 - pitem->x0)) #define H ((pitem->y1 - pitem->y0)) #define W2 ((pitem->x1 - pitem->x0) / 2) #define H2 ((pitem->y1 - pitem->y0) / 2) #endif SHAR_EOF fi if test -f 'comm.h' then echo shar: "will not over-write existing file 'comm.h'" else cat << \SHAR_EOF > 'comm.h' /* $Header: comm.h,v 1.2 88/12/02 10:43:51 bvs Exp $ */ /* Copyright (C) 1988 by Sun Microsystems. All rights reserved. */ #define STRETCH_MODE 0 #define ROTATE_MODE 1 #define BRUSH_MODE 2 #define LINE_MODE 3 #define RECT_MODE 4 #define CIRC_MODE 5 #define OVAL_MODE 6 #define TEXT_MODE 7 #define POLY_MODE 8 #define FILL_KEY 1 #define STROKE_KEY 2 #define WIDTH_KEY 3 #define PRINT_KEY 4 #define TOTOP_KEY 5 #define TOBOT_KEY 6 #define TEXT_KEY 7 #define REDRAW_KEY 8 #define WRITE_KEY 9 #define READ_KEY 10 SHAR_EOF fi exit 0 # End of shell archive