# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1336253570 0 # Node ID cc10082567edd4bcd58596b4597d8523c342e074 # Parent 0b1be0a99f59ece27bbccf7744e24f7d0cef9272 Similar code for Mac to keep HICNs from getting too big. diff -r 0b1be0a99f59 -r cc10082567ed mac/dw.m --- a/mac/dw.m Sat May 05 21:21:49 2012 +0000 +++ b/mac/dw.m Sat May 05 21:32:50 2012 +0000 @@ -6816,6 +6816,20 @@ DW_LOCAL_POOL_OUT; } +/* Internal function to keep HICNs from getting too big */ +void _icon_resize(NSImage *image) +{ + NSSize size = [image size]; + if(size.width > 24 || size.height > 24) + { + if(size.width > 24) + size.width = 24; + if(size.height > 24) + size.height = 24; + [image setSize:size]; + } +} + /* * Obtains an icon from a module (or header in GTK). * Parameters: @@ -6830,6 +6844,7 @@ NSString *respath = [bundle resourcePath]; NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; + _icon_resize(image); return image; } @@ -6851,6 +6866,7 @@ nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; image = [[NSImage alloc] initWithContentsOfFile:nstr]; } + _icon_resize(image); return image; } @@ -6865,6 +6881,7 @@ { NSData *thisdata = [NSData dataWithBytes:data length:len]; NSImage *image = [[NSImage alloc] initWithData:thisdata]; + _icon_resize(image); return image; }