Frameworks/Adium Framework/Source/AIListCell.m
author Evan Schoenberg
Thu, 14 Nov 2019 21:09:06 -0500
branchadium-1.5.11
changeset 6016 325e2ab3406f
parent 4161 8de0a4e32e42
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 <Adium/AIListCell.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 <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
    20
#import <Adium/AIListObject.h>
1697
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
    21
#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
    22
#import <Adium/AIListBookmark.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/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
    24
#import <AIUtilities/AIAttributedStringAdditions.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/AIBezierPathAdditions.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/AIMutableOwnerArray.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/AIParagraphStyleAdditions.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
    28
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    29
#import <Adium/AIStatusControllerProtocol.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
    30
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
//#define	ORDERING_DEBUG
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    34
@implementation AIListCell
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
static NSMutableParagraphStyle	*leftParagraphStyleWithTruncatingTail = 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
    37
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    38
//Init
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    39
- (id)init
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    40
{
e22ad6bc8b46 svn 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
    if ((self = [super init]))
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    42
	{
e22ad6bc8b46 svn 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
		   topSpacing = 
e22ad6bc8b46 svn 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
		bottomSpacing = 
e22ad6bc8b46 svn 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
		  leftSpacing = 
e22ad6bc8b46 svn 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
		 rightSpacing = 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
    47
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    48
		   topPadding = 
e22ad6bc8b46 svn 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
		bottomPadding = 
e22ad6bc8b46 svn 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
		  leftPadding = 
e22ad6bc8b46 svn 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
		 rightPadding = 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
    52
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    53
		font = [[NSFont systemFontOfSize:12] 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
    54
		textColor = [[NSColor blackColor] 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
    55
		invertedTextColor = [[NSColor whiteColor] 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
    56
		
e22ad6bc8b46 svn 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
		useAliasesAsRequested = 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
    58
e22ad6bc8b46 svn 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
		if (!leftParagraphStyleWithTruncatingTail) {
e22ad6bc8b46 svn 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
			leftParagraphStyleWithTruncatingTail = [[NSMutableParagraphStyle styleWithAlignment:NSLeftTextAlignment
e22ad6bc8b46 svn 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
																				  lineBreakMode:NSLineBreakByTruncatingTail] 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
    62
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    63
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    64
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    65
		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    66
    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
    67
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    68
e22ad6bc8b46 svn 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
//Copy
e22ad6bc8b46 svn 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
- (id)copyWithZone:(NSZone *)zone
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	AIListCell *newCell = [super copyWithZone:zone];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    73
1697
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
    74
	newCell->proxyObject = nil;
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
    75
	[newCell setProxyListObject:proxyObject];
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
    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
	[newCell->font 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
    78
	[newCell->textColor 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
    79
	[newCell->invertedTextColor 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
    80
e22ad6bc8b46 svn 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
	return newCell;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
//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
    85
- (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
    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
	[textColor 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
    88
	[invertedTextColor 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
    89
	
e22ad6bc8b46 svn 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
	[font 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
    91
	
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
    92
	[proxyObject release];
1736
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
    93
	[labelAttributes release];
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
    94
e22ad6bc8b46 svn 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
	[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
    96
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
//Set the list object being drawn
1697
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
    99
- (void)setProxyListObject:(AIProxyListObject *)inProxyObject
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
   100
{
1697
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
   101
	if (proxyObject != inProxyObject) {
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
   102
		[proxyObject release];
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
   103
		proxyObject = [inProxyObject retain];
731cbe78d12d Cells need the proxyObject for cases in which the object will be fed back to the controlView (checking to see if it's expanded, for example). This fixes display of the group toggle and a few other display issues
Evan Schoenberg
parents: 1481
diff changeset
   104
	}
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
   105
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   106
	isGroup = [[proxyObject listObject] isKindOfClass:[AIListGroup class]];
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
   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
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   109
@synthesize isGroup, outlineControlView;
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 that this cell is draggable
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   112
- (NSCellHitResult)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView
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
   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
	return NSCellHitContentArea;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
//Display options ------------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 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
#pragma mark Display options
e22ad6bc8b46 svn 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
//Font used to display label
e22ad6bc8b46 svn 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
- (void)setFont:(NSFont *)inFont
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	if (inFont != font) {
e22ad6bc8b46 svn 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
		[font 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
   124
		font = [inFont 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
   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
e22ad6bc8b46 svn 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
	//Calculate and cache the height of this font
e22ad6bc8b46 svn 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
	labelFontHeight = [[[[NSLayoutManager alloc] init] autorelease] defaultLineHeightForFont:[self font]]; 
1736
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   129
	[labelAttributes release]; labelAttributes = 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
   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
- (NSFont *)font{
e22ad6bc8b46 svn 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
	return font;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   135
@synthesize textAlignment, textColor, invertedTextColor;
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
   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
//Cell sizing and padding ----------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 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
#pragma mark Cell sizing and padding
e22ad6bc8b46 svn 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
//Default cell size just contains our padding and spacing
e22ad6bc8b46 svn 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
- (NSSize)cellSize
e22ad6bc8b46 svn 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
	return NSMakeSize(0, [self topSpacing] + [self topPadding] + [self bottomPadding] + [self bottomSpacing]);
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   145
- (CGFloat)cellWidth
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
   146
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   147
	return [self leftSpacing] + [self leftPadding] + [self rightPadding] + [self rightSpacing];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   148
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   149
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   150
//User-defined spacing offsets.  A cell may adjust these values to to obtain a more desirable default. 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   151
//These are offsets, they may be negative!  Spacing is the distance between cells (Spacing gaps are not filled).
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   152
- (void)setSplitVerticalSpacing:(int)inSpacing{
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   153
	self.topSpacing = inSpacing / 2;
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   154
	self.bottomSpacing = (inSpacing + 1) / 2;
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
   155
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   156
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   157
//User-defined padding offsets.  A cell may adjust these values to to obtain a more desirable default.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   158
//These are offsets, they may be negative!  Padding is the distance between cell edges and their content.
e22ad6bc8b46 svn 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
- (void)setSplitVerticalPadding:(int)inPadding{
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   160
	self.topPadding = inPadding / 2;
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   161
	self.bottomPadding = (inPadding + 1) / 2;
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
   162
}
e22ad6bc8b46 svn 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
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   164
@synthesize rightPadding, leftPadding, topPadding, bottomPadding, indentation, rightSpacing, leftSpacing, topSpacing, bottomSpacing;
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
   165
e22ad6bc8b46 svn 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
//Drawing --------------------------------------------------------------------------------------------------------------
e22ad6bc8b46 svn 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
#pragma mark Drawing
e22ad6bc8b46 svn 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
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)inControlView{
e22ad6bc8b46 svn 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
    [self drawInteriorWithFrame:cellFrame inView:inControlView];
e22ad6bc8b46 svn 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
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)inControlView
e22ad6bc8b46 svn 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
{	
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   173
	if ([proxyObject listObject]) {
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
   174
		//Cell spacing
e22ad6bc8b46 svn 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
		cellFrame.origin.y += [self topSpacing];
e22ad6bc8b46 svn 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
		cellFrame.size.height -= [self bottomSpacing] + [self topSpacing];
e22ad6bc8b46 svn 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
		cellFrame.origin.x += [self leftSpacing];
e22ad6bc8b46 svn 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
		cellFrame.size.width -= [self rightSpacing] + [self leftSpacing];
e22ad6bc8b46 svn 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
		
e22ad6bc8b46 svn 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
		[self drawBackgroundWithFrame:cellFrame];
e22ad6bc8b46 svn 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
		//Padding
e22ad6bc8b46 svn 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
		cellFrame.origin.y += [self topPadding];
e22ad6bc8b46 svn 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
		cellFrame.size.height -= [self bottomPadding] + [self topPadding];
e22ad6bc8b46 svn 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
		cellFrame.origin.x += [self leftPadding];
e22ad6bc8b46 svn 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
		cellFrame.size.width -= [self rightPadding] + [self leftPadding];
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
		switch ([self textAlignment]) {
e22ad6bc8b46 svn 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
			case NSRightTextAlignment:
e22ad6bc8b46 svn 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
				//Right alignment indents on the right
e22ad6bc8b46 svn 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
				cellFrame.size.width -= [self indentation];
e22ad6bc8b46 svn 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
				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
   193
			default:
e22ad6bc8b46 svn 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
				//All other alignments indent on the left
e22ad6bc8b46 svn 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
				cellFrame.origin.x += [self indentation];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   196
				cellFrame.size.width -= [self indentation];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   197
				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
   198
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   199
		[self drawContentWithFrame:cellFrame];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   200
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   201
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   202
3002
fb91aa1dd64f Removed a warning, replacing it with an explanation
Evan Schoenberg
parents: 2924
diff changeset
   203
/* Custom highlighting (This is a private cell method we're overriding that handles selection drawing)
fb91aa1dd64f Removed a warning, replacing it with an explanation
Evan Schoenberg
parents: 2924
diff changeset
   204
 * Bubble and Mockie Cells depend upon drawSelectionWithFrame: being called from here; perhaps we could call that
fb91aa1dd64f Removed a warning, replacing it with an explanation
Evan Schoenberg
parents: 2924
diff changeset
   205
 * from elsewhere.
fb91aa1dd64f Removed a warning, replacing it with an explanation
Evan Schoenberg
parents: 2924
diff changeset
   206
 */
2924
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   207
- (void)_drawHighlightWithFrame:(NSRect)cellFrame inView:(NSView *)inControlView
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   208
{
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   209
	//Cell spacing
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   210
	cellFrame.origin.y += [self topSpacing];
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   211
	cellFrame.size.height -= [self bottomSpacing] + [self topSpacing];
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   212
	cellFrame.origin.x += [self leftSpacing];
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   213
	cellFrame.size.width -= [self rightSpacing] + [self leftSpacing];
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   214
	
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   215
	[self drawSelectionWithFrame:cellFrame];
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   216
}
629e1040f326 Backed out changeset b86536983564: As with previous reversion, back out change which removed an override of a private method I didn't think we need but which appears to have created odd behavior... despite not seemingly being called. Hm.
Evan Schoenberg
parents: 2918
diff changeset
   217
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
   218
//Draw Selection
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   219
- (void)drawSelectionWithFrame:(NSRect)rect {}
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
   220
	
e22ad6bc8b46 svn 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
//Draw the background of our cell
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   222
- (void)drawBackgroundWithFrame:(NSRect)rect {}
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
   223
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   224
//Draw content of our cell
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   225
- (void)drawContentWithFrame:(NSRect)rect
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   226
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   227
	[self drawDisplayNameWithFrame:rect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   228
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   229
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   230
- (void)drawDropHighlightWithFrame:(NSRect)rect
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   231
{	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   232
	[NSGraphicsContext saveGraphicsState];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   233
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   234
	//Ensure we don't draw outside our rect
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   235
	[[NSBezierPath bezierPathWithRect:rect] addClip];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   236
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   237
	rect.size.width -= DROP_HIGHLIGHT_WIDTH_MARGIN;
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   238
	rect.origin.x += DROP_HIGHLIGHT_WIDTH_MARGIN / 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
   239
	
e22ad6bc8b46 svn 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
	rect.size.height -= DROP_HIGHLIGHT_HEIGHT_MARGIN;
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   241
	rect.origin.y += DROP_HIGHLIGHT_HEIGHT_MARGIN / 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
   242
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   243
	NSBezierPath	*path = [NSBezierPath bezierPathWithRoundedRect:rect radius:4.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
   244
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   245
	[[[NSColor blueColor] colorWithAlphaComponent:0.2f] set];
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
   246
	[path fill];
e22ad6bc8b46 svn 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
	
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   248
	[[[NSColor blueColor] colorWithAlphaComponent:0.8f] set];
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   249
	[path setLineWidth: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
   250
	[path stroke];
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
	[NSGraphicsContext restoreGraphicsState];	
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   254
152
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   255
/*!
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   256
 * @brief Return the attributed string to be displayed as the primary text of the cell
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   257
 */
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   258
- (NSAttributedString *)displayName
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   259
{
1745
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   260
	NSDictionary *attributes = self.labelAttributes;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   261
	NSString *labelString = self.labelString;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   262
	if (![labelAttributes isEqualToDictionary:proxyObject.cachedLabelAttributes] || ![labelString isEqualToString:proxyObject.cachedDisplayNameString]) {
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   263
		proxyObject.cachedDisplayName = [[[NSAttributedString alloc] initWithString:labelString
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   264
																		 attributes:attributes] autorelease];
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   265
		proxyObject.cachedDisplayNameString = labelString;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   266
		proxyObject.cachedLabelAttributes = attributes;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   267
		proxyObject.cachedDisplayNameSize = NSZeroSize;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   268
	}
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   269
	
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   270
	return proxyObject.cachedDisplayName;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   271
}
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   272
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   273
- (NSSize) displayNameSize
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   274
{
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   275
	NSSize size = proxyObject.cachedDisplayNameSize;
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   276
	if(NSEqualSizes(size, NSZeroSize)) {
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   277
		size = [self.displayName size];
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   278
		proxyObject.cachedDisplayNameSize = size; 
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   279
	}
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   280
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   281
	return size;
152
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   282
}
b0ab966f8bb2 Fixed display of group counts for contact bubbles to fit. Fixes #10279
Evan Schoenberg
parents: 151
diff changeset
   283
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
   284
//Draw our display 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
   285
- (NSRect)drawDisplayNameWithFrame:(NSRect)inRect
e22ad6bc8b46 svn 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
{
837
ea0e003be6c6 Dot syntax. Lots of it.
David Smith
parents: 152
diff changeset
   287
	NSAttributedString	*displayName = self.displayName;
1745
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   288
	NSSize				nameSize = self.displayNameSize;
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
   289
	NSRect				rect = inRect;
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   291
	if (nameSize.width > rect.size.width) nameSize.width = rect.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
   292
	if (nameSize.height > rect.size.height) nameSize.height = rect.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
   293
e22ad6bc8b46 svn 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
	//Alignment
1726
269d511cb54c Revert [26937], it was wrong
David Smith
parents: 1725
diff changeset
   295
	switch ([self textAlignment]) {
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
   296
		case NSCenterTextAlignment:
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   297
			rect.origin.x += (rect.size.width - nameSize.width) / 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
   298
		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
   299
		case NSRightTextAlignment:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   300
			rect.origin.x += (rect.size.width - nameSize.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
   301
		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
   302
		default:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   303
		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
   304
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   305
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   306
	//Draw (centered vertical)
3074
c867117688bb Resolve implicit 64->32 bit castings in Adium.framework
Stephen Holt <sholt@adium.im>
parents: 3002
diff changeset
   307
	CGFloat half = AIceil((rect.size.height - labelFontHeight) / 2.0f);
1726
269d511cb54c Revert [26937], it was wrong
David Smith
parents: 1725
diff changeset
   308
	[displayName drawInRect:NSMakeRect(rect.origin.x,
269d511cb54c Revert [26937], it was wrong
David Smith
parents: 1725
diff changeset
   309
									   rect.origin.y + half,
269d511cb54c Revert [26937], it was wrong
David Smith
parents: 1725
diff changeset
   310
									   rect.size.width,
269d511cb54c Revert [26937], it was wrong
David Smith
parents: 1725
diff changeset
   311
									   nameSize.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
   312
e22ad6bc8b46 svn 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
	//Adjust the drawing rect
1726
269d511cb54c Revert [26937], it was wrong
David Smith
parents: 1725
diff changeset
   314
	switch ([self textAlignment]) {
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
   315
		case NSRightTextAlignment:
e22ad6bc8b46 svn 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
			inRect.size.width -= nameSize.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
   317
		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
   318
		case NSLeftTextAlignment:
e22ad6bc8b46 svn 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
			inRect.origin.x += nameSize.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
   320
			inRect.size.width -= nameSize.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
   321
		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
   322
		default:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   323
		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
   324
	}
e22ad6bc8b46 svn 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
	return inRect;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   329
//Display string for our list 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
   330
- (NSString *)labelString
e22ad6bc8b46 svn 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
{
937
6a189e1927af Work around an issue with metacontacts... hopefully this is temporary
David Smith
parents: 837
diff changeset
   332
	NSString *label =  ([self shouldShowAlias] ? 
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   333
						[[proxyObject listObject] longDisplayName] :
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   334
						([proxyObject listObject].formattedUID ? [proxyObject listObject].formattedUID : [[proxyObject listObject] longDisplayName]));
937
6a189e1927af Work around an issue with metacontacts... hopefully this is temporary
David Smith
parents: 837
diff changeset
   335
	if (!label) {
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   336
		AILog(@"Couldn't get a labelString for contact %@", [proxyObject listObject]);
937
6a189e1927af Work around an issue with metacontacts... hopefully this is temporary
David Smith
parents: 837
diff changeset
   337
		return @"";
6a189e1927af Work around an issue with metacontacts... hopefully this is temporary
David Smith
parents: 837
diff changeset
   338
	}
6a189e1927af Work around an issue with metacontacts... hopefully this is temporary
David Smith
parents: 837
diff changeset
   339
	return label;
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
   340
}
e22ad6bc8b46 svn 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
1481
35045c2c8487 Mmmm properties
David Smith
parents: 937
diff changeset
   342
@synthesize shouldShowAlias = useAliasesAsRequested;
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
   343
e22ad6bc8b46 svn 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
//Attributes for displaying the label string
1736
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   345
//Cache is invalidated on font changes, 
1998
a0cfaa0f04e2 Correct the type here
David Smith <catfish.man@gmail.com>
parents: 1745
diff changeset
   346
- (NSMutableDictionary *)labelAttributes
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
   347
{
1736
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   348
	if (!labelAttributes) {
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   349
		labelAttributes = [[NSMutableDictionary dictionaryWithObjectsAndKeys:
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   350
												leftParagraphStyleWithTruncatingTail, NSParagraphStyleAttributeName,
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   351
												[self font], NSFontAttributeName,
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   352
												nil] retain];
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   353
		
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   354
	}
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   355
	
1745
e6f04d0ac8cc Add a caching system for attributed strings and layout information in the contact list. Aside from the obvious speed benefits (a dubious benefit when we're not redrawing/resizing the list excessively), this also reduces memory usage on my stress test very significantly (50MB in one case using the stress test plugin to sign on 1000 contacts).
David Smith
parents: 1736
diff changeset
   356
	[leftParagraphStyleWithTruncatingTail setMaximumLineHeight:(float)labelFontHeight];
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
   357
	NSColor				*currentTextColor = ([self cellIsSelected] ? [self invertedTextColor] : [self textColor]);
1736
1415bfd7059d Cache the attributes for display names like we do for statuses
David Smith
parents: 1735
diff changeset
   358
	[labelAttributes setObject:currentTextColor forKey:NSForegroundColorAttributeName];
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
   359
	
e22ad6bc8b46 svn 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
	return labelAttributes;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   362
e22ad6bc8b46 svn 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
//Additional attributes to apply to our label string (For Sub-Classes)
e22ad6bc8b46 svn 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
- (NSDictionary *)additionalLabelAttributes
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	return 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
   367
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   368
e22ad6bc8b46 svn 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
//YES if our cell is currently selected
e22ad6bc8b46 svn 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
- (BOOL)cellIsSelected
e22ad6bc8b46 svn 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
{
e22ad6bc8b46 svn 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
	return ([self isHighlighted] &&
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   373
		   [[self.outlineControlView window] isKeyWindow] &&
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   374
		   [[self.outlineControlView window] firstResponder] == self.outlineControlView);
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
   375
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   377
//YES if a grid would be visible behind this cell (needs to be drawn)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   378
- (BOOL)drawGridBehindCell
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   379
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   380
	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
   381
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   382
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   383
//The background color for this cell.  This will either be [controlView backgroundColor] or [controlView alternatingGridColor]
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   384
- (NSColor *)backgroundColor
e22ad6bc8b46 svn 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
	//We could just call backgroundColorForRow: but it's best to avoid doing a rowForItem lookup if there is no grid
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   387
	if ([self.outlineControlView usesAlternatingRowBackgroundColors]) {
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   388
		return [self.outlineControlView backgroundColorForRow:[self.outlineControlView rowForItem:proxyObject]];
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
	} else {
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   390
		return [self.outlineControlView backgroundColor];
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
   391
	}
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
#pragma mark Accessibility
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (NSArray *)accessibilityAttributeNames
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   397
{
3865
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   398
	NSMutableArray *attributeNames = [[super accessibilityAttributeNames] mutableCopy];
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   399
	[attributeNames addObject:NSAccessibilityValueAttribute];
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   400
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   401
	return [attributeNames autorelease];
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
   402
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
- (id)accessibilityAttributeValue:(NSString *)attribute
e22ad6bc8b46 svn 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
	id value;
e22ad6bc8b46 svn 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
3865
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   408
	if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   409
		value = NSAccessibilityStaticTextRole;
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
   410
		
3865
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   411
	} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   412
		if ([[proxyObject listObject] isKindOfClass:[AIListGroup class]]) {
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   413
			value = [NSString stringWithFormat:AILocalizedString(@"contact group %@", "%@ will be the name of a group in the contact list"), [[proxyObject listObject] longDisplayName]];
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
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   415
		} else if ([[proxyObject listObject] isKindOfClass:[AIListBookmark class]]) {			
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   416
			value = [NSString stringWithFormat:AILocalizedString(@"group chat bookmark %@", "%@ will be the name of a bookmark"), [[proxyObject listObject] longDisplayName]];			
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
   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
		} 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
   419
			NSString *name, *statusDescription, *statusMessage;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   420
			
4161
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   421
			name = [[proxyObject listObject] longDisplayName];
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   422
			statusDescription = [adium.statusController localizedDescriptionForStatusName:([proxyObject listObject].statusName ?
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   423
																					  [proxyObject listObject].statusName :
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   424
																					  [adium.statusController defaultStatusNameForType:[proxyObject listObject].statusType])
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   425
																			   statusType:[proxyObject listObject].statusType];
8de0a4e32e42 AIProxyListObject no longer retains the ESObjectWithProperties which retains it; instead, it maintains a zeroing weak reference. This simplifies the memory management significantly.
Evan Schoenberg
parents: 3865
diff changeset
   426
			statusMessage = [[proxyObject listObject] statusMessageString];
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
   427
			
e22ad6bc8b46 svn 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
			value = [[name mutableCopy] 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
   429
			if (statusDescription) [value appendFormat:@"; %@", statusDescription];
e22ad6bc8b46 svn 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
			if (statusMessage) [value appendFormat:AILocalizedString(@"; status message %@", "please keep the semicolon at the start of the line. %@ will be replaced by a status message. This is used when reading an entry in the contact list aloud, such as 'Evan Schoenberg; status message I am bouncing up and down'"), statusMessage];
e22ad6bc8b46 svn 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
3865
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   433
	} else if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) {
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
   434
		value = [self labelString];
e22ad6bc8b46 svn 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
		
3865
814c67ba82e1 A start on fixing VO; first up: contact list. The role being set (row) is not what it should be (static text).
Frank Dowsett <wixardy@adium.im>
parents: 3074
diff changeset
   436
	} else if ([attribute isEqualToString:NSAccessibilityWindowAttribute]) {
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 4161
diff changeset
   437
		value = [self.outlineControlView window];
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
   438
                
e22ad6bc8b46 svn 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
	} 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
   440
		value = [super accessibilityAttributeValue:attribute];
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
	return value;
e22ad6bc8b46 svn 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
}
e22ad6bc8b46 svn 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
e22ad6bc8b46 svn 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
@end