Mercurial > dwindows
changeset 866:ba9d38b8d0bc
Added code to check the image size inside the cell during optimize.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 03 Apr 2011 19:09:48 +0000 |
parents | 379b7e8c5c1c |
children | 139acecd6ca0 |
files | mac/dw.m |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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;