Source/AIListWindowController.m
author Evan Schoenberg
Thu, 14 Nov 2019 21:09:06 -0500
branchadium-1.5.11
changeset 6016 325e2ab3406f
parent 5891 91943bd7083f
permissions -rw-r--r--
Fixed a bunch of warnings
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     1
/* 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     2
 * Adium is the legal property of its developers, whose names are listed in the copyright file included
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     3
 * with this source distribution.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     4
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     6
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     7
 * or (at your option) any later version.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     8
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    10
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    11
 * Public License for more details.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    12
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    13
 * You should have received a copy of the GNU General Public License along with this program; if not,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    14
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    15
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    16
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    17
#import "AIListWindowController.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    18
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    19
#import "AISCLViewPlugin.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    20
#import	<Adium/AIListOutlineView.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    21
#import <Adium/AIChatControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    22
#import <Adium/AIAccountControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    23
#import <Adium/AIInterfaceControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    24
#import <Adium/AIDockControllerProtocol.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    25
#import <AIUtilities/AIWindowAdditions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    26
#import <AIUtilities/AIFunctions.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    27
#import <AIUtilities/AIWindowControllerAdditions.h>
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    28
#import <AIUtilities/AIImageAdditions.h>
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    29
#import <AIUtilities/AIOutlineViewAdditions.h>
1894
df033cc40f2d Disable the 'always search user paths' option (it's only enabled by default for backwards compatibility with gcc3) and fix the resulting errors.
David Smith <catfish.man@gmail.com>
parents: 1707
diff changeset
    30
#import <Adium/AIListBookmark.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    31
#import <Adium/AIListContact.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    32
#import <Adium/AIListGroup.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    33
#import <Adium/AIListObject.h>
1707
7bc74e073ddf Fixed filtering in the contact list with the new list object proxy code. refs #11896
Evan Schoenberg
parents: 1476
diff changeset
    34
#import <Adium/AIProxyListObject.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    35
#import <Adium/AIUserIcons.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    36
#import <AIUtilities/AIDockingWindow.h>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    37
#import <AIUtilities/AIEventAdditions.h>
52
54c2435615e8 Add a new subclass of AIListGroup to represent contact lists. The idea here is that contact lists are the only remaining place where we have groups inside groups, and so was forcing us to maintain nested group code in places. Parts of this are a work in progress; for example, with 'show groups' turned off, AIContactList should enforce that only AIListContacts can be added, but doing that will require rewriting how the show groups system works.
David Smith
parents: 3
diff changeset
    38
#import <Adium/AIContactList.h>
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    39
#import <Adium/AIContactHidingController.h>
4437
eb458432df0a Create a more generic file for supporting new OS features than the previous AILeopardCompatibility. This silences 4 warnings.
Frank Dowsett <wixardy@adium.im>
parents: 4330
diff changeset
    40
#import <AIUtilities/AIOSCompatibility.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    41
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    42
#import "AISearchFieldCell.h"
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    43
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    44
#define	KEY_HIDE_CONTACT_LIST_GROUPS			@"Hide Contact List Groups"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    45
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    46
#define SLIDE_ALLOWED_RECT_EDGE_MASK			(AIMinXEdgeMask | AIMaxXEdgeMask) /* Screen edges on which sliding is allowde */
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
    47
#define DOCK_HIDING_MOUSE_POLL_INTERVAL			0.1f /* Interval at which to check the mouse position for sliding */
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
    48
#define	WINDOW_SLIDING_DELAY					0.2f /* Time after the mouse is in the right place before the window slides on screen */
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    49
#define WINDOW_ALIGNMENT_TOLERANCE				2.0f /* Threshold distance far the window from an edge to be considered on it */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    50
#define MOUSE_EDGE_SLIDE_ON_DISTANCE			1.1f /* ??? */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    51
#define WINDOW_SLIDING_MOUSE_DISTANCE_TOLERANCE 3.0f /* Distance the mouse must be from the window's frame to be considered outside it */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    52
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
    53
