Re: Finder like wrapping + truncation

2008-11-01 Thread Mudi Dandan
OK, I have spent the last night by digging into the cocoa text system and this is what I could come up with. I'm sure this is not the best way to do it, but the result is very close to what I want to achieve. Basically I use the NSLayoutmanager to find how it would lay out the first line of t

Re: Finder like wrapping + truncation

2008-10-31 Thread Adam R. Maxwell
On Oct 31, 2008, at 7:53 PM, Mudi Dandan wrote: I just found this in the release notes: "The Cocoa Text System now allows the last visible line to have an ellipsis character appended if the entire content cannot fit into the specified bounding box. The behavior can be controlled with - tr

Re: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan
I just found this in the release notes: "The Cocoa Text System now allows the last visible line to have an ellipsis character appended if the entire content cannot fit into the specified bounding box. The behavior can be controlled with - truncatesLastVisibleLine for text cells. The -lineBre

Re: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan
Sure I did. Seems that NSLineBreakByTruncatingMiddle in the NSParagraphStyle overrides NSStringDrawingTruncatesLastVisibleLine. Anyway, I think I can live with that :) On Nov 1, 2008, at 3:32 AM, Adam R. Maxwell wrote: On Oct 31, 2008, at 7:20 PM, Mudi Dandan wrote: Thanks Adam, works gra

Re: Finder like wrapping + truncation

2008-10-31 Thread Adam R. Maxwell
On Oct 31, 2008, at 7:20 PM, Mudi Dandan wrote: Thanks Adam, works grate! There is only one little flaw that it always truncates the tail and I don't see a way to change this. Did you try setting NSLineBreakByTruncatingMiddle on your NSParagraphStyle? I don't recall trying that with NS

Re: Finder like wrapping + truncation

2008-10-31 Thread Mudi Dandan
Thanks Adam, works grate! There is only one little flaw that it always truncates the tail and I don't see a way to change this. On Nov 1, 2008, at 2:50 AM, Adam R. Maxwell wrote: On Oct 31, 2008, at 6:39 PM, Mudi Dandan wrote: Hi, I'm needing a hand with this. I'm trying to emulate the w

Re: Finder like wrapping + truncation

2008-10-31 Thread Adam R. Maxwell
On Oct 31, 2008, at 6:39 PM, Mudi Dandan wrote: Hi, I'm needing a hand with this. I'm trying to emulate the wrapping and truncation for icon labels in Finder's icon view. My first question is: is there any method around for making a string to line wrap, and to truncate the second line if