This is GraphicView.h in view mode; [Download] [Up]
#ifndef _GRAPHICVIEW_H_
#define _GRAPHICVIEW_H_
typedef enum { Normal, Resizing } DrawStatusType;
typedef enum { LEFT = 1, RIGHT, BOTTOM, TOP, HORIZONTAL_CENTERS, VERTICAL_CENTERS, BASELINES } AlignmentType;
extern DrawStatusType DrawStatus;
extern NXAtom DrawPboardType;
extern BOOL InMsgPrint;
typedef enum { ByRect, ByGraphic, ByList } DrawSelectionType;
/* Update modes for links. */
#define UPDATE_NEVER 0
#define UPDATE_IMMEDIATELY -1
#define UPDATE_NORMALLY 1
#define FUNCTION_CLASSES	2
#define FIP_ARCHIVE_FIX         3
@class DrawApp, Graphic;
@interface GraphicView : View
{
    List *glist;			/* the list of Graphics */
    List *slist;			/* the list of selected Graphics. In 
    					   Draw with undo we are very careful
					   to keep slist sorted, like glist */
    Window *cacheWindow;		/* the off-screen cache */
    struct {
#ifdef __BIG_ENDIAN__    
	unsigned int groupInSlist:1;	/* whether a Group is in the slist */
	unsigned int cacheing:1;	/* whether cacheing or drawing */
	unsigned int suspendLinkUpdate:1; /* don't update links */
	unsigned int grid:8;		/* grid size */
	unsigned int showGrid:1;	/* whether grid is visible */
	unsigned int locked:1;		/* some graphics are locked */
	unsigned int gridDisabled:1;	/* whether grid is enabled */
	unsigned int freeOriginalPaste:1;/* whether originalPaste needs free */
	unsigned int serviceActsOnSelection:1;	/* whether service acts on selection */
	unsigned int selectAll:1;	/* select all was last select operation performed */
	unsigned int dragCopyOk:1;	/* true if dragging with sourcMask == copy is ok */
	unsigned int dragLinkOk:1;	/* true if dragging with sourcMask == link is ok */
	unsigned int padding:13;
#else
	unsigned int padding:13;
	unsigned int dragLinkOk:1;
	unsigned int dragCopyOk:1;
	unsigned int selectAll:1;
	unsigned int serviceActsOnSelection:1;
	unsigned int freeOriginalPaste:1;
	unsigned int gridDisabled:1;
	unsigned int locked:1;
	unsigned int showGrid:1;
	unsigned int grid:8;
	unsigned int suspendLinkUpdate:1; 
	unsigned int cacheing:1;
	unsigned int groupInSlist:1;
#endif
    } gvFlags;
    short *gupCoords;			/* points in the grid user path */
    int gupLength;			/* number of points in gupCoords */
    char *gupOps;			/* movetos and linetos in the gup */
    short *gupBBox;			/* bounding box of the gup */
    float gridGray;			/* grayness of the grid */
    int consecutivePastes;		/* number of consecutive pastes */
    int lastPastedChangeCount;		/* the change count of last paste */
    int lastCopiedChangeCount;		/* the change count of last cut or copy */
    int lastCutChangeCount;		/* the change count of last cut */
    View *editView;			/* flipped subview for editing */
    Graphic *originalPaste;		/* the first pasted graphic */
    NXDataLinkManager *linkManager;	/* manager of data links */
    NXRect *invalidRect;		/* invalid area which must be cleaned up */
    NXRect *dragRect;			/* last rectangle we dragged out to select */
    Storage *linkTrackingRects;		/* the rects of the links we are tracking */
    
