adium 3731:ee132b70e346: Added DragAndDrop support for Changing ...

commits at adium.im commits at adium.im
Sat Mar 12 03:15:41 UTC 2011


details:	http://hg.adium.im/adium/rev/ee132b70e346
revision:	3731:ee132b70e346
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Wed Mar 09 03:01:52 2011 +0200

Added DragAndDrop support for Changing User Picture (Contact List) #7444
Subject: adium 3732:98e55e5f1ba3: Fix a crash which can occur if a IKPictureTakerRecentPicture doesn't have a smallIcon. Also, some efficiency since we're only displaying up to 10 recent pictures

details:	http://hg.adium.im/adium/rev/98e55e5f1ba3
revision:	3732:98e55e5f1ba3
branch:		(none)
author:		Evan Schoenberg
date:		Fri Mar 11 21:13:17 2011 -0600

Fix a crash which can occur if a IKPictureTakerRecentPicture doesn't have a smallIcon. Also, some efficiency since we're only displaying up to 10 recent pictures

diffs (truncated from 3673 to 1000 lines):

diff -r 17d1c79d8099 -r 98e55e5f1ba3 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Fri Mar 11 18:32:39 2011 +0100
+++ b/Adium.xcodeproj/project.pbxproj	Fri Mar 11 21:13:17 2011 -0600
@@ -622,7 +622,6 @@
 		34A489F306F64359002C7C5F /* AISCLViewPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A489F106F64359002C7C5F /* AISCLViewPlugin.m */; };
 		34A48A0106F6436D002C7C5F /* AIStandardListWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A489FB06F6436D002C7C5F /* AIStandardListWindowController.m */; };
 		34A48A0406F6436D002C7C5F /* AIListWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A489FE06F6436D002C7C5F /* AIListWindowController.m */; };
-		34A48A0C06F64376002C7C5F /* ContactListWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 34A48A0B06F64376002C7C5F /* ContactListWindow.nib */; };
 		34A48A1006F64382002C7C5F /* ContactListWindowBorderless.nib in Resources */ = {isa = PBXBuildFile; fileRef = 34A48A0F06F64381002C7C5F /* ContactListWindowBorderless.nib */; };
 		34A48A1806F6438F002C7C5F /* AIBorderlessListWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A48A1406F6438F002C7C5F /* AIBorderlessListWindowController.m */; };
 		34A48A1906F6438F002C7C5F /* AIListController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A48A1506F6438F002C7C5F /* AIListController.m */; };
@@ -1489,6 +1488,8 @@
 		81DAED520C26F4F700780E4C /* AMPurpleJabberServiceDiscoveryBrowsing.h in Headers */ = {isa = PBXBuildFile; fileRef = 81DAED500C26F4F700780E4C /* AMPurpleJabberServiceDiscoveryBrowsing.h */; };
 		81DAED530C26F4F700780E4C /* AMPurpleJabberServiceDiscoveryBrowsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DAED510C26F4F700780E4C /* AMPurpleJabberServiceDiscoveryBrowsing.m */; };
 		81E45D760C15BFF800B7381B /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34E839050583207E00F2AADB /* SystemConfiguration.framework */; };
+		9722ABC613257D5800CAB486 /* ContactListWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9722ABC513257D5800CAB486 /* ContactListWindow.xib */; };
+		9722ABC813257D7F00CAB486 /* ContactListWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9722ABC713257D7F00CAB486 /* ContactListWindow.xib */; };
 		97AF5CDB13191DE200550C41 /* AIContactListUserPictureMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97AF5CDA13191DE200550C41 /* AIContactListUserPictureMenuController.m */; };
 		97AF5CE713191E4800550C41 /* AIImageCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 97AF5CE213191E2800550C41 /* AIImageCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		97AF5CE813191E4800550C41 /* AIImageCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 97AF5CE313191E2800550C41 /* AIImageCollectionView.m */; };
