On Jan 30, 2012, at 2:22 PM, Michael Nickerson wrote:

> Hmm, I don't have an answer for you, but I looked at the code.  I did a 
> little subclassing of NSLayoutManager, and it looks like the text attachment 
> cell is just ignoring the size given to draw the image in and drawing it full 
> size.
> 
> Here's what I used:
> 
> <snip>
> 
> Add that to the top, and change the layout manager to use it, and it'll draw 
> the rect the layout manager is telling the attachment cell to draw in.
> 
> Maybe there's some sort of context related setting that's different between 
> the text view and the PDF context?

That's what I was thinking, but snooping around didn't show anything obviously 
different between contexts.

However, thanks to your snippet of code I've come up with a quick workaround:

- (void)showAttachmentCell:(NSCell *)cell inRect:(NSRect)rect 
characterIndex:(NSUInteger)attachmentIndex {
    [[cell image] setSize:rect.size];
    [super showAttachmentCell:cell inRect:rect characterIndex:attachmentIndex];
}

I'll file a bug on this as Aki suggests.  Hopefully this workaround doesn't 
cause any strange side effects.  Since the attributed string is never saved 
out, modifying the cell this way won't hurt in my case.

-gus

--  

August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to