how to schedule NSLayoutManager
how to schedule NSLayoutManager
- Subject: how to schedule NSLayoutManager
- From: John Brownlow <email@hidden>
- Date: Fri, 8 Apr 2005 16:47:47 -0400
I have a multiple page view architecturally not unlike that in
TextEdit's page wrap mode. It has a multitude of textView/textContainer
instances all managed by a single NSLayoutManager and accessing the
same NSTextStorage. Works fine.
However, my documents can be very long, and laying them out is quite
computationally intensive since I have to handle a plethora of rules
about where pages can break and so on. As a result, when
NSLayoutManager is operating in its background layout mode, it is quite
easy for the user to type ahead of the layout by holding down the
'return' key, for example. In these circumstances the layoutManager
(which may be trying to lay out > 100 pages) seems to get very confused
about what's been laid out and what hasn't, and I have to force layout
again to make everything shipshape.
It seems to me that the best approach to take here would be to force
the user to wait after a keypress that triggers layout until the
NSLayoutManager has laid out at least the text that is visible to the
user, which might be to the bottom of the page or, when zoomed out, the
next four or five pages. At that point the NSLayoutManager can go back
into its lazy background mode and play catch-up.
Two questions
1. Does anyone have experience of this or similar situations and can
tell me if this is a sensible approach?
2. How does one 'force' the layout manager to do immediate layout, as
opposed to doing it opportunistically when the runloop is idle?
I can see that multi-threading is a possibility here but I am finding
the learning curve steep enough already...
--
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