@@ -3370,7 +3371,6 @@
 		34A489FC06F6436D002C7C5F /* AIStandardListWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIStandardListWindowController.h; path = Source/AIStandardListWindowController.h; sourceTree = "<group>"; };
 		34A489FE06F6436D002C7C5F /* AIListWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIListWindowController.m; path = Source/AIListWindowController.m; sourceTree = "<group>"; };
 		34A489FF06F6436D002C7C5F /* AIListWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIListWindowController.h; path = Source/AIListWindowController.h; sourceTree = "<group>"; };
-		34A48A0B06F64376002C7C5F /* ContactListWindow.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ContactListWindow.nib; path = Resources/ContactListWindow.nib; sourceTree = "<group>"; };
 		34A48A0F06F64381002C7C5F /* ContactListWindowBorderless.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ContactListWindowBorderless.nib; path = Resources/ContactListWindowBorderless.nib; sourceTree = "<group>"; };
 		34A48A1306F6438F002C7C5F /* AIListController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIListController.h; path = Source/AIListController.h; sourceTree = "<group>"; };
 		34A48A1406F6438F002C7C5F /* AIBorderlessListWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIBorderlessListWindowController.m; path = Source/AIBorderlessListWindowController.m; sourceTree = "<group>"; };
@@ -4734,6 +4734,8 @@
 		81DAE8710C261E8A00780E4C /* AMPurpleTuneTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AMPurpleTuneTooltip.m; path = "Plugins/Purple Service/AMPurpleTuneTooltip.m"; sourceTree = "<group>"; };
 		81DAED500C26F4F700780E4C /* AMPurpleJabberServiceDiscoveryBrowsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AMPurpleJabberServiceDiscoveryBrowsing.h; path = "Plugins/Purple Service/AMPurpleJabberServiceDiscoveryBrowsing.h"; sourceTree = "<group>"; };
 		81DAED510C26F4F700780E4C /* AMPurpleJabberServiceDiscoveryBrowsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AMPurpleJabberServiceDiscoveryBrowsing.m; path = "Plugins/Purple Service/AMPurpleJabberServiceDiscoveryBrowsing.m"; sourceTree = "<group>"; };
+		9722ABC513257D5800CAB486 /* ContactListWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ContactListWindow.xib; path = Resources/ContactListWindow.xib; sourceTree = "<group>"; };
+		9722ABC713257D7F00CAB486 /* ContactListWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ContactListWindow.xib; path = Resources/ContactListWindow.xib; sourceTree = "<group>"; };
 		97AF5CD913191DE200550C41 /* AIContactListUserPictureMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIContactListUserPictureMenuController.h; path = Source/AIContactListUserPictureMenuController.h; sourceTree = "<group>"; };
 		97AF5CDA13191DE200550C41 /* AIContactListUserPictureMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIContactListUserPictureMenuController.m; path = Source/AIContactListUserPictureMenuController.m; sourceTree = "<group>"; };
 		97AF5CE213191E2800550C41 /* AIImageCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIImageCollectionView.h; path = Source/AIImageCollectionView.h; sourceTree = "<group>"; };
@@ -5265,6 +5267,7 @@
 				29B97323FDCFA39411CA2CEA /* Linked Frameworks */,
 				63C7E0280FAF9B7D00B310AC /* xcconfigs */,
 				19C28FACFE9D520D11CA2CBB /* Products */,
+				9722ABC513257D5800CAB486 /* ContactListWindow.xib */,
 			);
 			name = CocAIMe2;
 			sourceTree = "<group>";
@@ -7458,7 +7461,7 @@
 				34607EF209B22933000DB3D2 /* User Icon Changing */,
 				34A489FC06F6436D002C7C5F /* AIStandardListWindowController.h */,
 				34A489FB06F6436D002C7C5F /* AIStandardListWindowController.m */,
-				34A48A0B06F64376002C7C5F /* ContactListWindow.nib */,
+				9722ABC713257D7F00CAB486 /* ContactListWindow.xib */,
 				34EBB2C10DCA8DE400B4CB6E /* AISearchFieldCell.h */,
 				34EBB2C20DCA8DE500B4CB6E /* AISearchFieldCell.m */,
 				34607F0C09B2296A000DB3D2 /* AIHoveringPopUpButtonCell.m */,
@@ -9829,7 +9832,6 @@
 				4BD6758806001E460049CAF7 /* AlertMessageContactAlert.nib in Resources */,
 				7E824CDD06387FAF00813072 /* LinkEditor.nib in Resources */,
 				6EC1685006C170A000F9FAD3 /* InviteToChatWindow.nib in Resources */,
-				34A48A0C06F64376002C7C5F /* ContactListWindow.nib in Resources */,
 				34A48A1006F64382002C7C5F /* ContactListWindowBorderless.nib in Resources */,
 				4BE9FFE8055981AB00359B15 /* Adium.pch in Resources */,
 				4BD6743106001D1E0049CAF7 /* EmoticonDefaults.plist in Resources */,
@@ -10021,6 +10023,8 @@
 				76889DEF12D3CA40007AEF00 /* Personal.png in Resources */,
 				1154F50A12E1476900B8CA27 /* AILogByAccountWindow.nib in Resources */,
 				97AF5CF413191E9A00550C41 /* ContactListChangeUserPictureMenu.xib in Resources */,
