home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / next / programm / 5624 < prev    next >
Encoding:
Text File  |  1992-08-14  |  2.5 KB  |  67 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!ede978e
  3. From: ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson)
  4. Subject: Tracking the currentdocument
  5. Message-ID: <1992Aug15.023340.28812@monu6.cc.monash.edu.au>
  6. Summary: Tracking the currentdocument
  7. Organization: Monash University, Caulfield Campus
  8. Date: Sat, 15 Aug 1992 02:33:40 GMT
  9. Lines: 56
  10.  
  11. This is topic that I have grown to be very interested in in recent times.
  12.  
  13. How do most developers go about tracking their currentDocument in multidoc apps.
  14.  
  15. I am currently using draw's approach using mainWindow. (Note to scott, Im interested in seeing what people have to say about this)  This assumes that you
  16. have a window.  I have the following problem with an app Im writing using this
  17. approach.
  18.  
  19. I have a subview of my document window's contentView  which condionally does an
  20. NXHightlight rect in its drawSelf. The drawSelf is executed first when I send
  21. my window makeKeyAndOrderFront.  The thing it highlights is the currentDocument's currently highLightedroom.
  22.  
  23. Code follows.
  24.  
  25. - drawSelf:(NXRect *)rects :(int)count
  26. {
  27.  
  28.     Room *highlightedRoom;
  29.         
  30.   /* erase update rect since the nximage might be smaller than our bounds */
  31.  
  32.     PSsetgray(NX_WHITE);
  33.     NXRectFill(&rects[0]);
  34.             
  35.     [image composite:NX_COPY
  36.               fromRect:&rects[0]
  37.               toPoint:&rects[0].origin];
  38.                 
  39.     highlightedRoom = [[NXApp currentDocument] currentHighlightedRoom];
  40.     if (highlightedRoom) {
  41.         NXRect intersectRect;
  42.         NXRect *intersects;
  43.                                 
  44.         [highlightedRoom scaledRoomRect:&intersectRect];
  45.         intersects = NXIntersectionRect(&rects[0],&intersectRect);
  46.         if (intersects) {
  47.             NXHighlightRect(&intersectRect);
  48.         }
  49.     }
  50.        
  51.     return self;
  52. }
  53.  
  54. OK, this is here so I can preserve the highlighting when I scroll the view aroun
  55. d otherwise it would get completely redrawn and overwrite my highlighting.  I as
  56. sume you follow this.
  57.  
  58. Now, the problem occurs when I create a new document using new: since when its t
  59. ime to send the window makeKeyAndOrderFront it will send my view a display the p
  60. roblem is that the currentDocument at this time is still the old one.  Thus I will get the same highlighted area from my previous document highlighted in my new one.
  61.  
  62. Hope this is clear.  You see I need my window to appear in NXApps windowList bef
  63. ore it sends a drawSelf. ???
  64.  
  65. What are the common uses of windowDidResignKey and windowDidResignMain when applied to apps that have global inspectors.
  66.  
  67.