# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1301857788 0 # Node ID ba9d38b8d0bc16b93e708597910dd29233549ca8 # Parent 379b7e8c5c1c5c7007f78a2c8ac998c0a199c6f8 Added code to check the image size inside the cell during optimize. diff -r 379b7e8c5c1c -r ba9d38b8d0bc mac/dw.m --- a/mac/dw.m Sun Apr 03 18:43:55 2011 +0000 +++ b/mac/dw.m Sun Apr 03 19:09:48 2011 +0000 @@ -1284,15 +1284,24 @@ { NSCell *cell = [self preparedCellAtColumn:z row:x]; int thiswidth = [cell cellSize].width; + + /* Check the image inside the cell to get its width */ + if([cell isMemberOfClass:[NSImageCell class]]) + { + int index = (int)(x * [tvcols count]) + z; + NSImage *image = [data objectAtIndex:index]; + if([image isMemberOfClass:[NSImage class]]) + { + thiswidth = [image size].width; + } + } if(thiswidth > width) { width = thiswidth; } } - /* TODO: Figure out why calculating the cell width does not work for - * image cell types. In the meantime default the optimized width to 16. - */ + /* If the image is missing default the optimized width to 16. */ if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON) { width = 16;