+				9722ABC613257D5800CAB486 /* ContactListWindow.xib in Resources */,
+				9722ABC813257D7F00CAB486 /* ContactListWindow.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff -r 17d1c79d8099 -r 98e55e5f1ba3 Frameworks/AIUtilities Framework/Source/AIImageViewWithImagePicker.h
--- a/Frameworks/AIUtilities Framework/Source/AIImageViewWithImagePicker.h	Fri Mar 11 18:32:39 2011 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIImageViewWithImagePicker.h	Fri Mar 11 21:13:17 2011 -0600
@@ -14,10 +14,49 @@
  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+ at protocol AIImageViewWithImagePickerDelegate;
+
 @class AIImageViewWithImagePicker;
- at class IKPictureTakerRecentPicture; //Private 10.5 class
 @class NSImage, NSString, NSResponder;
 
+ at class IKPictureTakerRecentPicture; // Private 10.5+ class
+
+ at interface AIImageViewWithImagePicker : NSImageView {
+	IBOutlet id		delegate;
+	
+	NSString		*title;
+	id				pictureTaker;
+	id				activeRecentPicture;
+
+	BOOL			usePictureTaker;
+	BOOL			presentPictureTakerAsSheet;
+	BOOL			shouldUpdateRecentRepository;
+
+	BOOL			shouldDrawFocusRing;
+	NSResponder		*lastResp;
+	
+	NSPoint			mouseDownPos;
+	
+	NSSize			maxSize;
+}
+
+ at property (readwrite, assign, nonatomic) IBOutlet id delegate;
+
+ at property (retain) NSString *title;
+ at property (assign) id activeRecentPicture;
+ at property (assign) BOOL usePictureTaker;
+ at property (assign) BOOL presentPictureTakerAsSheet;
+ at property (assign) BOOL shouldUpdateRecentRepository;
+ at property (assign) NSSize maxSize;
+
+- (IBAction)showImagePicker:(id)sender;
+
+- (id)pictureTaker;
+
+- (void)setRecentPictureAsImageInput:(IKPictureTakerRecentPicture *)recentPicture;
+
+ at end
+
 /*!
  * @protocol AIImageViewWithImagePickerDelegate
  * @brief Delegate protocol for <tt>AIImageViewWithImagePicker</tt>
@@ -79,35 +118,5 @@
  * Return nil to have the image picker use a default name.
  */
 - (NSString *)fileNameForImageInImagePicker:(AIImageViewWithImagePicker *)picker;
- at end
-
- at interface AIImageViewWithImagePicker : NSImageView {
-	NSString				*title;
-	id						pictureTaker;
-	id						activeRecentPicture;
-
-	BOOL					usePictureTaker;
-	BOOL					presentPictureTakerAsSheet;
-
-	IBOutlet	id			delegate;
-	
-	BOOL					shouldDrawFocusRing;
-	NSResponder				*lastResp;
-	
-	NSPoint					mouseDownPos;
-	
-	NSSize					maxSize;
-}
-
-- (void)setDelegate:(id)inDelegate;
-- (id)delegate;
-- (void)setTitle:(NSString *)inTitle;
-- (IBAction)showImagePicker:(id)sender;
-- (void)setUsePictureTaker:(BOOL)inUsePictureTaker;
-- (id)pictureTaker;
-- (void)setPresentPictureTakerAsSheet:(BOOL)inPresentPictureTakerAsSheet;
-- (void)setMaxSize:(NSSize)inMaxSize;
-
-- (void)setRecentPictureAsImageInput:(IKPictureTakerRecentPicture *)recentPicture;
 
 @end
diff -r 17d1c79d8099 -r 98e55e5f1ba3 Frameworks/AIUtilities Framework/Source/AIImageViewWithImagePicker.m
--- a/Frameworks/AIUtilities Framework/Source/AIImageViewWithImagePicker.m	Fri Mar 11 18:32:39 2011 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIImageViewWithImagePicker.m	Fri Mar 11 21:13:17 2011 -0600
@@ -24,19 +24,26 @@
 #import "AIApplicationAdditions.h"
 #import "AIStringUtilities.h"
 
+#import "IKRecentPicture.h" //10.5+, private
+
 #define DRAGGING_THRESHOLD 16.0
 
+ at class IKPictureTakerRecentPicture;
+
 @interface AIImageViewWithImagePicker ()
+
 - (void)_initImageViewWithImagePicker;
 - (void)showPictureTaker;
 - (void)copy:(id)sender;
 - (void)paste:(id)sender;
 - (void)delete;
+
 @end
 
- at class IKPictureTakerRecentPicture;
 @interface NSObject (IKPictureTaker_SecretsAdiumKnows)
+
 - (void)setRecentPictureAsImageInput:(IKPictureTakerRecentPicture *)picture;
+
 @end
 
 /*
@@ -51,14 +58,15 @@
  *		- Drag and drop into and out of the image well, with delegate notification, 
  *			with support for animated GIFs and transparency
  *		- Notifcation to the delegate of user's attempt to delete the image
- *
- * Note: AIImageViewWithImagePicker requires Panther or better for the Address Book-style
- * image picker to work.
+ *		- Adding image to Recent Picture Repository, for dragged images only
  */
 @implementation AIImageViewWithImagePicker
 
