comparison mac/dw.m @ 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 ca01c7d95b80
children 139acecd6ca0
comparison
equal deleted inserted replaced
865:379b7e8c5c1c 866:ba9d38b8d0bc
1282 1282
1283 for(x=0;x<rowcount;x++) 1283 for(x=0;x<rowcount;x++)
1284 { 1284 {
1285 NSCell *cell = [self preparedCellAtColumn:z row:x]; 1285 NSCell *cell = [self preparedCellAtColumn:z row:x];
1286 int thiswidth = [cell cellSize].width; 1286 int thiswidth = [cell cellSize].width;
1287
1288 /* Check the image inside the cell to get its width */
1289 if([cell isMemberOfClass:[NSImageCell class]])
1290 {
1291 int index = (int)(x * [tvcols count]) + z;
1292 NSImage *image = [data objectAtIndex:index];
1293 if([image isMemberOfClass:[NSImage class]])
1294 {
1295 thiswidth = [image size].width;
1296 }
1297 }
1287 1298
1288 if(thiswidth > width) 1299 if(thiswidth > width)
1289 { 1300 {
1290 width = thiswidth; 1301 width = thiswidth;
1291 } 1302 }
1292 } 1303 }
1293 /* TODO: Figure out why calculating the cell width does not work for 1304 /* If the image is missing default the optimized width to 16. */
1294 * image cell types. In the meantime default the optimized width to 16.
1295 */
1296 if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON) 1305 if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON)
1297 { 1306 {
1298 width = 16; 1307 width = 16;
1299 } 1308 }
1300 /* Sanity check... don't set the width to 0 */ 1309 /* Sanity check... don't set the width to 0 */