[zephyrchat-cvs] zchat/zChat ZChatFriendViewController.mm,1.21,1.22
Status: Alpha
Brought to you by:
akosut
|
From: <ak...@us...> - 2003-04-09 15:51:45
|
Update of /cvsroot/zephyrchat/zchat/zChat
In directory sc8-pr-cvs1:/tmp/cvs-serv26261/zChat
Modified Files:
ZChatFriendViewController.mm
Log Message:
Show status in collapsed location view.
Index: ZChatFriendViewController.mm
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatFriendViewController.mm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ZChatFriendViewController.mm 8 Apr 2003 19:53:43 -0000 1.21
+++ ZChatFriendViewController.mm 9 Apr 2003 15:51:39 -0000 1.22
@@ -12,6 +12,8 @@
#import "ZChatFriendsController.h";
#import "ZChatFriendInfoController.h";
+#import "NSAttributedStringAdditions.h"
+
using namespace zephyrlib;
namespace {
@@ -143,6 +145,9 @@
*_locations = locations;
if (!_locations->empty()) {
+ /* Set the collapsed text */
+ NSMutableAttributedString *statuses = [NSMutableAttributedString new];
+
/* The first row in the matrix is the header */
[_locationMatrix renewRows:_locations->size() + 1 columns:3];
NSAssert([_locationMatrix numberOfRows] >= 2, @"Location matrix should always have at least two rows");
@@ -156,27 +161,42 @@
if (!location.terminal.empty() && (location.terminal[0] == '+' || location.terminal[0] == '-')) {
NSColor *color = (location.terminal[0] != '-') ? ZChatAvailableColor : ZChatAwayColor;
-
+ NSString *terminal = [[NSString stringWithSTLString:location.terminal] substringFromIndex:1];
+
[[_locationMatrix cellAtRow:i + 1 column:1] setTextColor:color];
- [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:
- [[NSString stringWithSTLString:location.terminal] substringFromIndex:1]];
+ [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:terminal];
+
+ [statuses appendString:terminal attributes:
+ [NSDictionary dictionaryWithObject:color forKey:NSForegroundColorAttributeName]];
} else {
+ NSString *terminal = [NSString stringWithSTLString:location.terminal];
+
[[_locationMatrix cellAtRow:i + 1 column:1] setTextColor:[NSColor textColor]];
- [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:
- [NSString stringWithSTLString:location.terminal]];
+ [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:terminal];
+
+ [statuses appendString:terminal attributes:
+ [NSDictionary dictionaryWithObject:[NSColor textColor]
+ forKey:NSForegroundColorAttributeName]];
+ }
+
+ if (i + 1 < _locations->size()) {
+ [statuses appendString:NSLocalizedString(@"TERMINAL_SEPERATOR", nil) attributes:
+ [NSDictionary dictionaryWithObject:[NSColor textColor]
+ forKey:NSForegroundColorAttributeName]];
}
}
[_locationMatrix sizeToCells];
+ [_collapsedStatus setAttributedStringValue:statuses];
+ [statuses release];
+
/* We shouldn't have to hard-code 20. But I'm having a tough time fixing this one */
[_expandedView setFrameSize:NSMakeSize(NSWidth([_expandedView frame]),
20 + NSHeight([_locationMatrix frame]))];
[_expandedView setNeedsDisplay:YES];
}
- // TODO
-
_busy = false;
[[NSNotificationCenter defaultCenter] postNotificationName:ZChatFriendStatusNotification
object:self];
|