This is ControlPoint.m in view mode; [Download] [Up]
/* * (C) 1990 by Adobe Systems Incorporated. All rights reserved. * * This file may be freely copied and redistributed as long as: * 1) This entire notice continues to be included in the file, * 2) If the file has been modified in any way, a notice of such * modification is conspicuously indicated. * * PostScript, Display PostScript, and Adobe are registered trademarks of * Adobe Systems Incorporated. * * ************************************************************************ * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, * FITNESS FOR PARTICULAR PURPOSES AND NONINFINGEMENT OF THIRD PARTY RIGHTS. * ************************************************************************ */ /* * ControlPoint.m * This file handles the particulars for the control point. */ #import "ControlPoint.h" #import "ControlView.h" #import "ControlPointWraps.h" #import "ControlViewWraps.h" #import <appkit/View.h> #import <appkit/nextstd.h> #import <dpsclient/dpsclient.h> #import <dpsclient/wraps.h> static char fontname[ ] = "ControlPointsFont"; /* The point arrays below have the number of points in the array as the * first entry followed by the points. The op arrays have the number of * ops in the array as the first entry followed by the operators. */ static float ptsRectfill[] = {8, -2, -2, 0, 4, 4, 0, 0, -4}; static char opsRectfill[] = { 5, dps_rmoveto, dps_rlineto, dps_rlineto, dps_rlineto, dps_closepath}; static float ptsRectstroke[] = {8, -2, -2, 0, 4, 4, 0, 0, -4}; static char opsRectstroke[] = { 5, dps_rmoveto, dps_rlineto, dps_rlineto, dps_rlineto, dps_closepath}; static float ptsX[] = {8, -2, -2, 4, 4, 0, -4, -4, 4}; static char opsX[] = { 4, dps_rmoveto, dps_rlineto, dps_rmoveto, dps_rlineto}; static float ptsCross[] = {8, 0, 2, 0, -4, -2, 2, 4, 0}; static char opsCross[] = { 4, dps_rmoveto, dps_rlineto, dps_rmoveto, dps_rlineto}; @implementation ControlPoint - setControlView:anObject { controlView = anObject; PSWDefsContPts (); PSWSetDependent(); PSWDefineFont(fontname); [self setRectfill:self]; return self; } - setRectfill:sender { fontchar = 'a'; basicProc = "BRF"; basicOp = "fill"; userPtsArray = ptsRectfill; userOpsArray = opsRectfill; userOp = "ufill"; rectOp = "rectfill"; [controlView setButtonTitle:FILL]; [controlView setButtonEnable:YES]; [controlView eraseTimes:self]; return self; } - setRectstroke:sender { fontchar = 'b'; basicProc = "BRS"; basicOp = "stroke"; userPtsArray = ptsRectstroke; userOpsArray = opsRectstroke; userOp = "ustroke"; rectOp = "rectstroke"; [controlView setButtonTitle:STROKE]; [controlView setButtonEnable:YES]; [controlView eraseTimes:self]; return self; } - setX:sender { fontchar = 'c'; basicProc = "BX"; basicOp = "stroke"; userPtsArray = ptsX; userOpsArray = opsX; userOp = "ustroke"; rectOp = "pop"; [controlView setButtonTitle:STROKE]; [controlView setButtonEnable:NO]; [controlView eraseTimes:self]; return self; } - setCross:sender { fontchar = 'd'; basicProc = "BC"; basicOp = "stroke"; userPtsArray = ptsCross; userOpsArray = opsCross; userOp = "ustroke"; rectOp = "pop"; [controlView setButtonTitle:STROKE]; [controlView setButtonEnable:NO]; [controlView eraseTimes:self]; return self; } -deviceDependence:(BOOL) independent { if (independent) PSWSetIndependent(); else PSWSetDependent(); PSundefinefont(fontname); PSWDefineFont(fontname); } - selectFont:(int) fontsize; { PSselectfont(fontname, fontsize); return self; } - (char) getChar { return fontchar; } - (char *) getBasicProc { return basicProc; } - (char *) getBasicOp { return basicOp; } - (float *) getUserPtsArray { return userPtsArray; } - (char *) getUserOpsArray { return userOpsArray; } - (char *) getUserOp { return userOp; } - (char *) getRectOp { return rectOp; } - drawBitMap:bitMapId { [bitMapId lockFocus]; PSgsave(); PSsetalpha(0.0); /* Transparent */ PSsetgray(NX_WHITE); PSrectfill(0, 0, FIGURESIZE, FIGURESIZE); PSsetalpha(1.0); /* Opaque */ PSsetgray(NX_BLACK); PSWBasic(FIGURESIZE/2, FIGURESIZE/2, basicProc, basicOp); PSgrestore(); [bitMapId unlockFocus]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.