adium 3030:0c299ebf38cf: Indicate the currently selected dock ic...

commits at adium.im commits at adium.im
Tue Dec 8 04:21:50 UTC 2009


details:	http://hg.adium.im/adium/rev/0c299ebf38cf
revision:	3030:0c299ebf38cf
author:		Evan Schoenberg
date:		Mon Dec 07 22:19:12 2009 -0600

Indicate the currently selected dock icon when showing all dock icons via the Appearance preferences
Subject: adium 3031:06259ef49a44: Properly update the displayed dock icon in the Appearance preferences if it is changed via the show all dock icons sheet before the menu was clicked (and therefore built)

details:	http://hg.adium.im/adium/rev/06259ef49a44
revision:	3031:06259ef49a44
author:		Evan Schoenberg
date:		Mon Dec 07 22:20:19 2009 -0600

Properly update the displayed dock icon in the Appearance preferences if it is changed via the show all dock icons sheet before the menu was clicked (and therefore built)
Subject: adium 3032:b11b147bd3db: Patch from Luca Motta ('''lucamot''') which fixes dock icons with overlays randomly displaying as flipped upside down in the dock icon preview sheet. Thanks! The bug has existed as long as Adium has. Fixes #2812

details:	http://hg.adium.im/adium/rev/b11b147bd3db
revision:	3032:b11b147bd3db
author:		Evan Schoenberg
date:		Mon Dec 07 22:24:50 2009 -0600

Patch from Luca Motta ('''lucamot''') which fixes dock icons with overlays randomly displaying as flipped upside down in the dock icon preview sheet. Thanks! The bug has existed as long as Adium has. Fixes #2812
Subject: adium 3033:03fbcb47ee5f: Added Luca Motta to the copyright file

details:	http://hg.adium.im/adium/rev/03fbcb47ee5f
revision:	3033:03fbcb47ee5f
author:		Evan Schoenberg
date:		Mon Dec 07 22:25:17 2009 -0600

Added Luca Motta to the copyright file

diffs (190 lines):

diff -r e4e3fa69d524 -r 03fbcb47ee5f Copyright.txt
--- a/Copyright.txt	Mon Dec 07 08:09:18 2009 -0800
+++ b/Copyright.txt	Mon Dec 07 22:25:17 2009 -0600
@@ -48,6 +48,7 @@
 Sam McCandlish
 Nicola Del Monaco
 Yan Morissette
+Luca Motta
 Jeffrey Melloy
 David Munch
 Roeland Nas
diff -r e4e3fa69d524 -r 03fbcb47ee5f Frameworks/AIUtilities Framework/Source/AIScaledImageCell.m
--- a/Frameworks/AIUtilities Framework/Source/AIScaledImageCell.m	Mon Dec 07 08:09:18 2009 -0800
+++ b/Frameworks/AIUtilities Framework/Source/AIScaledImageCell.m	Mon Dec 07 22:25:17 2009 -0600
@@ -36,9 +36,6 @@
 	NSImage	*img = [self image];
 	
 	if (img) {
-		//Handle flipped axis
-		[img setFlipped:![img isFlipped]];
-		
 		//Size and location
 		//Get image metrics
 		NSSize	imgSize = [img size];
@@ -76,14 +73,27 @@
 		//Centering
 		targetRect = NSOffsetRect(targetRect, round((cellFrame.size.width - targetRect.size.width) / 2), round((cellFrame.size.height - targetRect.size.height) / 2));
 		
+		//Flip & reposition image
+		[NSGraphicsContext saveGraphicsState];
+		
+		long cellPosition = floor(cellFrame.origin.y / cellFrame.size.height) + 1;
+		long yOffset = fmodl(cellFrame.origin.y, cellFrame.size.height);
+		
+		NSAffineTransform *xform = [NSAffineTransform transform];
+		[xform translateXBy: 0.f yBy: cellPosition * cellFrame.size.height + yOffset];
+		[xform scaleXBy: 1.f yBy: -1.f];
+		[xform concat];
+		
+		//y offset already handled by translation
+		targetRect.origin.y = 0.f;
+		
 		//Draw Image
 		[img drawInRect:targetRect
 			   fromRect:imgRect
 			  operation:NSCompositeSourceOver 
 			   fraction:([self isEnabled] ? 1.0 : 0.5)];
 		
-		//Clean-up
-		[img setFlipped:![img isFlipped]];
+		[NSGraphicsContext restoreGraphicsState];				
 	}
 }
 
diff -r e4e3fa69d524 -r 03fbcb47ee5f Source/AIAppearancePreferences.m
--- a/Source/AIAppearancePreferences.m	Mon Dec 07 08:09:18 2009 -0800
+++ b/Source/AIAppearancePreferences.m	Mon Dec 07 22:25:17 2009 -0600
@@ -118,7 +118,9 @@
 	NSString *filenameExtension = [notification object];
 
 	//Convert our filename extension into a Uniform Type Identifier so that we can robustly determine what type of Xtra this is.
