Re: Cocoa Text System - Temporarily Disabling Layout
Re: Cocoa Text System - Temporarily Disabling Layout
- Subject: Re: Cocoa Text System - Temporarily Disabling Layout
- From: Jonathan Dann <email@hidden>
- Date: Sun, 26 Sep 2010 14:08:04 +0200
On 25 Sep 2010, at 01:23, Douglas Davidson wrote:
>
> On Sep 23, 2010, at 7:54 AM, Jonathan Dann wrote:
>
>> In our app, Kaleidoscope, I have 2 text views side-by-side. In one configuration the layout of the text in each text view is dependent both on regions of layout in the "sibling" text view, and the model objects which represent the the insert, equal and deleted regions of the diff.
>>
>> The problem I've had to continuously hack around is that NSTextView, in conjunction with NSLayoutManager, is rather eager to get the text to re-layout. For example, when I resize the window and need to adjust the frames of both scroll views, calling -[NSTextView setFrame:] results in the layout manager invalidating and ensuring layout for the newly visible character range.
>>
>> I'd like to know if anybody has had any experience/luck with completely disabling the automatic layout that the text system does in response to these changes in state?
>
> You can look at the source to TextEdit for an example of removing the layout manager(s) from the text storage and then re-adding them, to prevent layout from occurring for a certain period. This would probably not be appropriate if you want to retain any layout information across this transition, but if all the text needs to be laid out again anyway, it could be useful.
>
> Douglas Davidson
Thanks Douglas,
This sounds really promising, I'll have a go this week :)
I really appreciate your input.
Jonathan
(Reposted as I forgot to hit reply-all, sorry.)_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden