• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Optimizing text layout in a log view: should I subclass NSLayoutManager?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimizing text layout in a log view: should I subclass NSLayoutManager?


  • Subject: Re: Optimizing text layout in a log view: should I subclass NSLayoutManager?
  • From: "Martin" <email@hidden>
  • Date: Thu, 26 Jan 2006 15:54:50 -0800

>Clearly, when deleting whole lines at the top, the layout of the rest
>of the text does not really need to be recalculated

This is of course true, but that doesn't mean NSLayoutManager implements such an optimization. To be honest I'm surprised that it doesn't, since I've seen it optimize away other kinds of incremental changes.

>My question is: is it possible and desirable to add such an
>optimization by subclassing NSTextLayout, or in some other way?

I think subclassing NSLayoutManager to do such a thing would be hard (and potentially hazardous) work. There's no public API for doing this kind of thing, so you'd have to write some tricky overrides, call private methods, etc.

Probably the safest and easiest solution in your case is to divide your log into groups of several hundred (thousand?) lines. Each block would have its own NSLayoutManager instance. Your custom view would then draw these blocks by stacking them on top of one another. When the log becomes too full just pop the oldest block off.

The only potential problem here is user interaction. For instance, if you want to allow the user to select/copy log lines you will have issues at the block boundaries.

I hope this helps,

~Martin

 _______________________________________________
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

  • Follow-Ups:
    • Re: Optimizing text layout in a log view: should I subclass NSLayoutManager?
      • From: Camillo Lugaresi <email@hidden>
  • Prev by Date: Re: NSCursor Resize Cursor
  • Next by Date: Re: Ink
  • Previous by thread: Re: Optimizing text layout in a log view: should I subclass NSLayoutManager?
  • Next by thread: Re: Optimizing text layout in a log view: should I subclass NSLayoutManager?
  • Index(es):
    • Date
    • Thread