This is eText.eTDoc.m in view mode; [Download] [Up]
{\rtf0\ansi{\fonttbl\f0\fmodern Courier;\f1\ftech Symbol;\f2\fmodern Ohlfs;} \margl40 \margr40 \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f0\b0\i0\ulnone\fs24\fc0\cf0 //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \i \b FILENAME \b0 : \b\i0 eText.eTDoc.m\ \b0 // \i \b SUMMARY \b0 : \b\i0 Implementation of interactions between eText and eTDoc \b0 \ // \b\i CATEGORY \b0 : \i0 \b eTDoc \b0 \ // \b\i PROTOCOLS \b0 : \i0 \b None \b0 \ // \b\i INTERFACE \b0 : \i0 \b None \b0 \ // \b\i AUTHOR \b0 : \b\i0 Rohit Khare \b0 \ // \b\i COPYRIGHT \b0 : \f1\i0 Ó \f0\b 1993,94 California Institure of Technology, eText Project\ \b0 //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b\i Implementation Comments \b0\i0 \ // undoManager is little more than a "local cache".\ // Dragging out an etfLink is only in the margin-- cross-ref this to\ // code in Pasteboard that checks it when dropping files. This prevents the\ // click-and-drop scenario.\ // Dragging out should lazily create the dragged .etfLink file, but...\ //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b\i History \b0\i0 \ // 10/17/94: \b Cleaned up for eText5. \b0 \ // 08/05/94: \b Completely Rearchitected for 5.0. RK \b0 \ //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b Imported Interfaces \b0 \ //\ #import " \b eText.eTDoc.h \b0 "\ \ \i @implementation eText(eTDoc)\ \i0 //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b Accessors \b0 \ //\ \ - \b setDoc \b0 :newDoc \{\ \b etDoc \b0 = \b newDoc \b0 ;\ \b undoManager \b0 = [etDoc \b undoManager \b0 ];\ [undoManager \b addUndoDelegate \b0 : \b self \b0 ];\ if ( \b ! \b0 [self \b textLength \b0 ]) \{ // \i if it's a virgin document, set the font.\ \i0 id font = [[etDoc \b docInfo \b0 ] \b tagFont \b0 : \b BODY \b0 ];\ if ([font matrix] != NX_FLIPPEDMATRIX)\ font = [Font newFont:[font name] size:[font pointSize]\ matrix:NX_FLIPPEDMATRIX];\ [self \b setFont \b0 :font];\ \}\ return self;\ \}\ - \b etDoc \b0 \{return \b etDoc \b0 ;\}\ - \b undoManager \b0 \{return \b undoManager \b0 ;\}\ - \b touch \b0 \{return [etDoc \b touch \b0 ];\}\ - \b touch \b0 :sender \{return [etDoc \b touch \b0 ];\}\ \ //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b Dragging Source (etfLink) \b0 \ //\ - ( \b NXDragOperation \b0 ) \b draggingSourceOperationMaskForLocal \b0 :( \b BOOL \b0 )isLocal \{\ return ( \b isLocal \b0 ? \b NX_DragOperationLink \b0 : \b NX_DragOperationAll \b0 );\}\ - ( \b BOOL \b0 ) \b acceptsFirstMouse \b0 \{\ return \b YES \b0 ;\}\ - ( \b BOOL \b0 ) \b shouldDelayWindowOrderingForEvent \b0 :( \b NXEvent \b0 *)e \{\ NXCoord l,r,t,b;\ [self \b getMarginLeft \b0 :&l right:&r top:&t bottom:&b]; \ return ((e->location.x < ( \b l \b0 + \b SCROLLWIDTH \b0 ))?YES:NO);\ \}\ - \b mouseDown \b0 :( \b NXEvent \b0 *)e\ \{\ NXCoord l,r,t,b;\ id \b theDocInfo \b0 = [ \b etDoc \b0 \b docInfo \b0 ];\ \ [self \b getMarginLeft \b0 :&l right:&r top:&t bottom:&b]; \ if ( \b theDocInfo \b0 &&\ \i \i0 (e->location.x < ( \b l \b0 + \b SCROLLWIDTH \b0 )))\{\ char \b path \b0 [MAXPATHLEN];\ static id \b theTable \b0 =nil; // \i static since it's allocated once and \b empty \b0 d \i0 \ NXPoint \b org \b0 ;\ NXPoint \b offset \b0 ;\ id \b dragPasteboard \b0 ;\ NXAtom theType;\ \ if (!theTable) \b theTable \b0 = [[ \b NXStringTable \b0 alloc] \b init \b0 ];\ [theTable insertKey: \b DOCID \b0 value:[ \b theDocInfo \b0 \b docIDStr \b0 ]];\ [theTable insertKey: \b ANCHORID \b0 value:" \b 0 \b0 "];\ [theTable insertKey: \b DOCTITLE \b0 value:[ \b theDocInfo \b0 \b docTitle \b0 ]];\ [theTable insertKey: \b ANCHORTITLE \b0 value:[ \b theDocInfo \b0 \b docTitle \b0 ]];\ sprintf(path, " \b /tmp/%s. \b0 " \b LINK_EXT \b0 , [ \b theDocInfo \b0 \b docTitle \b0 ]);\ [theTable \b writeToFile \b0 : \b path \b0 ];\ [theTable \b empty \b0 ];\ \ \b dragPasteboard \b0 = [Pasteboard newName: \b NXDragPboard \b0 ];\ [dragPasteboard \b declareTypes \b0 :& \b NXFileContentsPboardType \b0 \ num:1 owner:nil];\ [dragPasteboard \b writeFileContents \b0 : \b path \b0 ];\ theType = \b NXFilenamePboardType \b0 ;\ [dragPasteboard \b addTypes \b0 :&theType num:1 owner:nil];\ [dragPasteboard \b writeType \b0 :theType \b data \b0 : \b path \b0 \b length \b0 : \b strlen \b0 (path) \b +1 \b0 ];\ \ \b org \b0 = e-> \b location \b0 ;\ [self \b convertPoint \b0 :& \b org \b0 \b fromView \b0 : \b nil \b0 ];\ org.x -= 5.0; org.y += 5.0; // \i NXLinkButton is 10x10 pixels \i0 .\ offset.x = offset.y = 0.0;\ [self \b dragImage \b0 :[NXImage findImageNamed:" \b NXLinkButton \b0 "]\ \b at \b0 :&org \b offset \b0 :&offset\ \b event \b0 :e \b pasteboard \b0 :dragPasteboard\ \b source \b0 :self \b slideBack \b0 : YES]; \ return \b self \b0 ;\ \}\ return [ \b super \b0 \b mouseDown \b0 :e];\ \}\ @end }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.