ftp.nice.ch/peanuts/GeneralData/Documents/adobe/DPS.Purple.HitDetect.tar.gz#/NX_HitDetect/DrawingView.h

This is DrawingView.h in view mode; [Download] [Up]

/*
 * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
 *
 * (b)  If this Sample Code is distributed as part of the Display PostScript
 *	System Software Development Kit from Adobe Systems Incorporated,
 *	then this copy is designated as Development Software and its use is
 *	subject to the terms of the License Agreement attached to such Kit.
 *
 * (c)  If this Sample Code is distributed independently, then the following
 *	terms apply:
 *
 * (d)  This file may be freely copied and redistributed as long as:
 *	1) Parts (a), (d), (e) and (f) continue to be included in the file,
 *	2) If the file has been modified in any way, a notice of such
 *      modification is conspicuously indicated.
 *
 * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
 *	Adobe Systems Incorporated.
 * 
 * (f) 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 NONINFRINGEMENT
 *	OF THIRD PARTY RIGHTS.
 */

/*
 *	DrawingView.h
 *
 *	This view represents the page that the bezier is drawn onto. It is
 *	a subview of the doc view and can be zoomed and reduced.
 *
 *	The buffers are used to allow for fast redrawing and moving. The
 *	drawing is performed in the alpha buffer and then this is
 *	composited into the buffered window. When the bezier is
 *	selected and changed, the drawing of the new bezier 
 *	occurs in the buffered window. With each mouse drag the
 *	old image in alpha is first composited into the window and
 *	then the new bezier drawn atop the old image.
 *
 *	When the image is moved, it is first drawn into the beta
 *	buffer and then simply composited to a new location. If
 *	the image is larger than the beta buffer, then the image
 *	is redrawn instead of using the buffer.
 *
 *	Version:	2.0
 *	Author:	Ken Fromm
 *	History:
 *			03-07-91		Added this comment.
 */

#import "DetectApp.h"
#import <appkit/View.h>
#import <appkit/timer.h>

#define  PTS_UPATH_BUFFER		100
#define  OPS_UPATH_BUFFER		100

#define  NUM_POINTS_HIT			12
#define  NUM_OPS_HIT			6

#define COLORGRID				NX_LTGRAY
#define WIDTHGRID				2.0
#define SIZEGRID					36

typedef struct _UPath {
	float 	* pts;
	int		num_pts;
	char		*ops;
	int		num_ops;
} UPath;
	
@interface DrawingView:View
{
	id			objectId,			/* id of the bezier */
				bufferAlpha,		/* id of the main drawing buffer */
				bufferBeta;		/* id of the buffer used when moving */

	BOOL		scrolling,			/* YES if need to update bufferAlpha */
				selected,			/* YES if the bezier has been selected */
				tracedetect,		/* YES if tracing the hit detection */
				tracedraw,		/* YES if tracing the drawing */
				drawgrid;			/* YES if drawing the grid */

	int			timermask,
				gridUpath;

	UPath		hitPoint,			/* User path descriptions that will be used */
				drawUpath;		/* for the hit detection point and the graphics. */

	NXTrackingTimer	*timer;
}

- initFrame:(NXRect *) frm;
- initializeHitPoint;
- createGrid;
- createObject;
- free;

- traceDetect:sender;
- traceDraw:sender;
- drawGrid:sender;

- compositeBufferAlpha:(NXRect *) r;

- moveTo:(NXCoord)x :(NXCoord)y;
- scale:(NXCoord)x :(NXCoord)y;
- sizeTo:(NXCoord)x :(NXCoord)y;

- constrainPoint:(NXPoint *)aPt  withOffset:(const NXSize*)llOffset  :(const NXSize*)urOffset;
- constrainRect:(NXRect *)aRect;

- (BOOL) isScrolling;
- scrollToRect:(const NXRect *)toRect;

- redrawObject:(int) pt_num :(NXRect *)redrawRect;
- moveObject:(NXEvent *)event :(NXRect *)redrawRect;

 - (BOOL) checkControl:(const NXPoint *) p :(int *) pt_num;
- (BOOL) checkObject:(const NXPoint *) p;

- mouseDown:(NXEvent *)event;

- drawObject:(NXRect *)r  for:object  withUcache:(BOOL)flag;
- drawControl:(NXRect *)r  for:object;

- drawSelf:(NXRect *)r :(int) count;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.