|
|
1.1 ! root 1: typedef enum { Normal, Resizing } DrawStatusType; ! 2: typedef enum { LEFT = 1, RIGHT, BOTTOM, TOP, HORIZONTAL_CENTERS, VERTICAL_CENTERS, BASELINES } AlignmentType; ! 3: ! 4: extern DrawStatusType DrawStatus; ! 5: extern NXAtom DrawPboardType; ! 6: extern BOOL InMsgPrint; ! 7: ! 8: typedef enum { ByRect, ByGraphic, ByList } DrawSelectionType; ! 9: ! 10: /* Update modes for links. */ ! 11: ! 12: #define UPDATE_NEVER 0 ! 13: #define UPDATE_IMMEDIATELY -1 ! 14: #define UPDATE_NORMALLY 1 ! 15: ! 16: @interface GraphicView : View ! 17: { ! 18: List *glist; /* the list of Graphics */ ! 19: List *slist; /* the list of selected Graphics. In ! 20: Draw with undo we are very careful ! 21: to keep slist sorted, like glist */ ! 22: Window *cacheWindow; /* the off-screen cache */ ! 23: struct { ! 24: #ifdef __BIG_ENDIAN__ ! 25: unsigned int groupInSlist:1; /* whether a Group is in the slist */ ! 26: unsigned int cacheing:1; /* whether cacheing or drawing */ ! 27: unsigned int suspendLinkUpdate:1; /* don't update links */ ! 28: unsigned int grid:8; /* grid size */ ! 29: unsigned int showGrid:1; /* whether grid is visible */ ! 30: unsigned int locked:1; /* some graphics are locked */ ! 31: unsigned int gridDisabled:1; /* whether grid is enabled */ ! 32: unsigned int freeOriginalPaste:1;/* whether originalPaste needs free */ ! 33: unsigned int serviceActsOnSelection:1; /* whether service acts on selection */ ! 34: #else ! 35: unsigned int serviceActsOnSelection:1; /* whether service acts on selection */ ! 36: unsigned int freeOriginalPaste:1;/* whether originalPaste needs free */ ! 37: unsigned int gridDisabled:1; /* whether grid is enabled */ ! 38: unsigned int locked:1; /* some graphics are locked */ ! 39: unsigned int showGrid:1; /* whether grid is visible */ ! 40: unsigned int grid:8; /* grid size */ ! 41: unsigned int suspendLinkUpdate:1; /* don't update links */ ! 42: unsigned int cacheing:1; /* whether cacheing or drawing */ ! 43: unsigned int groupInSlist:1; /* whether a Group is in the slist */ ! 44: #endif ! 45: // These last 16 bits are NOT archived, so don't depend on them being permanent across a Save/Open ! 46: unsigned int selectAll:1; /* select all was last select operation performed */ ! 47: unsigned int dragCopyOk:1; /* true if dragging with sourcMask == copy is ok */ ! 48: unsigned int dragLinkOk:1; /* true if dragging with sourcMask == link is ok */ ! 49: unsigned int padding:13; ! 50: } gvFlags; ! 51: short *gupCoords; /* points in the grid user path */ ! 52: int gupLength; /* number of points in gupCoords */ ! 53: char *gupOps; /* movetos and linetos in the gup */ ! 54: short *gupBBox; /* bounding box of the gup */ ! 55: float gridGray; /* grayness of the grid */ ! 56: int consecutivePastes; /* number of consecutive pastes */ ! 57: int lastPastedChangeCount; /* the change count of last paste */ ! 58: int lastCopiedChangeCount; /* the change count of last cut or copy */ ! 59: int lastCutChangeCount; /* the change count of last cut */ ! 60: View *editView; /* flipped subview for editing */ ! 61: Graphic *originalPaste; /* the first pasted graphic */ ! 62: NXDataLinkManager *linkManager; /* manager of data links */ ! 63: NXRect *invalidRect; /* invalid area which must be cleaned up */ ! 64: NXRect *dragRect; /* last rectangle we dragged out to select */ ! 65: Storage *linkTrackingRects; /* the rects of the links we are tracking */ ! 66: } ! 67: ! 68: /* Class initialization */ ! 69: ! 70: + initialize; ! 71: ! 72: /* Alignment methods */ ! 73: ! 74: + (SEL)actionFromAlignType:(AlignmentType)alignType; ! 75: ! 76: /* Creation methods */ ! 77: ! 78: - initFrame:(const NXRect *)frameRect; ! 79: ! 80: /* Free method */ ! 81: ! 82: - free; ! 83: ! 84: /* Public methods */ ! 85: ! 86: - (BOOL)isEmpty; ! 87: - (BOOL)hasEmptySelection; ! 88: - dirty; ! 89: - getSelection; ! 90: - setGroupInSlist:(BOOL)setting; ! 91: - resetGroupInSlist; ! 92: - resetLockedFlag; ! 93: - getBBox:(NXRect *)bbox of:(List *)list; ! 94: - getBBox:(NXRect *)bbox of:(List *)list extended:(BOOL)flag; ! 95: ! 96: - redrawGraphics:graphicsList afterChangeAgent:changeAgent performs:(SEL)aSelector; ! 97: - graphicsPerform:(SEL)aSelector; ! 98: - graphicsPerform:(SEL)aSelector with:(void *)argument; ! 99: ! 100: - cache:(const NXRect *)rect; ! 101: - cache:(const NXRect *)rect andUpdateLinks:(BOOL)updateLinks; ! 102: - recacheSelection; ! 103: - createCacheWindow:(Window *)cacheWindow; ! 104: - selectionCache; ! 105: - (int)cacheSelection; ! 106: - (int)cacheList:(List *)list into:(Window *)cacheWindow withTransparentBackground:(BOOL)flag; ! 107: - (int)cacheList:(List *)list into:(Window *)cacheWindow; ! 108: - cacheGraphic:(Graphic *)graphic; ! 109: ! 110: - removeGraphic:(Graphic *)graphic; ! 111: - insertGraphic:(Graphic *)graphic; ! 112: - (Graphic *)selectedGraphic; ! 113: - (List *)selectedGraphics; ! 114: - (List *)graphics; ! 115: ! 116: - (int)gridSpacing; ! 117: - (BOOL)gridIsVisible; ! 118: - (BOOL)gridIsEnabled; ! 119: - (float)gridGray; ! 120: - setGridSpacing:(int)gridSpacing; ! 121: - setGridEnabled:(BOOL)flag; ! 122: - setGridVisible:(BOOL)flag; ! 123: - setGridGray:(float)gray; ! 124: - setGridSpacing:(int)gridSpacing andGray:(float)gray; ! 125: - grid:(NXPoint *)point; ! 126: ! 127: - placeGraphic:(Graphic *)graphic at:(const NXPoint *)location; ! 128: ! 129: /* Methods overridden from superclass */ ! 130: ! 131: - sizeTo:(NXCoord)width :(NXCoord)height; ! 132: - mouseDown:(NXEvent *)event; ! 133: - drawSelf:(const NXRect *)rects :(int)rectCount; ! 134: - keyDown:(NXEvent *)event; ! 135: ! 136: /* Getting/Setting the current Graphic */ ! 137: ! 138: - (Graphic *)currentGraphic; ! 139: - setCurrentGraphic:sender; ! 140: ! 141: /* Writing Draw Forms */ ! 142: ! 143: - (BOOL)hasFormEntries; ! 144: - writeFormEntriesToFile:(const char *)filename; ! 145: ! 146: /* Target/Action methods */ ! 147: ! 148: - delete:sender; ! 149: - selectAll:sender; ! 150: - deselectAll:sender; ! 151: - lock:sender; ! 152: - unlock:sender; ! 153: - bringToFront:sender; ! 154: - sendToBack:sender; ! 155: - group:sender; ! 156: - ungroup:sender; ! 157: - align:sender; ! 158: - changeAspectRatio:sender; ! 159: - alignToGrid:sender; ! 160: - sizeToGrid:sender; ! 161: - enableGrid:sender; ! 162: - hideGrid:sender; ! 163: - addCoverSheetEntry:sender; ! 164: - addLocalizableCoverSheetEntry:sender; ! 165: ! 166: /* Target/Action messages sent from Controls to set various parameters */ ! 167: ! 168: - takeGridValueFrom:sender; ! 169: - takeGridGrayFrom:sender; ! 170: - takeGrayValueFrom:sender; ! 171: - takeLineWidthFrom:sender; ! 172: - takeLineJoinFrom:sender; ! 173: - takeLineCapFrom:sender; ! 174: - takeLineArrowFrom:sender; ! 175: - takeFillValueFrom:sender; ! 176: - takeFrameValueFrom:sender; ! 177: - takeLineColorFrom:sender; ! 178: - takeFillColorFrom:sender; ! 179: - takeFormEntryStatusFrom:sender; ! 180: ! 181: - changeFont:sender; ! 182: ! 183: /* Accepting becoming the First Responder */ ! 184: ! 185: - (BOOL)acceptsFirstResponder; ! 186: ! 187: /* Printing-related methods */ ! 188: ! 189: - beginSetup; ! 190: ! 191: /* Archiving methods */ ! 192: ! 193: - awake; ! 194: - write:(NXTypedStream *)stream; ! 195: - read:(NXTypedStream *)stream; ! 196: ! 197: /* Validates whether a menu command makes sense now */ ! 198: ! 199: - (BOOL)validateCommand:(MenuCell *)menuCell; ! 200: ! 201: /* Useful scrolling methods */ ! 202: ! 203: - scrollGraphicToVisible:(Graphic *)graphic; ! 204: - scrollPointToVisible:(const NXPoint *)point; ! 205: - scrollSelectionToVisible; ! 206: ! 207: @end ! 208: ! 209: /* Pasteboard */ ! 210: ! 211: typedef enum { LinkOnly = -1, DontLink = 0, Link = 1 } LinkType; ! 212: ! 213: @interface GraphicView(Pasteboard) ! 214: ! 215: #define NUM_TYPES_DRAW_EXPORTS 3 ! 216: ! 217: extern NXAtom *TypesDrawExports(void); ! 218: extern NXAtom DrawPasteType(const NXAtom *types); ! 219: extern NXAtom ForeignPasteType(const NXAtom *types); ! 220: extern NXAtom TextPasteType(const NXAtom *types); ! 221: extern BOOL IncludesType(const NXAtom *types, NXAtom type); ! 222: extern NXAtom MatchTypes(const NXAtom *typesToMatch, const NXAtom *orderedTypes); ! 223: ! 224: + convert:(NXTypedStream *)ts to:(const char *)type using:(SEL)writer toPasteboard:(Pasteboard *)pb; ! 225: + pasteboard:(Pasteboard *)sender provideData:(const char *)type; ! 226: ! 227: - writePSToStream:(NXStream *)stream; ! 228: - writePSToStream:(NXStream *)stream usingList:(List *)aList; ! 229: - writeTIFFToStream:(NXStream *)stream; ! 230: - writeTIFFToStream:(NXStream *)stream usingList:(List *)aList; ! 231: ! 232: - copySelectionAsPSToStream:(NXStream *)stream; ! 233: - copySelectionAsTIFFToStream:(NXStream *)stream; ! 234: - copySelectionToStream:(NXStream *)stream; ! 235: ! 236: - copyToPasteboard:(Pasteboard *)pboard types:(NXAtom *)types; ! 237: - copyToPasteboard:(Pasteboard *)pboard; ! 238: - (BOOL)pasteForeignDataFromPasteboard:(Pasteboard *)pboard andLink:(LinkType)doLink at:(const NXPoint *)point; ! 239: - pasteFromPasteboard:(Pasteboard *)pboard andLink:(LinkType)doLink at:(const NXPoint *)point; ! 240: - paste:sender andLink:(LinkType)doLink; ! 241: - cut:sender; ! 242: - copy:sender; ! 243: - paste:sender; ! 244: - pasteAndLink:sender; ! 245: ! 246: @end ! 247: ! 248: /* Data link methods */ ! 249: ! 250: @interface GraphicView(Links) ! 251: ! 252: - (NXSelection *)currentSelection; ! 253: - (Graphic *)findGraphicInSelection:(NXSelection *)selection; ! 254: - (List *)findGraphicsInSelection:(NXSelection *)selection; ! 255: ! 256: - writeLinkToPasteboard:(Pasteboard *)pboard types:(const NXAtom *)typesList; ! 257: - (BOOL)addLink:(NXDataLink *)link toGraphic:(Graphic *)graphic at:(const NXPoint *)p update:(int)update; ! 258: ! 259: - pasteFromPasteboard:(Pasteboard *)pboard at:(NXSelection *)selection; ! 260: - importFile:(const char *)filename at:(NXSelection *)selection; ! 261: - pasteboard:(Pasteboard *)sender provideData:(const char *)type; ! 262: - copyToPasteboard:(Pasteboard *)pboard at:(NXSelection *)selection cheapCopyAllowed:(BOOL)cheapCopyAllowed; ! 263: ! 264: - updateLinksPanel; ! 265: - (NXDataLinkManager *)linkManager; ! 266: - setLinkManager:(NXDataLinkManager *)linkManager; ! 267: - showSelection:(NXSelection *)selection; ! 268: - breakLinkAndRedrawOutlines:(NXDataLink *)aLink; ! 269: - updateTrackedLinks:(const NXRect *)rect; ! 270: - startTrackingLink:(NXDataLink *)link; ! 271: - stopTrackingLink:(NXDataLink *)link; ! 272: ! 273: @end ! 274: ! 275: /* Dragging */ ! 276: ! 277: @interface GraphicView(Drag) ! 278: ! 279: - registerForDragging; ! 280: - (NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender; ! 281: - (NXDragOperation)draggingUpdated:(id <NXDraggingInfo>)sender; ! 282: - (BOOL)performDragOperation:(id <NXDraggingInfo>)sender; ! 283: ! 284: @end ! 285: ! 286: /* Services Menu */ ! 287: ! 288: @interface GraphicView(Services) ! 289: ! 290: - validRequestorForSendType:(NXAtom)sendType andReturnType:(NXAtom)returnType; ! 291: - (BOOL)writeSelectionToPasteboard:(Pasteboard *)pboard types:(NXAtom *)types; ! 292: - readSelectionFromPasteboard:(Pasteboard *)pboard; ! 293: ! 294: @end ! 295: ! 296: /* ! 297: * Since we can't be sure that we have an InspectorPanel, we use the ! 298: * objective-C respondsTo: mechanism to see if we can send the message ! 299: * initializeGraphic: to [NXApp inspectorPanel]. This dummy interface ! 300: * declaration declares those messages (so that even if they don't exists, ! 301: * we can at least use them to check with respondsTo:). We don't want ! 302: * to import DrawApp.h or InspectorPanel.h since we might accidentally ! 303: * introduce a dependency on them which wouldn't be caught because we ! 304: * imported both of their interfaces. ! 305: */ ! 306: ! 307: @interface PossibleInspectorPanel : Object ! 308: ! 309: - inspectorPanel; ! 310: - initializeGraphic:(Graphic *)graphic; ! 311: ! 312: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.