Changeset 14632
- Timestamp:
- 12/26/2005 08:20:33 PM (3 years ago)
- Files:
-
- trunk/Plugins/Emoticons/AIEmoticonPack.h (modified) (1 diff)
- trunk/Plugins/Emoticons/AIEmoticonPack.m (modified) (2 diffs)
- trunk/Source/AIAppearancePreferences.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Plugins/Emoticons/AIEmoticonPack.h
r10785 r14632 27 27 - (void)setDisabledEmoticons:(NSArray *)inArray; 28 28 - (NSArray *)emoticons; 29 - (NSImage *)menuPreviewImage; 29 30 - (NSString *)name; 30 31 - (NSString *)path; trunk/Plugins/Emoticons/AIEmoticonPack.m
r13813 r14632 19 19 #import "AIEmoticonController.h" 20 20 #import <AIUtilities/AIFileManagerAdditions.h> 21 #import <AIUtilities/AIImageAdditions.h> 21 22 22 23 #define EMOTICON_PATH_EXTENSION @"emoticon" … … 112 113 if (!emoticonArray) [self loadEmoticons]; 113 114 return emoticonArray; 115 } 116 117 /* 118 * @brief Return the preview image to use within a menu for this emoticon 119 * 120 * It tries to be the emoticon for text equivalent :) or :-). Failing that, any emoticon will do. 121 */ 122 - (NSImage *)menuPreviewImage 123 { 124 NSArray *myEmoticons = [self emoticons]; 125 NSEnumerator *enumerator; 126 AIEmoticon *emoticon; 127 128 enumerator = [myEmoticons objectEnumerator]; 129 while ((emoticon = [enumerator nextObject])) { 130 NSArray *equivalents = [emoticon textEquivalents]; 131 if ([equivalents containsObject:@":)"] || [equivalents containsObject:@":-)"]) { 132 break; 133 } 134 } 135 136 //If we didn't find a happy emoticon, use the first one in the array 137 if (!emoticon && [myEmoticons count]) { 138 emoticon = [myEmoticons objectAtIndex:0]; 139 } 140 141 return [[emoticon image] imageByScalingToSize:NSMakeSize(16,16)]; 114 142 } 115 143 trunk/Source/AIAppearancePreferences.m
r14423 r14632 386 386 //Divider 387 387 [menu addItem:[NSMenuItem separatorItem]]; 388 388 389 389 //Emoticon Packs 390 390 while ((pack = [enumerator nextObject])) { … … 394 394 keyEquivalent:@""] autorelease]; 395 395 [menuItem setRepresentedObject:pack]; 396 [menuItem setImage:[ [[[pack emoticons] objectAtIndex:0] image] imageByScalingToSize:NSMakeSize(16,16)]];396 [menuItem setImage:[pack menuPreviewImage]]; 397 397 [menu addItem:menuItem]; 398 398 } 399 400 399 401 400 return [menu autorelease]; 402 401 }