#define SNAP_DISTANCE							15.0f /* Distance beween one window's edge and another's at which they should snap together */
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    54
84
3b5f51e77592 Switch all of our private method categories over to the new objc way of doing it (documented at http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_5.html#//apple_ref/doc/uid/TP30001163-CH20-SW2). This enforces having implementations for them, and in the process turned up a vast number of methods we had deleted the impl for but not the declaration. loc -= 198;
David Smith
parents: 75
diff changeset
    55
@interface AIListWindowController ()
3737
f06bf1a9d888 fixes for various type warnings, including unimplimented protocols.
Stephen Holt <sholt@adium.im>
parents: 3655
diff changeset
    56
- (id)initWithContactList:(id<AIContainingObject>)contactList;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    57
+ (NSString *)nibName;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    58
+ (void)updateScreenSlideBoundaryRect:(id)sender;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    59
- (BOOL)shouldSlideWindowOffScreen_mousePositionStrategy;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    60
- (void)slideWindowIfNeeded:(id)sender;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    61
- (BOOL)shouldSlideWindowOnScreen_mousePositionStrategy;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    62
- (void)delayWindowSlidingForInterval:(NSTimeInterval)inDelayTime;
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    63
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    64
- (void)showFilterBarWithAnimation:(BOOL)flag;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    65
- (void)hideFilterBarWithAnimation:(BOOL)flag;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    66
- (void)animateFilterBarWithDuration:(CGFloat)duration;
3092
ffb42621b742 Resolving most* undeclared selectors in Adium.app.
Stephen Holt <sholt@adium.im>
parents: 3087
diff changeset
    67
ffb42621b742 Resolving most* undeclared selectors in Adium.app.
Stephen Holt <sholt@adium.im>
parents: 3087
diff changeset
    68
- (void)screenParametersChanged:(NSNotification *)notification;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    69
@end
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    70
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    71
@implementation AIListWindowController
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    72
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
    73
@synthesize windowAnimation, filterBarAnimation;
627
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
    74
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    75
static NSMutableDictionary *screenSlideBoundaryRectDictionary = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    76
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    77
+ (void)initialize
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    78
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    79
	if ([self isEqual:[AIListWindowController class]]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    80
		[[NSNotificationCenter defaultCenter] addObserver:self
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    81
												 selector:@selector(updateScreenSlideBoundaryRect:) 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    82
													 name:NSApplicationDidChangeScreenParametersNotification 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    83
												   object:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    84
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    85
		[self updateScreenSlideBoundaryRect:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    86
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    87
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    88
3737
f06bf1a9d888 fixes for various type warnings, including unimplimented protocols.
Stephen Holt <sholt@adium.im>
parents: 3655
diff changeset
    89
+ (AIListWindowController *)listWindowControllerForContactList:(id<AIContainingObject>)contactList
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    90
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    91
	return [[[self alloc] initWithContactList:contactList] autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    92
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    93
3737
f06bf1a9d888 fixes for various type warnings, including unimplimented protocols.
Stephen Holt <sholt@adium.im>
parents: 3655
diff changeset
    94
- (id)initWithContactList:(id<AIContainingObject>)contactList
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    95
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    96
	if ((self = [self initWithWindowNibName:[[self class] nibName]])) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    97
		preventHiding = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    98
		previousAlpha = 0;
2916
d3077a9b1875 Added hidden preference AIDisableContactListTypeToFind which, if set to true, turns off automatic filter bar display when typing in the contact list
Evan Schoenberg
parents: 2899
diff changeset
    99
		typeToFindEnabled = ![[NSUserDefaults standardUserDefaults] boolForKey:@"AIDisableContactListTypeToFind"];
d3077a9b1875 Added hidden preference AIDisableContactListTypeToFind which, if set to true, turns off automatic filter bar display when typing in the contact list
Evan Schoenberg
parents: 2899
diff changeset
   100
1467
f7128c9376bd Move the filter bar into its own nib, and remove its NSBox.
Zachary West <zacw@adiumx.com>
parents: 1465
diff changeset
   101
		[NSBundle loadNibNamed:@"Filter Bar" owner:self];
f7128c9376bd Move the filter bar into its own nib, and remove its NSBox.
Zachary West <zacw@adiumx.com>
parents: 1465
diff changeset
   102
		
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   103
		[self setContactList:contactList];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   104
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   105
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   106
	return self;	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   107
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   108
3737
f06bf1a9d888 fixes for various type warnings, including unimplimented protocols.
Stephen Holt <sholt@adium.im>
parents: 3655
diff changeset
   109
- (id<AIContainingObject> )contactList
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   110
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   111
	return (contactListRoot ? contactListRoot : [contactListController contactList]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   112
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   113
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   114
- (AIListController *) listController
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   115
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   116
	return contactListController;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   117
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   118
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   119
- (AIListOutlineView *)contactListView
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   120
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   121
	return contactListView;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   122
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   123
3737
f06bf1a9d888 fixes for various type warnings, including unimplimented protocols.
Stephen Holt <sholt@adium.im>
parents: 3655
diff changeset
   124
- (void)setContactList:(id<AIContainingObject>)inContactList
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   125
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   126
	if (inContactList != contactListRoot) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   127
		[contactListRoot release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   128
		contactListRoot = [inContactList retain];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   129
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   130
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   131
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   132
//Our window nib name
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   133
+ (NSString *)nibName
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   134
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   135
    return @"";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   136
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   137
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   138
- (Class)listControllerClass
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   139
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   140
	return [AIListController class];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   141
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   142
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   143
- (void)dealloc
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   144
{
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   145
	[searchField setDelegate:nil];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   146
	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   147
	[filterBarAnimation stopAnimation];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   148
	[filterBarAnimation setDelegate:nil];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   149
	self.filterBarAnimation = nil;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   150
	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   151
	[filterBarPreviouslySelected release];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   152
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   153
	[[NSNotificationCenter defaultCenter] removeObserver:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   154
626
1c53a4ac7251 Be sure to stop, de-delegate, and release windowAnimation when AIListWindowController deallocates. I believe this fixes a crash I just ran into when closing the contact list window.
Evan Schoenberg
parents: 426
diff changeset
   155
	[windowAnimation stopAnimation];
1c53a4ac7251 Be sure to stop, de-delegate, and release windowAnimation when AIListWindowController deallocates. I believe this fixes a crash I just ran into when closing the contact list window.
Evan Schoenberg
parents: 426
diff changeset
   156
	[windowAnimation setDelegate:nil];
627
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
   157
	self.windowAnimation = nil;
626
1c53a4ac7251 Be sure to stop, de-delegate, and release windowAnimation when AIListWindowController deallocates. I believe this fixes a crash I just ran into when closing the contact list window.
Evan Schoenberg
parents: 426
diff changeset
   158
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   159
	[contactListController close];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   160
	[windowLastScreen release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   161
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   162
	[super dealloc];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   163
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   164
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   165
- (NSString *)adiumFrameAutosaveName
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   166
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   167
	AILogWithSignature(@"My autosave name is %@",[NSString stringWithFormat:@"Contact List:%@", [[self contactList] contentsBasedIdentifier]]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   168
	return [NSString stringWithFormat:@"Contact List:%@", [[self contactList] contentsBasedIdentifier]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   169
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   170
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   171
//Setup the window after it has loaded
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   172
- (void)windowDidLoad
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   173
{	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   174
	contactListController = [[[self listControllerClass] alloc] initWithContactList:[self contactList]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   175
																	  inOutlineView:contactListView
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   176
																	   inScrollView:scrollView_contactList 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   177
																		   delegate:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   178
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   179
	//super's windowDidLoad will restore our location, which is based upon the contactListRoot
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   180
	[super windowDidLoad];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   181
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   182
    //Exclude this window from the window menu (since we add it manually)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   183
    [[self window] setExcludedFromWindowsMenu:YES];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   184
	[[self window] useOptimizedDrawing:YES];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   185
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   186
	minWindowSize = [[self window] minSize];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   187
	[contactListController setMinWindowSize:minWindowSize];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   188
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   189
	[[self window] setTitle:AILocalizedString(@"Contacts","Contact List window title")];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   190
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   191
    //Watch for resolution and screen configuration changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   192
    [[NSNotificationCenter defaultCenter] addObserver:self
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   193
											 selector:@selector(screenParametersChanged:) 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   194
												 name:NSApplicationDidChangeScreenParametersNotification 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   195
											   object:nil];
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   196
	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   197
	// Filter bar	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   198
	filterBarExpandedGroups = NO;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   199
	filterBarIsVisible = NO;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   200
	filterBarShownAutomatically = NO;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   201
	self.filterBarAnimation = nil;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   202
	filterBarPreviouslySelected = nil;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   203
	[searchField setDelegate:self];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   204
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   205
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   206
	//Show the contact list initially even if it is at a screen edge and supposed to slide out of view
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   207
	[self delayWindowSlidingForInterval:5];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   208
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 84
diff changeset
   209
	id<AIPreferenceController> preferenceController = adium.preferenceController;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   210
    //Observe preference changes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   211
	[preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_CONTACT_LIST];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   212
	[preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_CONTACT_LIST_DISPLAY];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   213
	[preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_APPEARANCE];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   214
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   215
	//Preference code below assumes layout is done before theme.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   216
	[preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_LIST_LAYOUT];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   217
	[preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_LIST_THEME];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   218
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   219
	[[NSNotificationCenter defaultCenter] addObserver:self
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   220
											 selector:@selector(applicationDidUnhide:) 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   221
												 name:NSApplicationDidUnhideNotification 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   222
											   object:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   223
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   224
	//Substitute an otherwise identical copy of the search field for one of our class. We don't want to globally pose as class; we just want it here.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   225
	[NSKeyedArchiver setClassName:@"AISearchFieldCell" forClass:[NSSearchFieldCell class]];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   226
	[searchField setCell:[NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:[searchField cell]]]];	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   227
	[NSKeyedArchiver setClassName:@"NSSearchFieldCell" forClass:[NSSearchFieldCell class]];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   228
	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   229
	/* Get rid of the "x" button in the search field that would clear the search.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   230
	 * It conflicts with the other "x" button that hides the entire bar, and clearing a few characters is probably not necessary.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   231
	 */
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   232
	[[searchField cell] setCancelButtonCell:nil];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   233
	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   234
	[[NSNotificationCenter defaultCenter] addObserver:self
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   235
											 selector:@selector(windowDidResignMain:)
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   236
												 name:NSWindowDidResignMainNotification
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   237
											   object:[self window]];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   238
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   239
	//Save our frame immediately for sliding purposes
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   240
	[self setSavedFrame:[[self window] frame]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   241
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   242
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   243
//Close the contact list window
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   244
- (void)windowWillClose:(NSNotification *)notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   245
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   246
	if ([self windowSlidOffScreenEdgeMask] != AINoEdges) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   247
		//Hide the window while it's still off-screen
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   248
		[[self window] setAlphaValue:0.0f];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   249
		AILogWithSignature(@"Setting to alpha 0 while the window is offscreen");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   250
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   251
		//Then move it back on screen so that we'll save the proper position in -[AIWindowController windowWillClose:]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   252
		[self slideWindowOnScreenWithAnimation:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   253
	}
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   254
	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   255
	// When closing the contact list while a search is in progress, reset visibility first.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   256
	if (![[searchField stringValue] isEqualToString:@""]) {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   257
		[searchField setStringValue:@""];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   258
		[self filterContacts:searchField];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
   259
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   260
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   261
	[super windowWillClose:notification];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   262
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   263
	//Invalidate the dock-like hiding timer
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   264
	[slideWindowIfNeededTimer invalidate]; [slideWindowIfNeededTimer release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   265
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   266
    //Stop observing
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 84
diff changeset
   267
	[adium.preferenceController unregisterPreferenceObserver:self];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   268
    [[NSNotificationCenter defaultCenter] removeObserver:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   269
	[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   270
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   271
    //Tell the interface to unload our window
1109
092c44a2cfbb Having a separate notification center for Adium leads to the possibility of accidentally using the wrong one, which has tripped me up on more than one occasion. This switches us over to using the default center.
David Smith
parents: 627
diff changeset
   272
    NSNotificationCenter *adiumNotificationCenter = [NSNotificationCenter defaultCenter];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   273
    [adiumNotificationCenter postNotificationName:Interface_ContactListDidResignMain object:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   274
	[adiumNotificationCenter postNotificationName:Interface_ContactListDidClose object:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   275
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   276
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   277
NSInteger levelForAIWindowLevel(AIWindowLevel windowLevel)
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   278
{
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   279
	NSInteger				level;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   280
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   281
	switch (windowLevel) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   282
		case AINormalWindowLevel: level = NSNormalWindowLevel; break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   283
		case AIFloatingWindowLevel: level = NSFloatingWindowLevel; break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   284
		case AIDesktopWindowLevel: level = kCGBackstopMenuLevel; break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   285
		default: level = NSNormalWindowLevel; break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   286
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   287
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   288
	return level;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   289
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   290
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   291
- (void)setWindowLevel:(NSInteger)level
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   292
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   293
	[[self window] setLevel:level];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   294
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   295
4234
f724feac97c0 Make this UTF8
Stephen Holt <sholt@adium.im>
parents: 4229
diff changeset
   296
// A "stationary" window stays pinned to the desktop during Expos??
3841
fbc8ce02ce37 One more isOnSnowLeopardOrBetter removal.
Adrian Godoroja <robotive@me.com>
parents: 3757
diff changeset
   297
- (void)setCollectionBehaviorOfWindow:(NSWindow *)window showOnAllSpaces:(BOOL)allSpaces isStationary:(BOOL)stationary
2899
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   298
{
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   299
	NSWindowCollectionBehavior behavior = NSWindowCollectionBehaviorDefault;
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   300
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   301
	if (allSpaces)
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   302
		behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces;
3841
fbc8ce02ce37 One more isOnSnowLeopardOrBetter removal.
Adrian Godoroja <robotive@me.com>
parents: 3757
diff changeset
   303
	if (stationary)
3753
3de7cec9b4d4 Backed out changeset 4b8d5b913c9b
Stephen Holt <sholt@adium.im>
parents: 3752
diff changeset
   304
		behavior |= NSWindowCollectionBehaviorStationary;
2899
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   305
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   306
	[window setCollectionBehavior:behavior];
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   307
}
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   308
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   309
//Preferences have changed
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   310
- (void)preferencesChangedForGroup:(NSString *)group 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   311
							   key:(NSString *)key
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   312
							object:(AIListObject *)object 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   313
					preferenceDict:(NSDictionary *)prefDict 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   314
						 firstTime:(BOOL)firstTime
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   315
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   316
	BOOL shouldRevealWindowAndDelaySliding = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   317
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   318
	// Make sure we're not getting an object-specific update.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   319
	if (object != nil)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   320
			return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   321
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   322
    if ([group isEqualToString:PREF_GROUP_CONTACT_LIST]) {
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   323
		windowLevel = [[prefDict objectForKey:KEY_CL_WINDOW_LEVEL] intValue];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   324
		[self setWindowLevel:levelForAIWindowLevel(windowLevel)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   325
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   326
		listHasShadow = [[prefDict objectForKey:KEY_CL_WINDOW_HAS_SHADOW] boolValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   327
		[[self window] setHasShadow:listHasShadow];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   328
		
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   329
		windowHidingStyle = [[prefDict objectForKey:KEY_CL_WINDOW_HIDING_STYLE] intValue];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   330
		slideOnlyInBackground = [[prefDict objectForKey:KEY_CL_SLIDE_ONLY_IN_BACKGROUND] boolValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   331
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   332
		[[self window] setHidesOnDeactivate:(windowHidingStyle == AIContactListWindowHidingStyleBackground)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   333
		
72
d7ab08cf0950 Remove the Tiger branch and if from all isOnLeopardOrBetter checks in Adium. Next up: AIUtils
David Smith
parents: 55
diff changeset
   334
	    showOnAllSpaces = [[prefDict objectForKey:KEY_CL_ALL_SPACES] boolValue];
2899
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   335
		[self setCollectionBehaviorOfWindow:[self window]
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   336
							showOnAllSpaces:showOnAllSpaces
4292
560f0d2a76c9 Adium should play better with spaces again. Fixes #15408
Stephen Holt <sholt@adium.im>
parents: 4234
diff changeset
   337
							   isStationary:(windowLevel == AIDesktopWindowLevel)];
2849
63a5052fc169 Always try and reposition the contact list if we think it should be. Fixes #12716.
Zachary West <zacw@adium.im>
parents: 2558
diff changeset
   338
		
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   339
		if (windowHidingStyle == AIContactListWindowHidingStyleSliding) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   340
			if (!slideWindowIfNeededTimer) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   341
				slideWindowIfNeededTimer = [[NSTimer scheduledTimerWithTimeInterval:DOCK_HIDING_MOUSE_POLL_INTERVAL
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   342
																			 target:self
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   343
																		   selector:@selector(slideWindowIfNeeded:)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   344
																		   userInfo:nil
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   345
																			repeats:YES] retain];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   346
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   347
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   348
		} else if (slideWindowIfNeededTimer) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   349
            [slideWindowIfNeededTimer invalidate];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   350
			[slideWindowIfNeededTimer release]; slideWindowIfNeededTimer = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   351
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   352
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   353
		[contactListController setShowTooltips:[[prefDict objectForKey:KEY_CL_SHOW_TOOLTIPS] boolValue]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   354
		[contactListController setShowTooltipsInBackground:[[prefDict objectForKey:KEY_CL_SHOW_TOOLTIPS_IN_BACKGROUND] boolValue]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   355
    }
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   356
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   357
	//Auto-Resizing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   358
	if ([group isEqualToString:PREF_GROUP_APPEARANCE]) {
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   359
		AIContactListWindowStyle	windowStyle = [[prefDict objectForKey:KEY_LIST_LAYOUT_WINDOW_STYLE] intValue];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   360
		BOOL	autoResizeHorizontally = [[prefDict objectForKey:KEY_LIST_LAYOUT_HORIZONTAL_AUTOSIZE] boolValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   361
		BOOL	autoResizeVertically = YES;
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   362
		NSInteger		forcedWindowWidth, maxWindowWidth;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   363
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   364
		//Determine how to handle vertical autosizing. AIAppearancePreferences must match this behavior for this to make sense.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   365
		switch (windowStyle) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   366
			case AIContactListWindowStyleStandard:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   367
			case AIContactListWindowStyleBorderless:
1395
6eddc7deb5f3 Store flags and aliases for chats in the appropriate chats. Creates a new AIListContact cell for displaying in group chats, which prefixes the user with the character representing their status. As of yet, they aren't sorted by this order.
Zachary West <zacw@adiumx.com>
parents: 1173
diff changeset
   368
			case AIContactListWindowStyleGroupChat:
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   369
				//Standard and borderless don't have to vertically autosize, but they might
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   370
				autoResizeVertically = [[prefDict objectForKey:KEY_LIST_LAYOUT_VERTICAL_AUTOSIZE] boolValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   371
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   372
			case AIContactListWindowStyleGroupBubbles:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   373
			case AIContactListWindowStyleContactBubbles:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   374
			case AIContactListWindowStyleContactBubbles_Fitted:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   375
				//The bubbles styles don't show a window; force them to autosize by leaving autoResizeVertically == YES
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   376
				break;
4329
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   377
		}
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   378
		
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   379
		/* Avoid the bouncing effect when scrolling on Lion. This looks very bad when using a borderless window.
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   380
		 * TODO: (10.7+) remove this if
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   381
		 */
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   382
		if (windowStyle != AIContactListWindowStyleStandard && [scrollView_contactList respondsToSelector:@selector(setVerticalScrollElasticity:)]) {
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   383
			[scrollView_contactList setVerticalScrollElasticity:1]; // NSScrollElasticityNone
198733370475 Normal windows should behave normally, so only disable elastic scrolling when the contact list window isn't a normal window.
Stephen Holt <sholt@adium.im>
parents: 4328
diff changeset
   384
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   385
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   386
		if (autoResizeHorizontally) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   387
			//If autosizing, KEY_LIST_LAYOUT_HORIZONTAL_WIDTH determines the maximum width; no forced width.
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   388
			maxWindowWidth = [[prefDict objectForKey:KEY_LIST_LAYOUT_HORIZONTAL_WIDTH] integerValue];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   389
			forcedWindowWidth = -1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   390
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   391
			if (windowStyle == AIContactListWindowStyleStandard/* || windowStyle == AIContactListWindowStyleBorderless*/) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   392
				//In the non-transparent non-autosizing modes, KEY_LIST_LAYOUT_HORIZONTAL_WIDTH has no meaning
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   393
				maxWindowWidth = 10000;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   394
				forcedWindowWidth = -1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   395
			} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   396
				//In the transparent non-autosizing modes, KEY_LIST_LAYOUT_HORIZONTAL_WIDTH determines the width of the window
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   397
				forcedWindowWidth = [[prefDict objectForKey:KEY_LIST_LAYOUT_HORIZONTAL_WIDTH] integerValue];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   398
				maxWindowWidth = forcedWindowWidth;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   399
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   400
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   401
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   402
		//Show the resize indicator if either or both of the autoresizing options is NO
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   403
		[[self window] setShowsResizeIndicator:!(autoResizeVertically && autoResizeHorizontally)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   404
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   405
		/*
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   406
		 Reset the minimum and maximum sizes in case [contactListController contactListDesiredSizeChanged]; doesn't cause a sizing change
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   407
		 (and therefore the min and max sizes aren't set there).
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   408
		 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   409
		NSSize	thisMinimumSize = minWindowSize;
4897
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4845
diff changeset
   410
		NSSize	thisMaximumSize = NSMakeSize(maxWindowWidth, 10000);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   411
		NSRect	currentFrame = [[self window] frame];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   412
		
4897
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4845
diff changeset
   413
		if (forcedWindowWidth != -1) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   414
			/*
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   415
			 If we have a forced width but we are doing no autoresizing, set our frame now so we don't have to be doing checks every time
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   416
			 contactListDesiredSizeChanged is called.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   417
			 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   418
			if (!(autoResizeVertically || autoResizeHorizontally)) {
4897
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4845
diff changeset
   419
				thisMinimumSize.width = forcedWindowWidth;
5ea3bd51010d I messed up with branching adium-1.5.3. I should've branched it from adium-1.5.2, but used default. This meant many extra changes (new preferences, etc.) got in unintentionally.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4845
diff changeset
   420
				[[self window] setFrame:NSMakeRect(currentFrame.origin.x,currentFrame.origin.y,forcedWindowWidth,currentFrame.size.height) 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   421
								display:YES
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   422
								animate:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   423
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   424
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   425
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   426
		//If vertically resizing, make the minimum and maximum heights the current height
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   427
		if (autoResizeVertically) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   428
			thisMinimumSize.height = currentFrame.size.height;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   429
			thisMaximumSize.height = currentFrame.size.height;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   430
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   431
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   432
		//If horizontally resizing, make the minimum and maximum widths the current width
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   433
		if (autoResizeHorizontally) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   434
			thisMinimumSize.width = currentFrame.size.width;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   435
			thisMaximumSize.width = currentFrame.size.width;			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   436
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   437
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   438
		/* For a standard window, inform the contact list that, if asked, it wants to be 175 pixels or more.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   439
		 * A maximum width less than this can make the list autosize smaller, but if it has its druthers it'll be a sane
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   440
		 * size.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   441
		 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   442
		[contactListView setMinimumDesiredWidth:((windowStyle == AIContactListWindowStyleStandard) ? 175 : 0)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   443
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   444
		[[self window] setMinSize:thisMinimumSize];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   445
		[[self window] setMaxSize:thisMaximumSize];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   446
		
1173
619a0ae91b6e Propertyize some list controller stuff, and override the autoresize properties to disable them for groupchat lists. Should be a nice big speedup for joining groupchats
David Smith
parents: 1109
diff changeset
   447
		contactListController.autoResizeHorizontally = autoResizeHorizontally;
619a0ae91b6e Propertyize some list controller stuff, and override the autoresize properties to disable them for groupchat lists. Should be a nice big speedup for joining groupchats
David Smith
parents: 1109
diff changeset
   448
		contactListController.autoResizeVertically = autoResizeVertically;
619a0ae91b6e Propertyize some list controller stuff, and override the autoresize properties to disable them for groupchat lists. Should be a nice big speedup for joining groupchats
David Smith
parents: 1109
diff changeset
   449
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   450
		[contactListController setForcedWindowWidth:forcedWindowWidth];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   451
		[contactListController setMaxWindowWidth:maxWindowWidth];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   452
		
4330
70aa3725c670 Fix a 2px clipping error in the normal contact list window. Related to #15626.
Stephen Holt <sholt@adium.im>
parents: 4329
diff changeset
   453
		// let this happen at the beginning of the next runloop. The View needs to configure itself before we start forcing it to a size.
70aa3725c670 Fix a 2px clipping error in the normal contact list window. Related to #15626.
Stephen Holt <sholt@adium.im>
parents: 4329
diff changeset
   454
		dispatch_async(dispatch_get_main_queue(), ^{
70aa3725c670 Fix a 2px clipping error in the normal contact list window. Related to #15626.
Stephen Holt <sholt@adium.im>
parents: 4329
diff changeset
   455
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
70aa3725c670 Fix a 2px clipping error in the normal contact list window. Related to #15626.
Stephen Holt <sholt@adium.im>
parents: 4329
diff changeset
   456
			[contactListController contactListDesiredSizeChanged];
70aa3725c670 Fix a 2px clipping error in the normal contact list window. Related to #15626.
Stephen Holt <sholt@adium.im>
parents: 4329
diff changeset
   457
			[pool release];
70aa3725c670 Fix a 2px clipping error in the normal contact list window. Related to #15626.
Stephen Holt <sholt@adium.im>
parents: 4329
diff changeset
   458
		});
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   459
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   460
		if (!firstTime) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   461
			shouldRevealWindowAndDelaySliding = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   462
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   463
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   464
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   465
	//Window opacity
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   466
	if ([group isEqualToString:PREF_GROUP_APPEARANCE]) {
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   467
		CGFloat opacity = (CGFloat)[[prefDict objectForKey:KEY_LIST_LAYOUT_WINDOW_OPACITY] doubleValue];		
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   468
		[contactListController setBackgroundOpacity:opacity];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   469
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   470
		/*
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   471
		 * If we're using fitted bubbles, we want the default behavior of the winodw, which is to respond to clicks on opaque areas
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   472
		 * and ignore clicks on transparent areas.  If we're using any other style, we never want to ignore clicks.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   473
		 */
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   474
		BOOL forceWindowToCatchMouseEvents = ([[prefDict objectForKey:KEY_LIST_LAYOUT_WINDOW_STYLE] integerValue] != AIContactListWindowStyleContactBubbles_Fitted);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   475
		if (forceWindowToCatchMouseEvents)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   476
			[[self window] setIgnoresMouseEvents:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   477
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   478
		if (!firstTime) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   479
			shouldRevealWindowAndDelaySliding = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   480
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   481
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   482
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   483
	if ([group isEqualToString:PREF_GROUP_CONTACT_LIST_DISPLAY]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   484
		[contactListController setUseContactListGroups:![[prefDict objectForKey:KEY_HIDE_CONTACT_LIST_GROUPS] boolValue]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   485
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   486
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   487
	//Layout and Theme ------------
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   488
	BOOL groupLayout = ([group isEqualToString:PREF_GROUP_LIST_LAYOUT]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   489
	BOOL groupTheme = ([group isEqualToString:PREF_GROUP_LIST_THEME]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   490
    if (groupLayout || (groupTheme && !firstTime)) { /* We don't want to execute this code twice when initializing */
95
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 84
diff changeset
   491
		NSDictionary	*layoutDict = [adium.preferenceController preferencesForGroup:PREF_GROUP_LIST_LAYOUT];
47acbc0cc17a Propertyize AIListObject and convert some more controller accesses to dot syntax
David Smith
parents: 84
diff changeset
   492
		NSDictionary	*themeDict = [adium.preferenceController preferencesForGroup:PREF_GROUP_LIST_THEME];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   493
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   494
		//Layout only
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   495
		if (groupLayout) {
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   496
			NSInteger iconSize = [[layoutDict objectForKey:KEY_LIST_LAYOUT_USER_ICON_SIZE] integerValue];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   497
			[AIUserIcons setListUserIconSize:NSMakeSize(iconSize,iconSize)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   498
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   499
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   500
		//Theme only
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   501
		if (groupTheme || firstTime) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   502
			NSString		*imagePath = [themeDict objectForKey:KEY_LIST_THEME_BACKGROUND_IMAGE_PATH];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   503
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   504
			//Background Image
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   505
			if (imagePath && [imagePath length] && [[themeDict objectForKey:KEY_LIST_THEME_BACKGROUND_IMAGE_ENABLED] boolValue]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   506
				[contactListView setBackgroundImage:[[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   507
			} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   508
				[contactListView setBackgroundImage:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   509
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   510
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   511
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   512
		EXTENDED_STATUS_STYLE statusStyle = [[layoutDict objectForKey:KEY_LIST_LAYOUT_EXTENDED_STATUS_STYLE] intValue];
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
   513
		EXTENDED_STATUS_POSITION statusPosition = [[layoutDict objectForKey:KEY_LIST_LAYOUT_EXTENDED_STATUS_POSITION] intValue];
1173
619a0ae91b6e Propertyize some list controller stuff, and override the autoresize properties to disable them for groupchat lists. Should be a nice big speedup for joining groupchats
David Smith
parents: 1109
diff changeset
   514
		contactListController.autoResizeHorizontallyWithIdleTime = 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   515
		 ((statusStyle == IDLE_ONLY || statusStyle == IDLE_AND_STATUS) &&
1173
619a0ae91b6e Propertyize some list controller stuff, and override the autoresize properties to disable them for groupchat lists. Should be a nice big speedup for joining groupchats
David Smith
parents: 1109
diff changeset
   516
		  (statusPosition == EXTENDED_STATUS_POSITION_BESIDE_NAME || statusPosition == EXTENDED_STATUS_POSITION_BOTH));
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   517
		[contactListController contactListDesiredSizeChanged];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   518
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   519
		//Both layout and theme
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   520
		[contactListController updateLayoutFromPrefDict:layoutDict andThemeFromPrefDict:themeDict];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   521
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   522
		if (!firstTime) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   523
			shouldRevealWindowAndDelaySliding = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   524
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   525
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   526
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   527
	if (shouldRevealWindowAndDelaySliding) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   528
		[self delayWindowSlidingForInterval:2];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   529
		[self slideWindowOnScreenWithAnimation:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   530
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   531
	} else {
5891
91943bd7083f Fixed "preferneces" typo.
Robert Vehse <robertvehse@fastmail.fm>
parents: 4897
diff changeset
   532
		//Do a slide immediately if needed (to display as per our new preferences)
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   533
		[self slideWindowIfNeeded:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   534
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   535
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   536
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   537
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   538
- (IBAction)performDefaultActionOnSelectedObject:(AIListObject *)selectedObject sender:(NSOutlineView *)sender
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   539
{	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   540
    if ([selectedObject isKindOfClass:[AIListGroup class]]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   541
        //Expand or collapse the group
2161
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   542
		for (AIProxyListObject *proxyObject in selectedObject.proxyObjects) {
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   543
			if ([sender isItemExpanded:proxyObject]) {
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   544
				[sender collapseItem:proxyObject];
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   545
			} else {
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   546
				[sender expandItem:proxyObject];					
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   547
			}
a81bcb7482ed Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Zachary West <zacw@adium.im>
parents: 2117
diff changeset
   548
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   549
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   550
	} else if ([selectedObject isMemberOfClass:[AIListBookmark class]]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   551
		//Hide any tooltip the contactListController is currently showing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   552
		[contactListController hideTooltip];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   553
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   554
		[(AIListBookmark *)selectedObject openChat];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   555
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   556
	} else if ([selectedObject isKindOfClass:[AIListContact class]]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   557
		//Hide any tooltip the contactListController is currently showing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   558
		[contactListController hideTooltip];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   559
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   560
		//Open a new message with the contact
100
68210ab2807a sed is evil. All [adium *Controller]s are now adium.*Controller.
David Smith
parents: 95
diff changeset
   561
		[adium.interfaceController setActiveChat:[adium.chatController openChatWithContact:(AIListContact *)selectedObject
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   562
																			onPreferredAccount:YES]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   563
    }
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   564
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   565
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   566
- (BOOL) canCustomizeToolbar
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   567
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   568
	return NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   569
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   570
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   571
//Interface Container --------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   572
#pragma mark Interface Container
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   573
//Close this container
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   574
- (void)close:(id)sender
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   575
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   576
    //In response to windowShouldClose, the interface controller releases us.  At that point, no one would be retaining
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   577
	//this instance of AIContactListWindowController, and we would be deallocated.  The call to [self window] will
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   578
	//crash if we are deallocated.  A dirty, but functional fix is to temporarily retain ourself here.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   579
    [self retain];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   580
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 5891
diff changeset
   581
    if ([self windowShouldClose:sender]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   582
        [[self window] close];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   583
    }
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   584
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   585
    [self release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   586
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   587
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   588
- (void)makeActive:(id)sender
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   589
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   590
	[[self window] makeKeyAndOrderFront:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   591
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   592
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   593
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   594
//Contact list brought to front
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   595
- (void)windowDidBecomeKey:(NSNotification *)notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   596
{
1109
092c44a2cfbb Having a separate notification center for Adium leads to the possibility of accidentally using the wrong one, which has tripped me up on more than one occasion. This switches us over to using the default center.
David Smith
parents: 627
diff changeset
   597
    [[NSNotificationCenter defaultCenter] postNotificationName:Interface_ContactListDidBecomeMain object:self];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   598
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   599
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   600
//Contact list sent back
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   601
- (void)windowDidResignKey:(NSNotification *)notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   602
{
1109
092c44a2cfbb Having a separate notification center for Adium leads to the possibility of accidentally using the wrong one, which has tripped me up on more than one occasion. This switches us over to using the default center.
David Smith
parents: 627
diff changeset
   603
    [[NSNotificationCenter defaultCenter] postNotificationName:Interface_ContactListDidResignMain object:self];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   604
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   605
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   606
- (void)showWindowInFrontIfAllowed:(BOOL)inFront
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   607
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   608
	//Always show for three seconds at least if we're told to show
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   609
	[self delayWindowSlidingForInterval:3];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   610
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   611
	//Call super to actually do the showing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   612
	[super showWindowInFrontIfAllowed:inFront];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   613
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   614
	NSWindow	*window = [self window];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   615
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   616
	if ([self windowSlidOffScreenEdgeMask] != AINoEdges) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   617
		[self slideWindowOnScreenWithAnimation:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   618
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   619
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   620
	windowSlidOffScreenEdgeMask = AINoEdges;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   621
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   622
	currentScreen = [window screen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   623
	currentScreenFrame = [currentScreen frame];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   624
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   625
	if ([[NSScreen screens] count] && 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   626
		(currentScreen == [[NSScreen screens] objectAtIndex:0])) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   627
		currentScreenFrame.size.height -= [[NSApp mainMenu] menuBarHeight];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   628
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   629
4234
f724feac97c0 Make this UTF8
Stephen Holt <sholt@adium.im>
parents: 4229
diff changeset
   630
	//Ensure the window is displaying at the proper level and expos???? setting
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   631
	[self setWindowLevel:levelForAIWindowLevel(windowLevel)];	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   632
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   633
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   634
- (void)setSavedFrame:(NSRect)frame
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   635
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   636
	oldFrame = frame;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   637
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   638
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   639
- (NSRect)savedFrame
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   640
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   641
	return oldFrame;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   642
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   643
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   644
// Auto-resizing support ------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   645
#pragma mark Auto-resizing support
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   646
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   647
- (void)respondToScreenParametersChanged:(NSNotification *)notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   648
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   649
	NSWindow	*window = [self window];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   650
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   651
	NSScreen	*windowScreen = [window screen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   652
	if (!windowScreen) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   653
		if ([[NSScreen screens] containsObject:windowLastScreen]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   654
			windowScreen = windowLastScreen;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   655
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   656
			[windowLastScreen release]; windowLastScreen = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   657
			windowScreen = [NSScreen mainScreen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   658
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   659
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   660
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   661
	NSRect newScreenFrame = [[screenSlideBoundaryRectDictionary objectForKey:[NSValue valueWithNonretainedObject:windowScreen]] rectValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   662
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   663
	if ([self windowSlidOffScreenEdgeMask] != AINoEdges) {
4536
945d0c76a513 Cast to NSRectEdge.
Adrian Godoroja <robotive@me.com>
parents: 4437
diff changeset
   664
		NSRect newWindowFrame = AIRectByAligningRect_edge_toRect_edge_([window frame], (NSRectEdge)[self windowSlidOffScreenEdgeMask],
945d0c76a513 Cast to NSRectEdge.
Adrian Godoroja <robotive@me.com>
parents: 4437
diff changeset
   665
																	   newScreenFrame, (NSRectEdge)[self windowSlidOffScreenEdgeMask]);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   666
		[[self window] setFrame:newWindowFrame display:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   667
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   668
		[self delayWindowSlidingForInterval:2];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   669
		[self slideWindowOnScreenWithAnimation:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   670
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   671
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   672
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   673
	[contactListController contactListDesiredSizeChanged];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   674
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   675
	currentScreen = [window screen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   676
	currentScreenFrame = newScreenFrame;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   677
	[self setSavedFrame:[window frame]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   678
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   679
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   680
- (void)screenParametersChanged:(NSNotification *)notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   681
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   682
	/* Wait until the next run loop so the class method has definitely updated our screen sliding borders. */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   683
	[self performSelector:@selector(respondToScreenParametersChanged:)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   684
			   withObject:notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   685
			   afterDelay:0];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   686
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   687
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   688
// Printing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   689
#pragma mark Printing
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   690
- (void)adiumPrint:(id)sender
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   691
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   692
	[contactListView print:sender];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   693
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   694
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   695
// Dock-like hiding -----------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   696
#pragma mark Dock-like hiding
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   697
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   698
+ (void)updateScreenSlideBoundaryRect:(id)sender
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   699
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   700
	NSArray *screens = [NSScreen screens];
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   701
	NSInteger numScreens = [screens count];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   702
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   703
	[screenSlideBoundaryRectDictionary release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   704
	screenSlideBoundaryRectDictionary = [[NSMutableDictionary alloc] initWithCapacity:numScreens];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   705
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   706
	if (numScreens > 0) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   707
		//The menubar screen is a special case - the menubar is not a part of the rect we're interested in
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   708
		NSScreen	*menubarScreen = [screens objectAtIndex:0];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   709
		NSRect		screenSlideBoundaryRect;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   710
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   711
		screenSlideBoundaryRect = [menubarScreen frame];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   712
		screenSlideBoundaryRect.size.height = NSMaxY([menubarScreen visibleFrame]) - NSMinY([menubarScreen frame]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   713
		[screenSlideBoundaryRectDictionary setObject:[NSValue valueWithRect:screenSlideBoundaryRect]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   714
											  forKey:[NSValue valueWithNonretainedObject:menubarScreen]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   715
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   716
		for (NSInteger i = 1; i < numScreens; i++) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   717
			NSScreen *screen = [screens objectAtIndex:i];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   718
			[screenSlideBoundaryRectDictionary setObject:[NSValue valueWithRect:[screen frame]]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   719
												  forKey:[NSValue valueWithNonretainedObject:screen]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   720
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   721
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   722
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   723
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   724
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   725
 * @brief Adium unhid
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   726
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   727
 * If the contact list is open but not visible when we unhide, we should always display it; it should not, however, steal focus.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   728
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   729
- (void)applicationDidUnhide:(NSNotification *)notification
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   730
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   731
	if (![[self window] isVisible]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   732
		[self showWindowInFrontIfAllowed:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   733
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   734
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   735
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   736
- (BOOL)windowShouldHideOnDeactivate
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   737
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   738
	return (windowHidingStyle == AIContactListWindowHidingStyleBackground);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   739
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   740
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   741
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   742
 * @brief Called on a delay by -[self slideWindowIfNeeded:]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   743
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   744
 * This is a separate function so that the call to it may be canceled if the mouse doesn't
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   745
 * remain in position long enough.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   746
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   747
- (void)slideWindowOnScreenAfterDelay
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   748
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   749
	waitingToSlideOnScreen = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   750
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   751
	//If we're hiding the window (generally) but now sliding it on screen, make sure it's on top
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   752
	if (windowHidingStyle == AIContactListWindowHidingStyleSliding) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   753
		[self setWindowLevel:NSFloatingWindowLevel];
2899
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   754
		[self setCollectionBehaviorOfWindow:[self window]
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   755
							showOnAllSpaces:YES
4e56ddef1aad Restore Expos? ignoring, using the new public API (a collection behavior bit) introduced for it in Snow Leopard. Obviously, this won't work on Leopard?but it won't hurt anything, either.
Peter Hosey <hg@boredzo.org>
parents: 2849
diff changeset
   756
							   isStationary:YES];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   757
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   758
		overrodeWindowLevel = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   759
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   760
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   761
	[self slideWindowOnScreen];	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   762
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   763
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   764
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   765
 * @brief Check what behavior the window should perform and initiate it
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   766
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   767
 * Called regularly by a repeating timer to check mouse position against window position.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   768
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   769
- (void)slideWindowIfNeeded:(id)sender
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   770
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   771
	if ([self shouldSlideWindowOnScreen]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   772
		if (!waitingToSlideOnScreen) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   773
			[self performSelector:@selector(slideWindowOnScreenAfterDelay)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   774
					   withObject:nil
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   775
					   afterDelay:WINDOW_SLIDING_DELAY];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   776
			waitingToSlideOnScreen = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   777
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   778
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   779
		if (waitingToSlideOnScreen) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   780
			/* If we were waiting to slide on screen but the mouse moved out of position too soon,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   781
			 * cancel the selector which would slide us on screen.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   782
			 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   783
			waitingToSlideOnScreen = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   784
			[[self class] cancelPreviousPerformRequestsWithTarget:self
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   785
														 selector:@selector(slideWindowOnScreenAfterDelay)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   786
														   object:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   787
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   788
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   789
		if ([self shouldSlideWindowOffScreen]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   790
			AIRectEdgeMask adjacentEdges = [self slidableEdgesAdjacentToWindow];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   791
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   792
			if (adjacentEdges & (AIMinXEdgeMask | AIMaxXEdgeMask)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   793
				[self slideWindowOffScreenEdges:(adjacentEdges & (AIMinXEdgeMask | AIMaxXEdgeMask))];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   794
			} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   795
				[self slideWindowOffScreenEdges:adjacentEdges];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   796
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   797
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   798
			/* If we're hiding the window (generally) but now sliding it off screen, set it to kCGBackstopMenuLevel and don't
4234
f724feac97c0 Make this UTF8
Stephen Holt <sholt@adium.im>
parents: 4229
diff changeset
   799
			 * let it participate in expos????.
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   800
			 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   801
			if (overrodeWindowLevel &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   802
				windowHidingStyle == AIContactListWindowHidingStyleSliding) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   803
				[self setWindowLevel:kCGBackstopMenuLevel];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   804
				
3753
3de7cec9b4d4 Backed out changeset 4b8d5b913c9b
Stephen Holt <sholt@adium.im>
parents: 3752
diff changeset
   805
				[[self window] setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   806
				
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   807
				overrodeWindowLevel = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   808
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   809
			
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   810
		} else if (overrodeWindowLevel &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   811
				   ([self slidableEdgesAdjacentToWindow] == AINoEdges) &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   812
				   ([self windowSlidOffScreenEdgeMask] == AINoEdges)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   813
			/* If the window level was overridden at some point and now we:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   814
			 *   1. Are on screen AND
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   815
			 *   2. No longer have any edges eligible for sliding
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   816
			 * we should restore our window level.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   817
			 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   818
			[self setWindowLevel:levelForAIWindowLevel(windowLevel)];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   819
			
3753
3de7cec9b4d4 Backed out changeset 4b8d5b913c9b
Stephen Holt <sholt@adium.im>
parents: 3752
diff changeset
   820
			[[self window] setCollectionBehavior:showOnAllSpaces ? NSWindowCollectionBehaviorCanJoinAllSpaces : NSWindowCollectionBehaviorDefault];
3de7cec9b4d4 Backed out changeset 4b8d5b913c9b
Stephen Holt <sholt@adium.im>
parents: 3752
diff changeset
   821
			
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   822
			overrodeWindowLevel = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   823
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   824
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   825
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   826
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   827
- (BOOL)shouldSlideWindowOnScreen
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   828
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   829
	BOOL shouldSlide = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   830
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   831
	if (([self windowSlidOffScreenEdgeMask] != AINoEdges) &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   832
		![NSApp isHidden]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   833
		if (slideOnlyInBackground && [NSApp isActive]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   834
			//We only slide while in the background, and the app is not in the background. Slide on screen.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   835
			shouldSlide = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   836
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   837
		} else if (windowHidingStyle == AIContactListWindowHidingStyleSliding) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   838
			//Slide on screen if the mouse position indicates we should
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   839
			shouldSlide = [self shouldSlideWindowOnScreen_mousePositionStrategy];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   840
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   841
			//It's slid off-screen... and it's not supposed to be sliding at all.  Slide back on screen!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   842
			shouldSlide = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   843
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   844
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   845
	return shouldSlide;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   846
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   847
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   848
- (BOOL)shouldSlideWindowOffScreen
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   849
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   850
	BOOL shouldSlide = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   851
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   852
	if ((windowHidingStyle == AIContactListWindowHidingStyleSliding) &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   853
		!preventHiding &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   854
		([self windowSlidOffScreenEdgeMask] == AINoEdges) &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   855
		(!(slideOnlyInBackground && [NSApp isActive]))) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   856
		shouldSlide = [self shouldSlideWindowOffScreen_mousePositionStrategy];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   857
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   858
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   859
	return shouldSlide;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   860
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   861
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   862
// slide off screen if the window is aligned to a screen edge and the mouse is not in the strip of screen 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   863
// you'd get by translating the window along the screen edge.  This is the dock's behavior.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   864
- (BOOL)shouldSlideWindowOffScreen_mousePositionStrategy
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   865
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   866
	BOOL shouldSlideOffScreen = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   867
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   868
	NSWindow *window = [self window];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   869
	NSRect windowFrame = [window frame];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   870
	NSPoint mouseLocation = [NSEvent mouseLocation];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   871
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   872
	AIRectEdgeMask slidableEdgesAdjacentToWindow = [self slidableEdgesAdjacentToWindow];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   873
	NSRectEdge screenEdge;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   874
	for (screenEdge = 0; screenEdge < 4; screenEdge++) {		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   875
		if (slidableEdgesAdjacentToWindow & (1 << screenEdge)) {
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   876
			CGFloat distanceMouseOutsideWindow = AISignedExteriorDistanceRect_edge_toPoint_(windowFrame, AIOppositeRectEdge_(screenEdge), mouseLocation);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   877
			if (distanceMouseOutsideWindow > WINDOW_SLIDING_MOUSE_DISTANCE_TOLERANCE)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   878
				shouldSlideOffScreen = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   879
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   880
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   881
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   882
	/* Don't allow the window to slide off if the user is dragging
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   883
	 * This method is hacky and does not completely work.  is there a way to detect if the mouse is down?
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   884
	 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   885
	NSEventType currentEventType = [[NSApp currentEvent] type];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   886
	if (currentEventType == NSLeftMouseDragged ||
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   887
		currentEventType == NSRightMouseDragged ||
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   888
		currentEventType == NSOtherMouseDragged ||
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   889
		currentEventType == NSPeriodic) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   890
		shouldSlideOffScreen = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   891
	}	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   892
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   893
	return shouldSlideOffScreen;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   894
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   895
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   896
// note: may be inaccurate when mouse is up against an edge 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   897
- (NSScreen *)screenForPoint:(NSPoint)point
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   898
{
2105
03fdedb44c06 A bit more. Getting bored now, so this is probably the last for a little while
David Smith <catfish.man@gmail.com>
parents: 2103
diff changeset
   899
	for (NSScreen *pointScreen in [NSScreen screens]) {
2106
93eace207ab3 Doh, forgot to test that one. Fix build
David Smith <catfish.man@gmail.com>
parents: 2105
diff changeset
   900
		if (NSPointInRect(point, NSInsetRect([pointScreen frame], -1, -1)))
2105
03fdedb44c06 A bit more. Getting bored now, so this is probably the last for a little while
David Smith <catfish.man@gmail.com>
parents: 2103
diff changeset
   901
			return pointScreen;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   902
	}
2106
93eace207ab3 Doh, forgot to test that one. Fix build
David Smith <catfish.man@gmail.com>
parents: 2105
diff changeset
   903
	return nil;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   904
}	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   905
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   906
- (NSRect)squareRectWithCenter:(NSPoint)point sideLength:(CGFloat)sideLength
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   907
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   908
	return NSMakeRect(point.x - sideLength*0.5f, point.y - sideLength*0.5f, sideLength, sideLength);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   909
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   910
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   911
- (BOOL)pointIsInScreenCorner:(NSPoint)point
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   912
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   913
	BOOL inCorner = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   914
	NSScreen *menubarScreen = [[NSScreen screens] objectAtIndex:0];
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   915
	CGFloat menubarHeight = NSMaxY([menubarScreen frame]) - NSMaxY([menubarScreen visibleFrame]); // breaks if the dock is at the top of the screen (i.e. if the user is insane)
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   916
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   917
	NSRect screenFrame = [[self screenForPoint:point] frame];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   918
	NSPoint lowerLeft  = screenFrame.origin;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   919
	NSPoint upperRight = NSMakePoint(NSMaxX(screenFrame), NSMaxY(screenFrame));
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   920
	NSPoint lowerRight = NSMakePoint(upperRight.x, lowerLeft.y);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   921
	NSPoint upperLeft  = NSMakePoint(lowerLeft.x, upperRight.y);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   922
	
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
   923
	CGFloat sideLength = menubarHeight * 2.0f;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   924
	inCorner = (NSPointInRect(point, [self squareRectWithCenter:lowerLeft sideLength:sideLength])
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   925
				|| NSPointInRect(point, [self squareRectWithCenter:lowerRight sideLength:sideLength])
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   926
				|| NSPointInRect(point, [self squareRectWithCenter:upperLeft sideLength:sideLength])
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   927
				|| NSPointInRect(point, [self squareRectWithCenter:upperRight sideLength:sideLength]));
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   928
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   929
	return inCorner;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   930
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   931
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   932
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   933
 * @brief Should the window be slid on screen given the mouse's position?
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   934
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   935
 * This method will never return YES of the cl is slid into a corner, which shouldn't happen, or if the mouse is in a corner.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   936
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   937
 * @result YES if the mouse is against all edges of the screen where we previously slid the window and not in a corner.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   938
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   939
- (BOOL)shouldSlideWindowOnScreen_mousePositionStrategy
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   940
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   941
	if ([self windowSlidOffScreenEdgeMask] != AINoEdges) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   942
		NSPoint mouseLocation = [NSEvent mouseLocation];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   943
		//Initially, assume the mouse is not in an appropriate position
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   944
		BOOL	mouseNearSlideOffEdges = NO;
204
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   945
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   946
		NSRectEdge	screenEdge;
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   947
		NSRect		screenSlideBoundaryRect = [[screenSlideBoundaryRectDictionary objectForKey:[NSValue valueWithNonretainedObject:windowLastScreen]] rectValue];
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   948
		/* Only look at the screen in which the mouse currently resides.
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   949
		 * The mouse may be in no screen if it is over the menu bar.
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   950
		 */
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   951
		if (NSPointInRect(mouseLocation, screenSlideBoundaryRect)) {
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   952
			//Check each edge
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   953
			for (screenEdge = 0; screenEdge < 4; screenEdge++) {
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   954
				//But we only care about an edge off of which the window has slid
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   955
				if (windowSlidOffScreenEdgeMask & (1 << screenEdge)) {
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   956
					CGFloat mouseOutsideSlideBoundaryRectDistance = AISignedExteriorDistanceRect_edge_toPoint_(screenSlideBoundaryRect,
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   957
																											   screenEdge,
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   958
																											   mouseLocation);
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   959
					//The mouse must be within MOUSE_EDGE_SLIDE_ON_DISTANCE of every slid-off edge to bring the window back on-screen
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   960
					if(mouseOutsideSlideBoundaryRectDistance < -MOUSE_EDGE_SLIDE_ON_DISTANCE) {
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   961
						mouseNearSlideOffEdges = NO;
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   962
						break;
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   963
					} else {
e02f91fc6d28 Only look at the edges of the screen the window slid off of when determining if the contact list should slide back onto the screen. I think this is right, but I can't test it on a multiscreen setup right now. Fixes #10204, I believe, as well as the ticket like it which I can't (and jas8522 couldn't) find
Evan Schoenberg
parents: 100
diff changeset
   964
						mouseNearSlideOffEdges = YES;							
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   965
					}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   966
				}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   967
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   968
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   969
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   970
		return mouseNearSlideOffEdges && ![self pointIsInScreenCorner:mouseLocation];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   971
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   972
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   973
		return NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   974
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   975
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   976
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   977
#pragma mark Dock-like hiding
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   978
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   979
- (NSScreen *)windowLastScreen
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   980
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   981
	return windowLastScreen;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   982
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   983
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   984
- (BOOL)animationShouldStart:(NSAnimation *)animation
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   985
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   986
	if(![animation isEqual:windowAnimation])
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   987
		return YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   988
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   989
	//Whenever an animation starts, we should be using the normal shadow setting
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   990
	[[self window] setHasShadow:listHasShadow];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   991
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   992
	//Don't let docking interfere with the animation
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   993
	if ([[self window] respondsToSelector:@selector(setDockingEnabled:)])
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   994
		[(id)[self window] setDockingEnabled:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   995
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   996
	if (windowSlidOffScreenEdgeMask == AINoEdges) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   997
		[[self window] setAlphaValue:previousAlpha];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   998
		AILogWithSignature(@"Set window to previous alpha of %f", previousAlpha);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   999
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1000
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1001
	return YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1002
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1003
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1004
- (void)animationDidEnd:(NSAnimation*)animation
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1005
{
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1006
	if([animation isEqual:windowAnimation]) {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1007
		//Restore docking behavior	
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1008
		if ([[self window] respondsToSelector:@selector(setDockingEnabled:)])
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1009
			[(id)[self window] setDockingEnabled:YES];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1010
		
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1011
		if (windowSlidOffScreenEdgeMask == AINoEdges) {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1012
			//When the window is offscreen, its horizontal autosizing can't occur. Size it now.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1013
			[contactListController contactListDesiredSizeChanged];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1014
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1015
		} else {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1016
			//Offscreen windows should be told not to cast a shadow
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1017
			[[self window] setHasShadow:NO];	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1018
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1019
			previousAlpha = [[self window] alphaValue];
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
  1020
			[[self window] setAlphaValue:0.0f];
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1021
			AILogWithSignature(@"Previous alpha is now %f; window set to alpha 0.0 ", previousAlpha);
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1022
		}
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1023
		
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1024
		self.windowAnimation = nil;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1025
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1026
	
1465
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1027
	if (animation == filterBarAnimation) {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1028
		if (filterBarIsVisible) {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1029
			// If the filter bar is already visible, remove it from its superview.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1030
			[filterBarView removeFromSuperview];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1031
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1032
			// Set the first responder back to the contact list view.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1033
			[[self window] makeFirstResponder:contactListView];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1034
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1035
			[contactListView selectItemsInArray:filterBarPreviouslySelected];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1036
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1037
			// Since this wasn't a user-initiated selection change, we need to post a notification for it.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1038
			[[NSNotificationCenter defaultCenter] postNotificationName:Interface_ContactSelectionChanged
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1039
																object:nil];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1040
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1041
			[filterBarPreviouslySelected release]; filterBarPreviouslySelected = nil;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1042
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1043
			filterBarIsVisible = NO;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1044
		} else {
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1045
			// If the filter bar wasn't visible, make it the first responder.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1046
			[[self window] makeFirstResponder:searchField]; 
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1047
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1048
			// Set the filter bar as the next responder so the chain works for things like the info inspector
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1049
			[filterBarView setNextResponder:contactListView];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1050
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1051
			// Bring the contact list to front, in case the find command was triggered from another window like the info inspector
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1052
			[[self window] makeKeyAndOrderFront:nil];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1053
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1054
			filterBarPreviouslySelected = [[contactListView arrayOfSelectedItems] retain];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1055
			
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1056
			filterBarIsVisible = YES;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1057
		}
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1058
		
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1059
		// Let the contact list controller know that our size has changed.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1060
		[contactListController contactListDesiredSizeChanged];
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1061
		
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1062
		// We're no longer animating.
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1063
		self.filterBarAnimation = nil;
40e39185b8e2 Copy and paste all of the filtering code from AIStandardListWindowController into AIListWindowController. This is currently a little ugly, but it works. Refs #10489.
Zachary West <zacw@adiumx.com>
parents: 1395
diff changeset
  1064
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1065
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1066
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1067
- (BOOL)keepListOnScreenWhenSliding
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1068
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1069
	return NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1070
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1071
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1072
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1073
 * @brief Slide the window to a given point
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1074
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1075
 * windowSlidOffScreenEdgeMask must already be set to the resulting offscreen mask (or 0 if the window is sliding on screen)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1076
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1077
 * A standard window (titlebar window) will crash if told to setFrame completely offscreen. Also, using our own movement we can more precisely
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1078
 * control the movement speed and acceleration.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1079
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1080
- (void)slideWindowToPoint:(NSPoint)targetPoint
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1081
{	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1082
	NSWindow				*myWindow = [self window];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1083
	NSScreen				*windowScreen;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1084
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1085
	windowScreen = [myWindow screen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1086
	if (!windowScreen) windowScreen = [self windowLastScreen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1087
	if (!windowScreen) windowScreen = [NSScreen mainScreen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1088
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1089
	NSRect	frame = [myWindow frame];
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
  1090
	CGFloat yOff = (targetPoint.y + NSHeight(frame)) - NSMaxY([windowScreen frame]);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1091
	if (windowScreen == [[NSScreen screens] objectAtIndex:0]) yOff -= [[NSApp mainMenu] menuBarHeight];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1092
	if (yOff > 0) targetPoint.y -= yOff;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1093
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1094
	frame.origin = targetPoint;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1095
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1096
	if ((windowSlidOffScreenEdgeMask != AINoEdges) &&
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1097
		[self keepListOnScreenWhenSliding]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1098
		switch (windowSlidOffScreenEdgeMask) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1099
			case AIMinXEdgeMask:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1100
				frame.origin.x += 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1101
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1102
			case AIMaxXEdgeMask:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1103
				frame.origin.x -= 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1104
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1105
			case AIMaxYEdgeMask:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1106
				frame.origin.y -= 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1107
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1108
			case AIMinYEdgeMask:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1109
				frame.origin.y += 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1110
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1111
			case AINoEdges:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1112
				//We'll never get here
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1113
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1114
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1115
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1116
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1117
	if (windowAnimation) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1118
		[windowAnimation stopAnimation];
627
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1119
		self.windowAnimation = nil;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1120
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1121
627
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1122
	self.windowAnimation = [[[NSViewAnimation alloc] initWithViewAnimations:
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1123
							 [NSArray arrayWithObject:
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1124
							  [NSDictionary dictionaryWithObjectsAndKeys:
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1125
							   myWindow, NSViewAnimationTargetKey,
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1126
							   [NSValue valueWithRect:frame], NSViewAnimationEndFrameKey,
f58c79417c40 Properterize these NSViewAnimation ivars, simplifying memory management
Evan Schoenberg
parents: 626
diff changeset
  1127
							   nil]]] autorelease];
3087
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
  1128
	[windowAnimation setFrameRate:0.0f];
30703336e5b6 Resolve implicit 64->32 bit castings in Adium.app
Stephen Holt <sholt@adium.im>
parents: 2916
diff changeset
  1129
	[windowAnimation setDuration:0.25f];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1130
	[windowAnimation setDelegate:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1131
	[windowAnimation setAnimationBlockingMode:NSAnimationNonblocking];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1132
	[windowAnimation startAnimation];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1133
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1134
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1135
- (void)moveWindowToPoint:(NSPoint)inOrigin
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1136
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1137
	[[self window] setFrameOrigin:inOrigin];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1138
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1139
	if (windowSlidOffScreenEdgeMask == AINoEdges) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1140
		/* When the window is offscreen, there are no constraints on its size, for example it will grow downwards as much as
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1141
		* it needs to to accomodate new rows.  Now that it's onscreen, there are constraints.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1142
		*/
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1143
		[contactListController contactListDesiredSizeChanged];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1144
		[[self window] setAlphaValue:previousAlpha];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1145
		AILogWithSignature(@"Set window to previous alpha of %f", previousAlpha);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1146
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1147
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1148
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1149
static BOOL AIScreenRectEdgeAdjacentToAnyOtherScreen(NSRectEdge edge, NSScreen *screen)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1150
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1151
	NSArray  *screens = [NSScreen screens];
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
  1152
	NSUInteger numScreens = [screens count];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1153
	if (numScreens > 1) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1154
		NSRect	screenSlideBoundaryRect = [[screenSlideBoundaryRectDictionary objectForKey:[NSValue valueWithNonretainedObject:screen]] rectValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1155
		NSRect	shiftedScreenFrame = screenSlideBoundaryRect;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1156
		BOOL	isAdjacent = NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1157
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1158
		switch(edge) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1159
			case NSMinXEdge:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1160
				shiftedScreenFrame.origin.x -= 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1161
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1162
			case NSMinYEdge:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1163
				shiftedScreenFrame.origin.y -= 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1164
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1165
			case NSMaxXEdge:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1166
				shiftedScreenFrame.size.width += 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1167
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1168
			case NSMaxYEdge:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1169
				shiftedScreenFrame.size.height += 1;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1170
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1171
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1172
3
f0cc4d307eb8 Merge 64 bit branch to trunk. Fingers crossed, and I have been testing it some, but expect fallout from this. 11,000 line diffs are rarely without consequence ;)
David Smith
parents: 0
diff changeset
  1173
		for (NSInteger i = 0; i < numScreens; i++) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1174
			NSScreen *otherScreen = [screens objectAtIndex:i];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1175
			if (otherScreen != screen) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1176
				if (NSIntersectsRect([otherScreen frame], shiftedScreenFrame)) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1177
					isAdjacent = YES;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1178
					break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1179
				}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1180
			}	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1181
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1182
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1183
		return isAdjacent;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1184
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1185
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1186
		return NO;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1187
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1188
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1189
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1190
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1191
 * @brief Find the mask specifying what edges are potentially slidable for our window
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1192
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1193
 * @result AIRectEdgeMask, which is 0 if no edges are slidable
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1194
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1195
- (AIRectEdgeMask)slidableEdgesAdjacentToWindow
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1196
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1197
	AIRectEdgeMask slidableEdges = 0;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1198
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1199
	NSWindow *window = [self window];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1200
	NSRect	 windowFrame = [window frame];	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1201
	NSScreen *windowScreen = [window screen];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1202
	NSRect	 screenSlideBoundaryRect = [[screenSlideBoundaryRectDictionary objectForKey:[NSValue valueWithNonretainedObject:windowScreen]] rectValue];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1203</