NSRunLoop/NSLayoutManager
NSRunLoop/NSLayoutManager
- Subject: NSRunLoop/NSLayoutManager
- From: Johnny Deadman <email@hidden>
- Date: Mon, 2 May 2005 08:59:54 -0400
Hi -- input on this needed!
I have a vanilla NSLayoutManager which manages a series of
NSTextContainers and associated NSTextViews. This is in turn managed
by my own GLPageLayoutManager which creates and manages the pages in
the document and feeds them to or trims them from the NSLayoutManager
as necessary.
The GLPageLayoutManager listens for notifications from
NSLayoutManager that it has finished laying out the glyphs for a
particular text container and, if this is the last container, checks
if all the text has been laid out. If not it adds a new container.
The problem here is that on a long (>100 page) document, this causes
significant interruptions in the processing of keyboard events. Since
most all screenplays are > 100 pages this is a problem!
What I want to do, among other things, is have a timer which checks
how long the NSRunLoop has been idle and waits for a prescribed
interval (of the order of 0.5- 1 sec) before firing off
NSLayoutManager and letting it do background layout. However it's not
clear to me how to do this. Subclassing NSRunLoop looks like a
terrible idea. Is the best practice here to have a method in one of
my controllers something like:
- performBackgroundLayoutAfterDelay
... and then have the runloop send this selector when it is idle? Or
is there something cunning I can do with NSTimer?
--
John Brownlow
Deep Fried Films, Inc
http://www.johnbrownlow.com
http://www.pinkheadedbug.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden