Thread View: comp.sys.next.programmer
2 messages
2 total messages
Started by Robert D. Nicholson
Sat, 15 Aug 1992 02:33
Tracking the currentdocument
Author: 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.
Re: Tracking the currentdocument
Author: Chris Lloyd
Date: Sat, 15 Aug 1992 04:48
Date: Sat, 15 Aug 1992 04:48
56 lines
2326 bytes
2326 bytes
In article <1992Aug15.023340.28812@monu6.cc.monash.edu.au> ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson) writes:
>- drawSelf:(NXRect *)rects :(int)count
>{
>
> Room *highlightedRoom;
>
Get rid of this erase, it's pointless since you do a composite with COPY
right after it which just blasts over the fill.
> /* 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];
>
This doesn't make sense, you want to draw for THIS window (the one the view
is in), not the current document window. If you have one document, the current
document will be this window, if you dont, you want to draw for the window this
document/view is IN, not the current one.
> highlightedRoom = [[NXApp currentDocument] currentHighlightedRoom];
highlightedRoom = [[window delegate] currentHighlightedRoom];
No need to bother with the check's currentDocument do.
> if (highlightedRoom) {
> NXRect intersectRect;
> NXRect *intersects;
>
> [highlightedRoom scaledRoomRect:&intersectRect];
> intersects = NXIntersectionRect(&rects[0],&intersectRect);
> if (intersects) {
> NXHighlightRect(&intersectRect);
> }
> }
>
> return self;
>}
>
[...]
>What are the common uses of windowDidResignKey and windowDidResignMain when
>applied to apps that have global inspectors.
Disabling/enabling items and updating fields in the inspector to reflect
the current document/window or lack thereof.
la la la,
--
:: Christopher Lloyd :: a74k110@titan.ucc.umass.edu :: Yrrid, Inc. ::
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads