ftp.nice.ch/peanuts/GeneralData/Documents/adobe/DPS.Purple.ImportAdv.tar.gz#/NX_ImportAdv/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 image is drawn onto. It is
 *	a subview of the DocView. The DocView is the document view of
 *	the ClipView. This view's real size grows with the scale but the
 *	bounds always stays the same.
 *
 *	Version:	2.0
 *	Author:	Ken Fromm
 *	History:
 *			03-17-91		Added this comment and fixed the preview section.
 */

#import "ImportApp.h"
#import "epsfstruct.h"

#import <appkit/View.h>
#import <appkit/tiff.h>
#import <appkit/timer.h>

#define  FONTSIZE			5
#define  SCROLL_MARGIN		8
#define  COMMENT_MAXLINE	100

/*
*	A very system dependent define. It defines the amount of time
*	that the mouse must be held down before it is considered a move.
*	This hopefully prevents accidentally moving an object when
*	just trying to select it or another.
*/
#define  MOVE_INTERVAL	12

/* Flags that control the drawing operations of the graphic objects. */
#define  NOFLAGS			0x0
#define  REDRAWFLAG		0x1
#define  MOVEFLAG			0x2
#define  CLEARFLAG			0x4
#define  REFRESHFLAG		0x8
		
@interface DrawingView:View
{
	id		imageId,	/* id of the bitmap image for the preview */
			bufferId,			/* id of the offscreen buffer  (content view of a window) */
			graphicId,		/* id of imported file waiting to be placed */
			graphiclistId,		/* list of all the graphics */
			selectedlistId;		/* list of selected graphics */

	BOOL	dirty,			/* YES if different from saved version. */
			pastevalid;		/* YES if the pasteboard holds a valid type */

	int		timermask,		/* the mask for modal loop timing */
			pastecount;		/* the count when the paste menu cell is validated */

	UPath	*hitPoint,			/* user path description used for hit detection */
			*upathBuffer;		/* an application wide buffer for control points or whatever */
	
	NXTrackingTimer	*timer;	/* the timer structure for modal loop drawing */

	NXPoint		rotatePoint;	/* the point about which to rotate the selected graphics */
}

+newFrame:(const NXRect *) frm;

- free;

- showBuffer:sender;
- hideBuffer:sender;

- (float) controlPointSize;
- (float) hitSetting;
- buffer;
- image;

- setDirty:(BOOL) flag;
- (BOOL)isDirty;
- (BOOL)isEmpty;
- (BOOL)isSelected;

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

- writePSToStream:(NXStream *) stream;

/* The next seven methods are invoked through target-action first responder messages. */
- cut:sender;
- delete:sender;
- copy:sender;
- paste:sender;
- selectAll:sender;
- bringToFront:sender;
- sendToBack:sender;
- originalRatio:sender;

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

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

- eraseRotatePoint:(NXRect *) drawnRect;
- drawRotatePoint;
- rotateObjectStart:(NXEvent *)event;
- rotateObject:(NXEvent *)event;

- checkControl:(const NXPoint *) p :(int *) pt_num;
- checkObject:(const NXPoint *) p  in:listId  from:(int) start  to:(int) end;
- deselectObject:objectId;
- selectObject:objectId;
- testObject:(NXEvent *)event;

- importFile:(const char *) file  at:(NXPoint *) p;
- placeObjectAt:(NXPoint *) p;
- importObject:(NXEvent *)event;

/* Event handling methods. */
- mouseDown:(NXEvent *)event;
- flagsChanged:(NXEvent *) event;
- keyDown:(NXEvent *) event;

/* Drawing methods */
- drawObject:object  forRect:(NXRect *)r  withFlags:(int) flags;
- drawControl:object  forRect:(NXRect *)r  withFlags:(int) flags;
- drawSelf:(NXRect *)r :(int) count;
- display:(NXRect *)r  :(int) count  :(BOOL)flag;
- (BOOL) lockFocus;
- unlockFocus;

- (BOOL)acceptsFirstResponder;

/* Archiving methods. */
- write:(NXTypedStream *)stream;
- read:(NXTypedStream *)stream;
- awake;

/* Enables and disables the menu cells for first responder messages. */
- (BOOL)validateCommand:menuCell;

/* Printing/copying methods overridden from the view class. */
- (BOOL) knowsPagesFirst:(int *) firstPageNum  last:(int *) lastPageNum;
- (BOOL) getRect:(NXRect *) theRect  forPage:(int) page;
- addResources:(Resource *) docResources;
- beginResourceComments:(const NXRect *) bbox;

- beginPrologueBBox:(const NXRect *)boundingBox 
	creationDate:(const char *)dateCreated 
	createdBy:(const char *)anApplication 
	fonts:(const char *)fontNames 
	forWhom:(const char *)user 
	pages:(int)numPages 
	title:(const char *)aTitle;
- endHeaderComments;
- endPrologue;
- beginSetup;
- endSetup;
- beginTrailer;
- endTrailer;

@end

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