-	CFStringRef type = (CFStringRef)[(NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)filenameExtension, /*inConformingToUTI*/ NULL) autorelease];
+	CFStringRef type = (CFStringRef)[(NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, 
+																					   (CFStringRef)filenameExtension,
+																					   /*inConformingToUTI*/ NULL) autorelease];
 
 	if (!type || UTTypeEqual(type, CFSTR("com.adiumx.emoticonset"))) {
 		[self _rebuildEmoticonMenuAndSelectActivePack];
@@ -258,7 +260,11 @@
 			[popUp_colorTheme selectItemWithRepresentedObject:[prefDict objectForKey:KEY_LIST_THEME_NAME]];	
 		}	
 		if (firstTime || [key isEqualToString:KEY_ACTIVE_DOCK_ICON]) {
-			[popUp_dockIcon selectItemWithRepresentedObject:[prefDict objectForKey:KEY_ACTIVE_DOCK_ICON]];
+			/* popUp_dockIcon initially is a single-item popup menu with just the active icon; it is built
+			 * lazily in menuNeedsUpdate:.  If we haven't displayed it yet, we'll need to configure again
+			 * to show just the current icon */
+			if (![popUp_dockIcon selectItemWithRepresentedObject:[prefDict objectForKey:KEY_ACTIVE_DOCK_ICON]])
+				[self configureDockIconMenu];
 		}
 	}
 }
diff -r e4e3fa69d524 -r 03fbcb47ee5f Source/AIContactListRecentImagesWindowController.m
--- a/Source/AIContactListRecentImagesWindowController.m	Mon Dec 07 08:09:18 2009 -0800
+++ b/Source/AIContactListRecentImagesWindowController.m	Mon Dec 07 22:25:17 2009 -0600
@@ -138,7 +138,6 @@
 		NSBezierPath *fullPath = [NSBezierPath bezierPathWithRect:NSMakeRect(0, 0, size.width, size.height)];
 		displayImage = [image copy];
 		
-		[displayImage setFlipped:YES];
 		[displayImage lockFocus];
 		
 		if (index == currentHoveredIndex) {
diff -r e4e3fa69d524 -r 03fbcb47ee5f Source/AIDockIconSelectionSheet.m
--- a/Source/AIDockIconSelectionSheet.m	Mon Dec 07 08:09:18 2009 -0800
+++ b/Source/AIDockIconSelectionSheet.m	Mon Dec 07 22:25:17 2009 -0600
@@ -19,6 +19,8 @@
 #import "AIAppearancePreferencesPlugin.h"
 #import <AIUtilities/AIFileManagerAdditions.h>
 #import <AIUtilities/AIImageGridView.h>
+#import <AIUtilities/AIBezierPathAdditions.h>
+#import <AIUtilities/AIGradientAdditions.h>
 #import <Adium/AIIconState.h>
 
 #define PREF_GROUP_DOCK_ICON		@"Dock Icon"
@@ -120,49 +122,8 @@
 	}
 }
 
-
-
-
-
 //Build an array of available icon packs
 
-
-
-//- (void)_buildIconArray
-//{
-//    NSDirectoryEnumerator	*fileEnumerator;
-//    NSString				*iconPath;
-//    NSString				*filePath;
-//	NSEnumerator			*enumerator;
-//
-//    //Create a fresh icon array
-//    [iconArray release]; iconArray = [[NSMutableArray alloc] init];
-//	enumerator = [[adium resourcePathsForName:FOLDER_DOCK_ICONS] objectEnumerator];
-//	
-//    while ((iconPath = [enumerator nextObject])) {            
-//        fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:iconPath];
-//        
-//        //Find all the .AdiumIcon's
-//        while ((filePath = [fileEnumerator nextObject])) {
-//            if ([[filePath pathExtension] caseInsensitiveCompare:@"AdiumIcon"] == NSOrderedSame) {
-//                NSString		*fullPath;
-//                AIIconState		*previewState;
-//                
-//                //Get the icon pack's full path and preview state
-//                fullPath = [iconPath stringByAppendingPathComponent:filePath];
-//				previewState = [adium.dockController previewStateForIconPackAtPath:fullPath];
-//    
-//                //Add this icon to our icon array
-//                [iconArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:fullPath, @"Path", previewState, @"State", previewState, @"Original State", nil]];    
-//			}
-//        }
-//    }
-//    
-//    //Update our view and re-select the correct icon
-//	[imageGridView_icons reloadData];
-//	[self selectIconWithName:[adium.preferenceController preferenceForKey:KEY_ACTIVE_DOCK_ICON group:PREF_GROUP_APPEARANCE]];
-//}
-
 //Set the selected icon by name
 - (void)selectIconWithName:(NSString *)selectName
 {
@@ -238,13 +199,30 @@
 	return [iconArray count];
 }
 
-- (NSImage *)imageGridView:(AIImageGridView *)imageGridView imageAtIndex:(NSUInteger)index
+- (NSImage *)imageGridView:(AIImageGridView *)imageGridView imageAtIndex:(NSUInteger)inIndex
 {
-	if (index == animatedIndex) {
-		return [animatedIconState image];
-	} else {
-		return [[[iconArray objectAtIndex:index] objectForKey:@"State"] image];
+	NSImage *image  = ((inIndex == animatedIndex) ?
+					   animatedIconState.image :
+					   [[[iconArray objectAtIndex:inIndex] objectForKey:@"State"] image]);
+
+	if (inIndex == imageGridView_icons.selectedIndex) {
+		NSSize size = image.size;
+		NSRect fullRect = NSMakeRect(0, 0, size.width, size.height);
+		NSImage *selectedImage = [[NSImage alloc] initWithSize:size];
+		[selectedImage lockFocus];
+		NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:fullRect
+															  radius:6.0];
+		[[NSGradient selectedControlGradient] drawInBezierPath:path angle:90];
+		[image drawInRect:fullRect
+				 fromRect:fullRect
+				operation:NSCompositeSourceOver
+				 fraction:0.9];
+		[selectedImage unlockFocus];
+		
+		image = [selectedImage autorelease];
 	}
+
+	return image;
 }
 
 - (void)imageGridViewSelectionDidChange:(NSNotification *)notification




More information about the commits mailing list