-// Init ------------------------------------------------------------------------------------------
+
+ at synthesize delegate, activeRecentPicture, usePictureTaker, presentPictureTakerAsSheet, shouldUpdateRecentRepository, maxSize; 
+
 #pragma mark Init
+
 /*
  * @brief Initialize with coder
  */
@@ -91,6 +99,8 @@
 	delegate = nil;
 	activeRecentPicture = nil;
 	
+	shouldUpdateRecentRepository = NO;
+	
 	lastResp = nil;
 	shouldDrawFocusRing = NO;
 
@@ -109,7 +119,7 @@
 
 	if (pictureTaker) {
 		[pictureTaker close];
-		[pictureTaker release]; pictureTaker = nil;
+		[pictureTaker release], pictureTaker = nil;
 	}
 	
 	delegate = nil;
@@ -118,28 +128,7 @@
 	[super dealloc];
 }
 
-// Getters and Setters ----------------------------------------------------------------
 #pragma mark Getters and Setters
-/*!
- * @brief Set the delegate
- *
- * Set the delegate.  See <tt>AIImageViewWithImagePickerDelegate</tt> protocol discussion for details.
- * @param inDelegate The delegate, which may implement any of the methods described in <tt>AIImageViewWithImagePickerDelegate</tt>.
- */ 
-- (void)setDelegate:(id)inDelegate
-{
-	delegate = inDelegate;
-}
-
-/*!
- * @brief Return the delegate
- *
- * @return The delegate
- */ 
-- (id)delegate
-{
-	return delegate;
-}
 
 /*!
  * @brief Set the image
@@ -155,7 +144,7 @@
 		[pictureTaker setInputImage:inImage];
 	}
 	
-	[activeRecentPicture release]; activeRecentPicture = nil;
+	[activeRecentPicture release], activeRecentPicture = nil;
 }
 
 /*!
@@ -167,7 +156,9 @@
 - (void)setTitle:(NSString *)inTitle
 {
 	if (title != inTitle) {
-		[title release]; title = [inTitle retain];
+		[title release];
+		title = [inTitle retain];
+		
 		if (pictureTaker) {
 			[pictureTaker setTitle:title];
 		}
@@ -182,37 +173,6 @@
 	return (title ? title : AILocalizedStringFromTableInBundle(@"Image Picker", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], nil));
 }
 
-/*!
- * @brief Should the image view use the address book Image Picker?
- *
- * If NO, a standard Open panel is used instead.
- */
-- (void)setUsePictureTaker:(BOOL)inUsePictureTaker
-{
-	usePictureTaker = inUsePictureTaker;
-}
-
-- (void)setPresentPictureTakerAsSheet:(BOOL)inPresentPictureTakerAsSheet
-{
-	presentPictureTakerAsSheet  = inPresentPictureTakerAsSheet;
-}
-
-- (BOOL)presentPictureTakerAsSheet
-{
-	return presentPictureTakerAsSheet;
-}
-
-- (void)setMaxSize:(NSSize)inMaxSize
-{
-	maxSize = inMaxSize;
-}
-
-- (NSSize)maxSize
-{
-	return maxSize;
-}
-
-// Monitoring user interaction --------------------------------------------------------
 #pragma mark Monitoring user interaction
 
 /*
@@ -282,6 +242,7 @@
 	NSPoint mousePos = [self convertPoint:[theEvent locationInWindow] fromView:nil];
 	CGFloat dx = mousePos.x-mouseDownPos.x;
 	CGFloat dy = mousePos.y-mouseDownPos.y;	
+	
 	if ((dx*dx) + (dy*dy) < DRAGGING_THRESHOLD) {
 		return;
 	}
@@ -398,68 +359,70 @@
  * We then want to update our pictureTaker's selection if it is open.
  * Also, if we're dropped a promised file, use its data directly as it may be better than what NSImageView's natural
  * loading retrieves... this way we can get transparency or animation data, for example.
+ * Also we want the image to be added to the recent repository
  */
 - (void)concludeDragOperation:(id <NSDraggingInfo>)sender
 {
-	BOOL	notified = NO, resized = NO;
-	NSImage *droppedImage;
-	NSSize	droppedImageSize;
+	[super concludeDragOperation:sender];
+	
+	NSImage *droppedImage = [self image];
+	NSSize droppedImageSize = [droppedImage size];
+	NSSize mSize = [self maxSize];
+	
+	IKPictureTakerRecentPicture *recentPicture = [IKPictureTakerRecentPicture defaultRecentPictureWithOriginalImage:droppedImage cropSize:CGSizeZero];
+	
+	if (!shouldUpdateRecentRepository &&
+		((mSize.width > 0.0f && droppedImageSize.width > mSize.width) ||
+		(mSize.height > 0.0f && droppedImageSize.height > mSize.height))) {
 
-	[super concludeDragOperation:sender];
+		droppedImage = [droppedImage imageByScalingToSize:mSize];
 
-	droppedImage = [self image];
-	droppedImageSize = [droppedImage size];
-
-	if ((maxSize.width > 0 && droppedImageSize.width > maxSize.width) ||
-		(maxSize.height > 0 && droppedImageSize.height > maxSize.height)) {
-		droppedImage = [droppedImage imageByScalingToSize:maxSize];
-		//This will notify the picker controller that the selection changed, as well
+		// This will notify the picker controller that the selection changed, as well
 		[self setImage:droppedImage];
-		resized = YES;
-
 	} else if (pictureTaker) {
-		[pictureTaker setInputImage:droppedImage];
+		// Notify the picker controller
+		[pictureTaker setRecentPictureAsImageInput:recentPicture];
+	}
+	
+	// Inform the delegate
+	if ([[self delegate] respondsToSelector:@selector(imageViewWithImagePicker:didChangeToImageData:)]) {
+		[[self delegate] imageViewWithImagePicker:self didChangeToImageData:[droppedImage PNGRepresentation]];
+	} else if ([[self delegate] respondsToSelector:@selector(imageViewWithImagePicker:didChangeToImage:)]) {
+		[[self delegate] imageViewWithImagePicker:self didChangeToImage:droppedImage];
 	}
 
-	//Use the file's data if possible and the image wasn't too big
-	if (!resized && [delegate respondsToSelector:@selector(imageViewWithImagePicker:didChangeToImageData:)]) {
-		NSPasteboard	*pboard = [sender draggingPasteboard];
+	// Update Recent Pictures Repository
+	if (shouldUpdateRecentRepository) {
+		// We need a valid maxSize, >= (32.0f, 32.0f)
+		NSAssert(mSize.width >= 32.0f || mSize.height >= 32.0f, @"Valid maxSize required!");
 
-		if ([[pboard types] containsObject:NSFilenamesPboardType]) {
-			NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
+		if ((mSize.width > 0.0f && droppedImageSize.width > mSize.width) ||
+			(mSize.height > 0.0f && droppedImageSize.height > mSize.height)) {
+			
+			droppedImage = [droppedImage imageByScalingToSize:mSize];
+		}
 		
-			if ([files count]) {
-				NSString	*imageFile = [files objectAtIndex:0];
-				NSData		*imageData = [NSData dataWithContentsOfFile:imageFile];
-
-				if (imageData) {
-					[delegate performSelector:@selector(imageViewWithImagePicker:didChangeToImageData:)
-								   withObject:self
-								   withObject:[NSData dataWithContentsOfFile:imageFile]];
-					
-					notified = YES;
-				}
-			}
-		}
-	}
-
-	//Inform the delegate if we haven't informed it yet
-	if (!notified) {
-		if ([delegate respondsToSelector:@selector(imageViewWithImagePicker:didChangeToImageData:)]) {
-			[delegate performSelector:@selector(imageViewWithImagePicker:didChangeToImageData:)
-						   withObject:self
-						   withObject:[droppedImage PNGRepresentation]];
-
-		} else if ([delegate respondsToSelector:@selector(imageViewWithImagePicker:didChangeToImage:)]) {
-			[delegate performSelector:@selector(imageViewWithImagePicker:didChangeToImage:)
-						   withObject:self
-						   withObject:droppedImage];
-		}
+		// Recent picture needs a small icon, of square shape
+		NSImage *smallIcon = [[NSImage alloc] initWithSize:mSize];
+		
+		[smallIcon lockFocus];
+		[droppedImage drawAtPoint:NSMakePoint((mSize.width - droppedImage.size.width) / 2.0f, (mSize.height - droppedImage.size.height) / 2.0f) 
+						 fromRect:NSZeroRect 
+						operation:NSCompositeCopy
+						 fraction:1.0f];
+		[smallIcon unlockFocus];
+		
+		// Update recent picture
+		[recentPicture setCropInfo:nil smallIcon:smallIcon];
+		[smallIcon release];
+		
+		// Add to recent repository
+		[[IKPictureTakerRecentPictureRepository recentRepository] addRecent:recentPicture];
 	}
 }
 
-// Copy / Paste ----------------------------------------------------------------
 #pragma mark Copy / Paste
+
 /*
  * @brief Copy
  */
@@ -542,8 +505,8 @@
 	}	
 }
 
