You can share an instance of NSTextStorage and NSLayoutManager with multiple NstextContainer+NSTextViews only if you are displaying same text in all those textViews. But as in your case you will have to use a separate set of above classes for each textView, that means you cannot share the layout manager as it belongs to a single textStorage. Have a look at the following documentation to get a general idea bout the same http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/CommonConfigs.html#/ /apple_ref/doc/uid/20000840
-Chaitanya

On 19-Aug-08, at 12:46 AM, Oleg Krupnov wrote:

I am developing a custom view, sort of a simple graphic editor, where
the user can draw graphic boxes of different size. Each box should
display its own attributed string bounded by its own size, and when
the user double-clicks any box, he becomes able to edit the box's text
in-place.

I have read the docs and have a general understanding of the text
system components: NSTextStorage, NSLayoutManager, NSTextContainer and
NSTextView.

However I wonder if some instances of these can be shared across
different graphic boxes for better efficiency?

I could go the simple and dull way and create a separate instance of
NSTextView for each box, but I am afraid this could be a waste of
resources, because layout manager is costy. Also, most of time I only
need to display text in boxes, not to edit it.

I thought it could be smarter to create a single shared instance of
NSTextView per custom view, and re-attach it to different boxes when
the user double-clicks a box. The rest of time I'd use NSTextStorage
and NSTextContainer to just draw the string. Is this a good idea? In
this case, what object instances should each graphic box have of its
own? My guess is that each graphic box should have its own instances
of NSTextStorage and NSTextContainer, but I am not sure what about
NSLayoutManager? Can it be shared too, or it's going to be
inefficient? How do I reconnect the shared components from a box to
another box?

Thanks.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to