Re: Text system glitch - lines across text view
Re: Text system glitch - lines across text view
- Subject: Re: Text system glitch - lines across text view
- From: Ross Carter <email@hidden>
- Date: Wed, 28 Dec 2011 11:07:07 -0500
On Dec 25, 2011, at 4:22 PM, Andrew Hughes wrote:
> NSTextView > NSTextContainer
> NSTextView > NSTextContainer > NSTextStorage
> NSTextView > NSTextContainer
>
> NSView -> NSTextView > NSTextContainer
> NSTextView > NSTextContainer > NSTextStorage
>
> NSTextView > NSTextContainer
> NSTextView > NSTextContainer > NSTextStorage
> NSTextView > NSTextContainer
> NSTextView > NSTextContainer
> NSTextView > NSTextContainer
>
> The list of visible NSTextViews needed can get quite large, so as an
> optimization the pagination algorithm starts at the currently being edited
> NSTextStorage-Container-View and does that in the foreground before laying
> out the rest of the system on a separate thread in the background (they are
> hidden while being pushed to a separate thread).
Andrew, since nobody else has chimed in, I'll offer a couple of thoughts although I have no idea what the precise problem is.
Your description of the layout hierarchy is incomplete and, as I interpret it, incorrect. You neglect the NSLayoutManager, which is the object that actually draws the text when the NSTextView -drawRect: method fires. Because you have an issue with text drawing, I think you need to know exactly what is happening with your layout managers. Layout managers are a bit on the heavy side as text objects go. Do you have a separate layout manager for every text view? Or a single layout manager for each NSTextStorage?
Text containers have no relationship with NSTextStorage (your diagram shows a NSTextContainer positioned between a NSTextView and a NSTextStorage). They must be associated with a NSLayoutManager and optionally (usually) with a NSTextView.
Your diagram makes me think that you have multiple textView/textContainer pairs associated with a single NSTextStorage. If that is correct, did you add those text containers to the NSLayoutManager and allow it to handle flowing the text through the containers?
Finally, did you turn off background layout for each layout manager while it is being used on the background thread, and did you wrap messages that might affect layout in -performSelector:withObject:afterDelay:?
_______________________________________________
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