-// NSImagePicker Access and Delegate ----------------------------------------------------------------
 #pragma mark NSImagePicker Access and Delegate
+
 /*!
  * @brief Action to call -[self showPictureTaker]
  */ 
@@ -689,8 +652,8 @@
 	}
 }
 
-// Drawing ------------------------------------------------------------------------
 #pragma mark Drawing
+
 /*
  * @brief Note when the focus ring needs to be displayed
  *
@@ -704,18 +667,19 @@
 	
 	if ([window isKeyWindow]) {
 		resp = [window firstResponder];
+		
 		if (resp == lastResp) {
 			return [super needsDisplay];
 		}
-		
 	} else if (lastResp == nil) {
 		return [super needsDisplay];
-		
 	}
 	
-	shouldDrawFocusRing = (resp != nil &&
+	shouldDrawFocusRing = ([self focusRingType] != NSFocusRingTypeNone &&
+						   resp != nil &&
 						   [resp isKindOfClass:[NSView class]] &&
 						   [(NSView *)resp isDescendantOf:self]); // [sic]
+
 	lastResp = resp;
 	
 	[self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
diff -r 17d1c79d8099 -r 98e55e5f1ba3 Resources/ContactListWindow.nib/classes.nib
--- a/Resources/ContactListWindow.nib/classes.nib	Fri Mar 11 18:32:39 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IBClasses</key>
-	<array>
-		<dict>
-			<key>CLASS</key>
-			<string>NSApplication</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSResponder</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>RBSplitView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>delegate</key>
-				<string>id</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>RBSplitSubview</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIDockingWindow</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSWindow</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSTextField</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSControl</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>RBSplitSubview</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSView</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSWindowController</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSResponder</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>adiumPrint</key>
-				<string>id</string>
-				<key>didAdjustSubviews</key>
-				<string>RBSplitView</string>
-				<key>prefsWindowWillClose</key>
-				<string>SS_PrefsController</string>
-				<key>toggleFindPanel</key>
-				<string>id</string>
-				<key>willAdjustSubviews</key>
-				<string>RBSplitView</string>
-			</dict>
-			<key>CLASS</key>
-			<string>NSObject</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIRolloverButton</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>delegate</key>
-				<string>id</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>NSButton</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSWindow</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSResponder</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSScrollView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSView</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>showImagePicker</key>
-				<string>id</string>
-			</dict>
-			<key>CLASS</key>
-			<string>AIImageViewWithImagePicker</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>delegate</key>
-				<string>id</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>NSImageView</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIHoveringPopUpButton</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSButton</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>close</key>
-				<string>id</string>
-				<key>filterContacts</key>
-				<string>id</string>
-				<key>hideFilterBar</key>
-				<string>id</string>
-				<key>makeActive</key>
-				<string>id</string>
-				<key>toggleFindPanel</key>
-				<string>id</string>
-			</dict>
-			<key>CLASS</key>
-			<string>AIListWindowController</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>button_cancelFilterBar</key>
-				<string>AIRolloverButton</string>
-				<key>contactListView</key>
-				<string>AIAnimatingListOutlineView</string>
-				<key>filterBarView</key>
-				<string>NSView</string>
-				<key>scrollView_contactList</key>
-				<string>AIAutoScrollView</string>
-				<key>searchField</key>
-				<string>NSSearchField</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>AIWindowController</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>FirstResponder</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSObject</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIListOutlineView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>AIMultiCellOutlineView</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIContactListNameButton</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>editTarget</key>
-				<string>id</string>
-				<key>editUserInfo</key>
-				<string>id</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>AIHoveringPopUpButton</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>NSButton</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSControl</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIStandardListScrollView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>AIAutoScrollView</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIAnimatingListOutlineView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>AIListOutlineView</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>activateFirstContact</key>
-				<string>id</string>
-				<key>filterContacts</key>
-				<string>id</string>
-				<key>hideFilterBar</key>
-				<string>id</string>
-				<key>showFilterBar</key>
-				<string>id</string>
-				<key>toggleFilterBar</key>
-				<string>id</string>
-				<key>toggleFindPanel</key>
-				<string>id</string>
-			</dict>
-			<key>CLASS</key>
-			<string>AIStandardListWindowController</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>button_cancelFilterBar</key>
-				<string>AIRolloverButton</string>
-				<key>filterBarView</key>
-				<string>NSView</string>
-				<key>imagePicker</key>
-				<string>AIContactListImagePicker</string>
-				<key>imageView_status</key>
-				<string>NSImageView</string>
-				<key>nameView</key>
-				<string>AIContactListNameButton</string>
-				<key>searchField</key>
-				<string>NSSearchField</string>
-				<key>statusMenuView</key>
-				<string>AIHoveringPopUpButton</string>
-				<key>view_nameAndStatusMenu</key>
-				<string>NSView</string>
-				<key>view_statusAndImage</key>
-				<string>NSView</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>AIListWindowController</string>
-		</dict>
-		<dict>
-			<key>ACTIONS</key>
-			<dict>
-				<key>closeWindow</key>
-				<string>id</string>
-			</dict>
-			<key>CLASS</key>
-			<string>AIWindowController</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSWindowController</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIContactListImagePicker</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>AIImageViewWithImagePicker</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIWindowDraggingView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSView</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>SS_PrefsController</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>OUTLETS</key>
-			<dict>
-				<key>delegate</key>
-				<string>id</string>
-			</dict>
-			<key>SUPERCLASS</key>
-			<string>NSObject</string>
-		</dict>
-		<dict>
-			<key>CLASS</key>
-			<string>AIAutoScrollView</string>
-			<key>LANGUAGE</key>
-			<string>ObjC</string>
-			<key>SUPERCLASS</key>
-			<string>NSScrollView</string>
-		</dict>
-	</array>
-	<key>IBVersion</key>
-	<string>1</string>
-</dict>
-</plist>
diff -r 17d1c79d8099 -r 98e55e5f1ba3 Resources/ContactListWindow.nib/info.nib
--- a/Resources/ContactListWindow.nib/info.nib	Fri Mar 11 18:32:39 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IBFramework Version</key>
-	<string>677</string>
-	<key>IBLastKnownRelativeProjectPath</key>
-	<string>../Adium.xcodeproj</string>
-	<key>IBOldestOS</key>
-	<integer>5</integer>
-	<key>IBOpenObjects</key>
-	<array>
-		<integer>9</integer>
-	</array>
-	<key>IBSystem Version</key>
-	<string>9G55</string>
-	<key>targetFramework</key>
-	<string>IBCocoaFramework</string>
-</dict>
-</plist>
diff -r 17d1c79d8099 -r 98e55e5f1ba3 Resources/ContactListWindow.nib/keyedobjects.nib
Binary file Resources/ContactListWindow.nib/keyedobjects.nib has changed
diff -r 17d1c79d8099 -r 98e55e5f1ba3 Resources/ContactListWindow.xib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/ContactListWindow.xib	Fri Mar 11 21:13:17 2011 -0600
@@ -0,0 +1,2710 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
+	<data>
+		<int key="IBDocument.SystemTarget">1050</int>
+		<string key="IBDocument.SystemVersion">10J567</string>
+		<string key="IBDocument.InterfaceBuilderVersion">823</string>
+		<string key="IBDocument.AppKitVersion">1038.35</string>
+		<string key="IBDocument.HIToolboxVersion">462.00</string>
+		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+			<string key="NS.object.0">823</string>
+		</object>
+		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<integer value="9"/>
+			<integer value="219"/>
+		</object>
+		<object class="NSArray" key="IBDocument.PluginDependencies">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+		</object>
+		<object class="NSMutableDictionary" key="IBDocument.Metadata">
+			<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+			<integer value="1" key="NS.object.0"/>
+		</object>
+		<object class="NSMutableArray" key="IBDocument.RootObjects" id="1028682370">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<object class="NSCustomObject" id="461461245">
+				<string key="NSClassName">AIStandardListWindowController</string>
+			</object>
+			<object class="NSCustomObject" id="263594301">
+				<string key="NSClassName">FirstResponder</string>
+			</object>
+			<object class="NSCustomObject" id="675252577">
+				<string key="NSClassName">NSApplication</string>
+			</object>
+			<object class="NSWindowTemplate" id="43046457">
+				<int key="NSWindowStyleMask">4111</int>
+				<int key="NSWindowBacking">2</int>
+				<string key="NSWindowRect">{{30, 654}, {213, 410}}</string>
+				<int key="NSWTFlags">1881669632</int>
+				<string key="NSWindowTitle"/>
+				<string key="NSWindowClass">AIDockingWindow</string>
+				<object class="NSMutableString" key="NSViewClass">
+					<characters key="NS.bytes">View</characters>
+				</object>
+				<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+				<object class="NSView" key="NSWindowView" id="263109925">
+					<reference key="NSNextResponder"/>
+					<int key="NSvFlags">256</int>
+					<object class="NSMutableArray" key="NSSubviews">
+						<bool key="EncodedWithXMLCoder">YES</bool>
+						<object class="NSScrollView" id="166732467">
+							<reference key="NSNextResponder" ref="263109925"/>
+							<int key="NSvFlags">274</int>
+							<object class="NSMutableArray" key="NSSubviews">
+								<bool key="EncodedWithXMLCoder">YES</bool>
+								<object class="NSClipView" id="58758836">
+									<reference key="NSNextResponder" ref="166732467"/>
+									<int key="NSvFlags">2304</int>
+									<object class="NSMutableArray" key="NSSubviews">
+										<bool key="EncodedWithXMLCoder">YES</bool>
+										<object class="NSOutlineView" id="483964282">
+											<reference key="NSNextResponder" ref="58758836"/>
+											<int key="NSvFlags">274</int>
+											<string key="NSFrameSize">{213, 410}</string>
+											<reference key="NSSuperview" ref="58758836"/>
+											<bool key="NSEnabled">YES</bool>
+											<object class="_NSCornerView" key="NSCornerView">
+												<nil key="NSNextResponder"/>
+												<int key="NSvFlags">256</int>
+												<string key="NSFrame">{{198, 0}, {16, 17}}</string>
+											</object>
+											<object class="NSMutableArray" key="NSTableColumns">
+												<bool key="EncodedWithXMLCoder">YES</bool>
+												<object class="NSTableColumn" id="470136678">
+													<double key="NSWidth">199</double>
+													<double key="NSMinWidth">16</double>
+													<double key="NSMaxWidth">1000</double>
+													<object class="NSTableHeaderCell" key="NSHeaderCell">
+														<int key="NSCellFlags">75628096</int>
+														<int key="NSCellFlags2">2048</int>
+														<string key="NSContents"/>
+														<object class="NSFont" key="NSSupport">
+															<string key="NSName">LucidaGrande</string>
+															<double key="NSSize">11</double>
+															<int key="NSfFlags">3100</int>
+														</object>
+														<object class="NSColor" key="NSBackgroundColor">
+															<int key="NSColorSpace">3</int>
+															<bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
+														</object>
+														<object class="NSColor" key="NSTextColor">
+															<int key="NSColorSpace">6</int>
+															<string key="NSCatalogName">System</string>
+															<string key="NSColorName">headerTextColor</string>
+															<object class="NSColor" key="NSColor" id="723127251">
+																<int key="NSColorSpace">3</int>
+																<bytes key="NSWhite">MAA</bytes>
+															</object>
+														</object>
+													</object>
+													<object class="NSTextFieldCell" key="NSDataCell" id="508344098">
+														<int key="NSCellFlags">338820672</int>
+														<int key="NSCellFlags2">1024</int>
+														<object class="NSFont" key="NSSupport">
+															<string key="NSName">LucidaGrande</string>
+															<double key="NSSize">13</double>
+															<int key="NSfFlags">1044</int>
+														</object>
+														<reference key="NSControlView" ref="483964282"/>
+														<object class="NSColor" key="NSBackgroundColor" id="890177268">
+															<int key="NSColorSpace">3</int>
+															<bytes key="NSWhite">MQA</bytes>
+														</object>
+														<object class="NSColor" key="NSTextColor">
+															<int key="NSColorSpace">6</int>
+															<string key="NSCatalogName">System</string>
+															<string key="NSColorName">controlTextColor</string>
+															<reference key="NSColor" ref="723127251"/>
+														</object>
+													</object>
+													<int key="NSResizingMask">3</int>
+													<bool key="NSIsResizeable">YES</bool>
+													<reference key="NSTableView" ref="483964282"/>
+												</object>
+											</object>
+											<double key="NSIntercellSpacingWidth">3</double>
+											<double key="NSIntercellSpacingHeight">2</double>
+											<reference key="NSBackgroundColor" ref="890177268"/>
+											<object class="NSColor" key="NSGridColor">
+												<int key="NSColorSpace">6</int>
+												<string key="NSCatalogName">System</string>
+												<string key="NSColorName">gridColor</string>
+												<object class="NSColor" key="NSColor">
+													<int key="NSColorSpace">3</int>
+													<bytes key="NSWhite">MC41AA</bytes>
+												</object>
+											</object>
+											<double key="NSRowHeight">17</double>
+											<int key="NSTvFlags">438304768</int>
+											<reference key="NSDelegate"/>
+											<reference key="NSDataSource"/>
+											<int key="NSColumnAutoresizingStyle">4</int>
+											<int key="NSDraggingSourceMaskForLocal">15</int>
+											<int key="NSDraggingSourceMaskForNonLocal">0</int>
+											<bool key="NSAllowsTypeSelect">YES</bool>
+											<int key="NSTableViewDraggingDestinationStyle">0</int>
+										</object>
+									</object>
+									<string key="NSFrameSize">{213, 410}</string>
+									<reference key="NSSuperview" ref="166732467"/>
+									<reference key="NSNextKeyView" ref="483964282"/>
+									<reference key="NSDocView" ref="483964282"/>
+									<object class="NSColor" key="NSBGColor">
+										<int key="NSColorSpace">6</int>
+										<string key="NSCatalogName">System</string>
+										<string key="NSColorName">controlBackgroundColor</string>
+										<object class="NSColor" key="NSColor">




More information about the commits mailing list