Article View: comp.sys.next.programmer
Article #1156Tracking the currentdocument
From: Robert D. Nicholson
Date: Sat, 15 Aug 1992 02:33
Date: Sat, 15 Aug 1992 02:33
55 lines
2664 bytes
2664 bytes
This is topic that I have grown to be very interested in in recent times.
How do most developers go about tracking their currentDocument in multidoc apps.
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
have a window. I have the following problem with an app Im writing using this
approach.
I have a subview of my document window's contentView which condionally does an
NXHightlight rect in its drawSelf. The drawSelf is executed first when I send
my window makeKeyAndOrderFront. The thing it highlights is the currentDocument's currently highLightedroom.
Code follows.
- drawSelf:(NXRect *)rects :(int)count
{
Room *highlightedRoom;
/* erase update rect since the nximage might be smaller than our bounds */
PSsetgray(NX_WHITE);
NXRectFill(&rects[0]);
[image composite:NX_COPY
fromRect:&rects[0]
toPoint:&rects[0].origin];
highlightedRoom = [[NXApp currentDocument] currentHighlightedRoom];
if (highlightedRoom) {
NXRect intersectRect;
NXRect *intersects;
[highlightedRoom scaledRoomRect:&intersectRect];
intersects = NXIntersectionRect(&rects[0],&intersectRect);
if (intersects) {
NXHighlightRect(&intersectRect);
}
}
return self;
}
OK, this is here so I can preserve the highlighting when I scroll the view aroun
d otherwise it would get completely redrawn and overwrite my highlighting. I as
sume you follow this.
Now, the problem occurs when I create a new document using new: since when its t
ime to send the window makeKeyAndOrderFront it will send my view a display the p
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.
Hope this is clear. You see I need my window to appear in NXApps windowList bef
ore it sends a drawSelf. ???
What are the common uses of windowDidResignKey and windowDidResignMain when applied to apps that have global inspectors.
Technical Details
Message-ID:
<1992Aug15.023340.28812@monu6.cc.monash.edu.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!ede978eShow Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!ede978e From: ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson) Subject: Tracking the currentdocument Message-ID: <1992Aug15.023340.28812@monu6.cc.monash.edu.au> Summary: Tracking the currentdocument Organization: Monash University, Caulfield Campus Date: Sat, 15 Aug 1992 02:33:40 GMT Lines: 56