    DrawApp *drawInstance;	/* global controller instance */
}
/* Class initialization */
+ initialize;
/* Alignment methods */
+ (SEL)actionFromAlignType:(AlignmentType)alignType;
/* Creation methods */
- initFrame:(const NXRect *)frameRect;
/* Free method */
- free;
/* Public methods */
- (BOOL)move:(NXEvent *)event; // Make public for HGraphicView -pfkeb
- (BOOL)isEmpty;
- (BOOL)hasEmptySelection;
- dirty;
- getSelection;
- setGroupInSlist:(BOOL)setting;
- resetGroupInSlist;
- resetLockedFlag;
- getBBox:(NXRect *)bbox of:(List *)list;
- getBBox:(NXRect *)bbox of:(List *)list extended:(BOOL)flag;
- redrawGraphics:graphicsList afterChangeAgent:changeAgent performs:(SEL)aSelector;
- graphicsPerform:(SEL)aSelector;
- graphicsPerform:(SEL)aSelector with:(void *)argument;
- cache:(const NXRect *)rect;
- cache:(const NXRect *)rect andUpdateLinks:(BOOL)updateLinks;
- recacheSelection;
- createCacheWindow:(Window *)cacheWindow;
- createCacheWindow;
- selectionCache;
- (int)cacheSelection;
- (int)cacheList:(List *)list into:(Window *)cacheWindow withTransparentBackground:(BOOL)flag;
- (int)cacheList:(List *)list into:(Window *)cacheWindow;
- cacheGraphic:(Graphic *)graphic;
- removeGraphic:(Graphic *)graphic;
- insertGraphic:(Graphic *)graphic;
- (Graphic *)selectedGraphic;
- (List *)selectedGraphics;
- (List *)graphics;
- (int)gridSpacing;
- (BOOL)gridIsVisible;
- (BOOL)gridIsEnabled;
- (float)gridGray;
- setGridSpacing:(int)gridSpacing;
- setGridEnabled:(BOOL)flag;
- setGridVisible:(BOOL)flag;
- setGridGray:(float)gray;
- setGridSpacing:(int)gridSpacing andGray:(float)gray;
- grid:(NXPoint *)point;
- placeGraphic:(Graphic *)graphic at:(const NXPoint *)location;
/* Methods overridden from superclass */
- sizeTo:(NXCoord)width :(NXCoord)height;
- mouseDown:(NXEvent *)event;
- drawSelf:(const NXRect *)rects :(int)rectCount;
- keyDown:(NXEvent *)event;
/* Getting/Setting the current Graphic */
- (Graphic *)currentGraphic;
- setCurrentGraphic:sender;
/* Writing Draw Forms */
- (BOOL)hasFormEntries;
- writeFormEntriesToFile:(const char *)filename;
/* Target/Action methods */
- delete:sender;
- selectAll:sender;
- deselectAll:sender;
- lock:sender;
- unlock:sender;
- bringToFront:sender;
- sendToBack:sender;
- group:sender;
- ungroup:sender;
- align:sender;
- changeAspectRatio:sender;
- alignToGrid:sender;
- sizeToGrid:sender;
- enableGrid:sender;
- hideGrid:sender;
- addCoverSheetEntry:sender;
- addLocalizableCoverSheetEntry:sender;
/* Target/Action messages sent from Controls to set various parameters */
- takeGridValueFrom:sender;
- takeGridGrayFrom:sender;
- takeGrayValueFrom:sender;
- takeLineWidthFrom:sender;
- takeLineJoinFrom:sender;
- takeLineCapFrom:sender;
- takeLineArrowFrom:sender;
- takeFillValueFrom:sender;
- takeFrameValueFrom:sender;
- takeLineColorFrom:sender;
- takeFillColorFrom:sender;
- takeFormEntryStatusFrom:sender;
- changeFont:sender;
/* Accepting becoming the First Responder */
- (BOOL)acceptsFirstResponder;
/* Printing-related methods */
- beginPrologueBBox:(NXRect *)boundingBox creationDate:(char *)dateCreated
    createdBy:(char *)anApplication fonts:(char *)fontNames
    forWhom:(char *)user pages:(int )numPages title:(char *)aTitle;
