Update of /cvsroot/zephyrchat/zchat/zChat
In directory sc8-pr-cvs1:/tmp/cvs-serv2214/zChat
Modified Files:
ZChatFriendViewController.mm ZChatFriendsController.mm
status-available.tiff status-away.tiff
Log Message:
Custom status icons.
Color status shown in expanded location list.
Index: ZChatFriendViewController.mm
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatFriendViewController.mm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ZChatFriendViewController.mm 31 Mar 2003 15:07:45 -0000 1.20
+++ ZChatFriendViewController.mm 8 Apr 2003 19:53:43 -0000 1.21
@@ -14,6 +14,11 @@
using namespace zephyrlib;
+namespace {
+ static const NSColor *ZChatAvailableColor;
+ static const NSColor *ZChatAwayColor;
+}
+
class ZChatFriendViewLocateCallback : public ZephyrLocateCallback {
public:
ZChatFriendViewLocateCallback(ZChatFriendViewController *controller) : _self([controller retain]) {}
@@ -30,6 +35,15 @@
@implementation ZChatFriendViewController
++ (void)initialize {
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ ZChatAvailableColor = [[NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.0 alpha:1.0] retain];
+ ZChatAwayColor = [[NSColor colorWithCalibratedRed:0.75 green:0.0 blue:0.0 alpha:1.0] retain];
+
+ [pool release];
+}
+
- (id)initWithUser:(NSString *)user {
if ((self = [super init]) != nil) {
_user = [ZephyrUtils::RemoveRealm(user) retain];
@@ -137,10 +151,20 @@
ZephyrLocation &location = (*_locations)[i];
[[_locationMatrix cellAtRow:i + 1 column:0] setObjectValue:
[NSString stringWithSTLString:location.machine_name]];
- [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:
- [NSString stringWithSTLString:location.terminal]];
[[_locationMatrix cellAtRow:i + 1 column:2] setObjectValue:
[NSString stringWithSTLString:location.login_time]];
+
+ if (!location.terminal.empty() && (location.terminal[0] == '+' || location.terminal[0] == '-')) {
+ NSColor *color = (location.terminal[0] != '-') ? ZChatAvailableColor : ZChatAwayColor;
+
+ [[_locationMatrix cellAtRow:i + 1 column:1] setTextColor:color];
+ [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:
+ [[NSString stringWithSTLString:location.terminal] substringFromIndex:1]];
+ } else {
+ [[_locationMatrix cellAtRow:i + 1 column:1] setTextColor:[NSColor textColor]];
+ [[_locationMatrix cellAtRow:i + 1 column:1] setObjectValue:
+ [NSString stringWithSTLString:location.terminal]];
+ }
}
[_locationMatrix sizeToCells];
Index: ZChatFriendsController.mm
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatFriendsController.mm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ZChatFriendsController.mm 7 Apr 2003 21:01:55 -0000 1.21
+++ ZChatFriendsController.mm 8 Apr 2003 19:53:46 -0000 1.22
@@ -180,10 +180,14 @@
status = [status substringFromIndex:1];
}
- // Check for existing title
- id <NSMenuItem> item = [_statusMenu itemWithTitle:status];
- if (item != NULL) {
- if (([item tag] == (away ? 2 : 1)) || ([item tag] == (away ? 222 : 111))) {
+ /* Check for existing title.
+ * We cannot use itemWithTitle because we only want to search items with the right tag.
+ */
+ NSEnumerator *e = [[_statusMenu itemArray] objectEnumerator];
+ id <NSMenuItem> item;
+ while ((item = [e nextObject]) != nil) {
+ if ((([item tag] == (away ? 2 : 1)) || ([item tag] == (away ? 222 : 111)))
+ && [status isEqualToString:[item title]]) {
[_statusMenu selectItem:item];
return;
}
Index: status-available.tiff
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/status-available.tiff,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
Binary files /tmp/cvshJWLxz and /tmp/cvsintvKY differ
Index: status-away.tiff
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/status-away.tiff,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
Binary files /tmp/cvsKq1dNX and /tmp/cvsGiKCmL differ
|