Adium

Changeset 14632

Show
Ignore:
Timestamp:
12/26/2005 08:20:33 PM (3 years ago)
Author:
evands
Message:
  • Added -[AIEmoticonPack menuPreviewImage] which returns the image to use for a menu preview of the emoticon pack, preferring an emoticon whose text equivalent is :) or :-) and falling back on the first emoticon if necessary.
  • Used a two prong approach to fix #2522:
    • Made use of the new method for the appearance preferences to make the emoticon menu much happier.
    • Used the prescription privileges I don't have yet to write a Fluoxetine prescription for the menu.

Fixes #2522. :)


Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Emoticons/AIEmoticonPack.h

    r10785 r14632  
    2727- (void)setDisabledEmoticons:(NSArray *)inArray; 
    2828- (NSArray *)emoticons; 
     29- (NSImage *)menuPreviewImage; 
    2930- (NSString *)name; 
    3031- (NSString *)path; 
  • trunk/Plugins/Emoticons/AIEmoticonPack.m

    r13813 r14632  
    1919#import "AIEmoticonController.h" 
    2020#import <AIUtilities/AIFileManagerAdditions.h> 
     21#import <AIUtilities/AIImageAdditions.h> 
    2122 
    2223#define EMOTICON_PATH_EXTENSION                 @"emoticon" 
     
    112113        if (!emoticonArray) [self loadEmoticons]; 
    113114        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)]; 
    114142} 
    115143 
  • trunk/Source/AIAppearancePreferences.m

    r14423 r14632  
    386386        //Divider 
    387387        [menu addItem:[NSMenuItem separatorItem]]; 
    388          
     388 
    389389        //Emoticon Packs 
    390390        while ((pack = [enumerator nextObject])) { 
     
    394394                                                                                                                                  keyEquivalent:@""] autorelease]; 
    395395                [menuItem setRepresentedObject:pack]; 
    396                 [menuItem setImage:[[[[pack emoticons] objectAtIndex:0] image] imageByScalingToSize:NSMakeSize(16,16)]]; 
     396                [menuItem setImage:[pack menuPreviewImage]]; 
    397397                [menu addItem:menuItem]; 
    398398        } 
    399          
    400          
     399 
    401400        return [menu autorelease]; 
    402401}