- beginSetup;
/* Archiving methods */
- awake;
- write:(NXTypedStream *)stream;
- read:(NXTypedStream *)stream;
/* Validates whether a menu command makes sense now */
- (BOOL)validateCommand:(MenuCell *)menuCell;
/* Useful scrolling methods */
- scrollGraphicToVisible:(Graphic *)graphic;
- scrollPointToVisible:(const NXPoint *)point;
- scrollSelectionToVisible;
@end
/* Pasteboard */
typedef enum { LinkOnly = -1, DontLink = 0, Link = 1 } LinkType;
@interface GraphicView(Pasteboard)
#define NUM_TYPES_DRAW_EXPORTS 3
extern NXAtom *TypesDrawExports(void);
extern NXAtom DrawPasteType(const NXAtom *types);
extern NXAtom ForeignPasteType(const NXAtom *types);
extern NXAtom TextPasteType(const NXAtom *types);
extern BOOL IncludesType(const NXAtom *types, NXAtom type);
extern NXAtom MatchTypes(const NXAtom *typesToMatch, const NXAtom *orderedTypes);
+ convert:(NXTypedStream *)ts to:(const char *)type using:(SEL)writer toPasteboard:(Pasteboard *)pb;
+ pasteboard:(Pasteboard *)sender provideData:(const char *)type;
- writePSToStream:(NXStream *)stream;
- writePSToStream:(NXStream *)stream usingList:(List *)aList;
- writeTIFFToStream:(NXStream *)stream;
- writeTIFFToStream:(NXStream *)stream usingList:(List *)aList;
- copySelectionAsPSToStream:(NXStream *)stream;
- copySelectionAsTIFFToStream:(NXStream *)stream;
- copySelectionToStream:(NXStream *)stream;
- copyToPasteboard:(Pasteboard *)pboard types:(NXAtom *)types;
- copyToPasteboard:(Pasteboard *)pboard;
- (BOOL)pasteForeignDataFromPasteboard:(Pasteboard *)pboard andLink:(LinkType)doLink at:(const NXPoint *)point;
- pasteFromPasteboard:(Pasteboard *)pboard andLink:(LinkType)doLink at:(const NXPoint *)point;
- paste:sender andLink:(LinkType)doLink;
- cut:sender;
- copy:sender;
- paste:sender;
- pasteAndLink:sender;
@end
/* Data link methods */
@interface GraphicView(Links)
- (NXSelection *)currentSelection;
- (Graphic *)findGraphicInSelection:(NXSelection *)selection;
- (List *)findGraphicsInSelection:(NXSelection *)selection;
- writeLinkToPasteboard:(Pasteboard *)pboard types:(const NXAtom *)typesList;
- readLinkForGraphic:(Graphic *)graphic fromPasteboard:(Pasteboard *)pboard useNewIdentifier:(BOOL)useNewIdentifier;
- (BOOL)addLink:(NXDataLink *)link toGraphic:(Graphic *)graphic at:(const NXPoint *)p update:(int)update;
- pasteFromPasteboard:(Pasteboard *)pboard at:(NXSelection *)selection;
- importFile:(const char *)filename at:(NXSelection *)selection;
- pasteboard:(Pasteboard *)sender provideData:(const char *)type;
- copyToPasteboard:(Pasteboard *)pboard at:(NXSelection *)selection cheapCopyAllowed:(BOOL)cheapCopyAllowed;
- updateLinksPanel;
- (NXDataLinkManager *)linkManager;
- setLinkManager:(NXDataLinkManager *)linkManager;
- showSelection:(NXSelection *)selection;
- breakLinkAndRedrawOutlines:(NXDataLink *)aLink;
- updateTrackedLinks:(const NXRect *)rect;
- startTrackingLink:(NXDataLink *)link;
- stopTrackingLink:(NXDataLink *)link;
@end
/* Dragging */
@interface GraphicView(Drag)
- registerForDragging;
- (NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender;
- (NXDragOperation)draggingUpdated:(id <NXDraggingInfo>)sender;
- (BOOL)performDragOperation:(id <NXDraggingInfo>)sender;
@end
/* Services Menu */
@interface GraphicView(Services)
- validRequestorForSendType:(NXAtom)sendType andReturnType:(NXAtom)returnType;
- (BOOL)writeSelectionToPasteboard:(Pasteboard *)pboard types:(NXAtom *)types;
- readSelectionFromPasteboard:(Pasteboard *)pboard;
@end
/*
 * Since we can't be sure that we have an InspectorPanel, we use the
 * objective-C respondsTo: mechanism to see if we can send the message
 * initializeGraphic: to [NXApp inspectorPanel].  This dummy interface
 * declaration declares those messages (so that even if they don't exists,
 * we can at least use them to check with respondsTo:).  We don't want
 * to import DrawApp.h or InspectorPanel.h since we might accidentally
 * introduce a dependency on them which wouldn't be caught because we
 * imported both of their interfaces.
 */
@interface PossibleInspectorPanel : Object
- inspectorPanel;
- initializeGraphic:(Graphic *)graphic;
@end
@interface GraphicView(Draw2)
/*
 * Extensions to GraphicView which are implemented in gvDraw2.
 * These methods were in NeXTSTEP 2.0 version of Draw and were
 * used by HippoDraw
 */
 
- graphicsPerform:(SEL)aSelector with:(void *)argument andDraw:(BOOL)flag;
- graphicsPerform:(SEL)aSelector andDraw:(BOOL)flag;
@end
#endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.