Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactoring:

• everything related to command line invocation is now in a CommitWindowController category.
• status string highlighting is now implemented as an NSString category.

Same code, different locations. No user-visible changes, so I'm not bothering to upgrade the binary.

git-svn-id: http://svn.textmate.org/trunk/Tools/CommitWindowProject@3782 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit 5655d71d9ddaf956794b398bc916bbc0c85843e8 1 parent f175b5f
Chris Thomas authored
View
14 CommitWindow.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
+ 8316703B0A4DB58500199564 /* NSString+StatusString.m in Sources */ = {isa = PBXBuildFile; fileRef = 8316703A0A4DB58500199564 /* NSString+StatusString.m */; };
+ 831670450A4DB70A00199564 /* CommitWindowCommandLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 831670440A4DB70A00199564 /* CommitWindowCommandLine.m */; };
831C222407B6F2EC00397A7E /* CommitWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 831C222307B6F2EC00397A7E /* CommitWindowController.m */; };
83BDF3B207DD4165005AC50F /* CWTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BDF3B107DD4165005AC50F /* CWTextView.m */; };
83F6091D07B8A60400C21FE8 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83F6091C07B8A60400C21FE8 /* ApplicationServices.framework */; };
@@ -24,7 +26,10 @@
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* CommitWindow_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommitWindow_Prefix.pch; sourceTree = "<group>"; };
- 83189C69087A3EE2007473C7 /* VersionControlColors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VersionControlColors.h; sourceTree = "<group>"; };
+ 831670390A4DB58500199564 /* NSString+StatusString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+StatusString.h"; sourceTree = "<group>"; };
+ 8316703A0A4DB58500199564 /* NSString+StatusString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+StatusString.m"; sourceTree = "<group>"; };
+ 831670430A4DB70A00199564 /* CommitWindowCommandLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommitWindowCommandLine.h; sourceTree = "<group>"; };
+ 831670440A4DB70A00199564 /* CommitWindowCommandLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommitWindowCommandLine.m; sourceTree = "<group>"; };
831C222207B6F2EC00397A7E /* CommitWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommitWindowController.h; sourceTree = "<group>"; };
831C222307B6F2EC00397A7E /* CommitWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommitWindowController.m; sourceTree = "<group>"; };
83BDF3B007DD4165005AC50F /* CWTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWTextView.h; sourceTree = "<group>"; };
@@ -52,6 +57,10 @@
children = (
831C222207B6F2EC00397A7E /* CommitWindowController.h */,
831C222307B6F2EC00397A7E /* CommitWindowController.m */,
+ 831670430A4DB70A00199564 /* CommitWindowCommandLine.h */,
+ 831670440A4DB70A00199564 /* CommitWindowCommandLine.m */,
+ 831670390A4DB58500199564 /* NSString+StatusString.h */,
+ 8316703A0A4DB58500199564 /* NSString+StatusString.m */,
83BDF3B007DD4165005AC50F /* CWTextView.h */,
83BDF3B107DD4165005AC50F /* CWTextView.m */,
);
@@ -87,7 +96,6 @@
29B97314FDCFA39411CA2CEA /* AskForString */ = {
isa = PBXGroup;
children = (
- 83189C69087A3EE2007473C7 /* VersionControlColors.h */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
@@ -200,6 +208,8 @@
8D11072D0486CEB800E47090 /* main.m in Sources */,
831C222407B6F2EC00397A7E /* CommitWindowController.m in Sources */,
83BDF3B207DD4165005AC50F /* CWTextView.m in Sources */,
+ 8316703B0A4DB58500199564 /* NSString+StatusString.m in Sources */,
+ 831670450A4DB70A00199564 /* CommitWindowCommandLine.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
15 CommitWindowCommandLine.h
@@ -0,0 +1,15 @@
+//
+// CommitWindowCommandLine.h
+// CommitWindow
+//
+// Created by Chris Thomas on 6/24/06.
+// Copyright 2006 Chris Thomas. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "CommitWindowController.h"
+
+@interface CommitWindowController(CommandLine)
+- (IBAction) commit:(id) sender;
+- (IBAction) cancel:(id) sender;
+@end
View
205 CommitWindowCommandLine.m
@@ -0,0 +1,205 @@
+//
+// CommitWindowCommandLine.m
+// CommitWindow
+//
+// Created by Chris Thomas on 6/24/06.
+// Copyright 2006 Chris Thomas. All rights reserved.
+//
+
+#import "CommitWindowCommandLine.h"
+
+@implementation CommitWindowController(CommandLine)
+
+- (void) awakeFromNib
+{
+ NSProcessInfo * processInfo = [NSProcessInfo processInfo];
+ NSArray * args;
+ int i;
+ int argc;
+
+ args = [processInfo arguments];
+ argc = [args count];
+
+ if( args == nil || argc < 2 )
+ {
+ fprintf(stderr, "commit window: Arguments required\n");
+ [self cancel:nil];
+ }
+
+ //
+ // Parse the command line.
+ //
+
+ // Program name is the first argument -- get rid of it. (COW semantics should make this cheaper than it looks.)
+ argc -= 1;
+ args = [args subarrayWithRange:NSMakeRange(1, argc)];
+
+ // Populate our NSArrayController with the command line arguments
+ [fFilesController objectDidBeginEditing:nil];
+ for( i = 0; i < argc; i += 1 )
+ {
+ NSString * argument = [args objectAtIndex:i];
+
+ if( [argument isEqualToString:@"--ask"] )
+ {
+ // Next argument should be the query text.
+ if( i >= (argc - 1) )
+ {
+ fprintf(stderr, "commit window: missing text: --ask \"some text\"\n");
+ [self cancel:nil];
+ }
+
+ i += 1;
+ argument = [args objectAtIndex:i];
+ [fRequestText setStringValue:argument];
+ }
+ else if( [argument isEqualToString:@"--status"] )
+ {
+ // Next argument should be a colon-seperated list of status strings, one for each path
+ if( i >= (argc - 1) )
+ {
+ fprintf(stderr, "commit window: missing text: --status \"A:D:M:M:M\"\n");
+ [self cancel:nil];
+ }
+
+ i += 1;
+ argument = [args objectAtIndex:i];
+ fFileStatusStrings = [[argument componentsSeparatedByString:@":"] retain];
+ }
+ else if( [argument isEqualToString:@"--diff-cmd"] )
+ {
+ // Next argument should be a comma-seperated list of command arguments to use to execute the diff
+ if( i >= (argc - 1) )
+ {
+ fprintf(stderr, "commit window: missing text: --diff-cmd \"/usr/bin/svn,diff\"\n");
+ [self cancel:nil];
+ }
+
+ i += 1;
+ argument = [args objectAtIndex:i];
+ fDiffCommand = [argument retain];
+ }
+ else
+ {
+ NSMutableDictionary * dictionary = [fFilesController newObject];
+
+ [dictionary setObject:[argument stringByAbbreviatingWithTildeInPath] forKey:@"path"];
+ [fFilesController addObject:dictionary];
+ }
+ }
+
+ //
+ // Done processing arguments, now add status to each item
+ // and choose default commit state
+ //
+ [self setupUserInterface];
+
+}
+
+
+#if 0
+#pragma mark -
+#pragma mark Actions
+#endif
+
+
+
+- (IBAction) commit:(id) sender
+{
+ NSArray * objects = [fFilesController arrangedObjects];
+ int i;
+ int pathsToCommitCount = 0;
+ NSMutableString * commitString;
+
+ [self saveSummary];
+
+ //
+ // Quote any single-quotes in the commit message
+ // \' doesn't work with bash. We must use string concatenation.
+ // This sort of thing is why the Unix Hater's Handbook exists.
+ //
+ commitString = [[[fCommitMessage string] mutableCopy] autorelease];
+ [commitString replaceOccurrencesOfString:@"'" withString:@"'\"'\"'" options:0 range:NSMakeRange(0, [commitString length])];
+
+ fprintf(stdout, "-m '%s' ", [commitString UTF8String] );
+
+ //
+ // Return only the files we care about
+ //
+ for( i = 0; i < [objects count]; i += 1 )
+ {
+ NSMutableDictionary * dictionary;
+ NSNumber * commit;
+
+ dictionary = [objects objectAtIndex:i];
+ commit = [dictionary objectForKey:@"commit"];
+
+ if( commit == nil || [commit boolValue] ) // missing commit key defaults to true
+ {
+ NSMutableString * path;
+
+ //
+ // Quote any single-quotes in the path
+ //
+ path = [dictionary objectForKey:@"path"];
+ path = [[[path stringByStandardizingPath] mutableCopy] autorelease];
+ [path replaceOccurrencesOfString:@"'" withString:@"'\"'\"'" options:0 range:NSMakeRange(0, [path length])];
+
+ fprintf( stdout, "'%s' ", [path UTF8String] );
+ pathsToCommitCount += 1;
+ }
+ }
+
+ fprintf( stdout, "\n" );
+
+ //
+ // SVN will commit the current directory, recursively, if we don't specify files.
+ // So, to prevent surprises, if the user's unchecked all the boxes, let's be on the safe side and cancel.
+ //
+ if( pathsToCommitCount == 0 )
+ {
+ [self cancel:nil];
+ }
+
+ [NSApp terminate:self];
+}
+
+- (IBAction) cancel:(id) sender
+{
+ [self saveSummary];
+
+ fprintf(stdout, "commit window: cancel\n");
+ exit(-128);
+}
+
+- (IBAction) doubleClickRowInTable:(id)sender
+{
+ if(fDiffCommand != nil)
+ {
+ NSArray * unquotedArguments = [fDiffCommand componentsSeparatedByString:@","];
+ NSString * quoteArgument = @"\"%@\"";
+ NSString * diffCommand = @"";
+ NSString * mateCommand = [NSString stringWithFormat:@"\"%s/bin/mate\" &> /dev/null &", getenv("TM_SUPPORT_PATH")];
+ NSString * filePath = [[[fFilesController arrangedObjects] objectAtIndex:[sender selectedRow]] objectForKey:@"path"];
+ unsigned int argumentCount = [unquotedArguments count];
+ unsigned int index;
+
+ for(index = 0; index < argumentCount; index += 1)
+ {
+ NSString * argument = [unquotedArguments objectAtIndex:index];
+ NSString * quotedArgument = [NSString stringWithFormat:quoteArgument, argument];
+
+ diffCommand = [diffCommand stringByAppendingString:quotedArgument];
+ diffCommand = [diffCommand stringByAppendingString:@" "];
+ }
+
+ diffCommand = [diffCommand stringByAppendingString:[NSString stringWithFormat:quoteArgument, filePath]];
+ diffCommand = [diffCommand stringByAppendingString:[NSString stringWithFormat:@" | %@", mateCommand]];
+
+ system([diffCommand UTF8String]);
+ }
+
+}
+
+
+@end
View
4 CommitWindowController.h
@@ -33,7 +33,7 @@
NSArray * fFileStatusStrings;
}
-- (IBAction) commit:(id) sender;
-- (IBAction) cancel:(id) sender;
+- (void) setupUserInterface;
+- (void) saveSummary;
@end
View
238 CommitWindowController.m
@@ -2,21 +2,20 @@
// CommitWindowController.m
//
// Created by Chris Thomas on 2/6/05.
-// Copyright 2005 Chris Thomas. All rights reserved.
+// Copyright 2005-2006 Chris Thomas. All rights reserved.
// MIT license.
//
#import "CommitWindowController.h"
-#import "VersionControlColors.h"
+#import "NSString+StatusString.h"
#define kStatusColumnWidthForSingleChar 18
@interface CommitWindowController (Private)
- (void) populatePreviousSummaryMenu;
-- (NSAttributedString *) attributedStatusString:(NSString *)statusString;
@end
-// Forward string comparisons
+// Forward string comparisons to NSString
@interface NSAttributedString (CommitWindowExtensions)
- (NSComparisonResult)compare:(id)anArgument;
@end
@@ -31,88 +30,14 @@ - (NSComparisonResult)compare:(id)aString
@implementation CommitWindowController
-- (void) awakeFromNib
+
+// fFilesController and fFilesStatusStrings should be set up before calling setupUserInterface.
+- (void) setupUserInterface
{
NSCell * cell = [fPathColumn dataCell];
if([cell respondsToSelector:@selector(setLineBreakMode:)])
[cell setLineBreakMode:NSLineBreakByTruncatingHead];
- NSProcessInfo * processInfo = [NSProcessInfo processInfo];
- NSArray * args;
- int i;
- int argc;
-
- args = [processInfo arguments];
- argc = [args count];
-
- if( args == nil || argc < 2 )
- {
- fprintf(stderr, "commit window: Arguments required\n");
- [self cancel:nil];
- }
-
- //
- // Parse the command line.
- //
-
- // Program name is the first argument -- get rid of it. (COW semantics should make this cheaper than it looks.)
- argc -= 1;
- args = [args subarrayWithRange:NSMakeRange(1, argc)];
-
- // Populate our NSArrayController with the command line arguments
- [fFilesController objectDidBeginEditing:nil];
- for( i = 0; i < argc; i += 1 )
- {
- NSString * argument = [args objectAtIndex:i];
-
- if( [argument isEqualToString:@"--ask"] )
- {
- // Next argument should be the query text.
- if( i >= (argc - 1) )
- {
- fprintf(stderr, "commit window: missing text: --ask \"some text\"\n");
- [self cancel:nil];
- }
-
- i += 1;
- argument = [args objectAtIndex:i];
- [fRequestText setStringValue:argument];
- }
- else if( [argument isEqualToString:@"--status"] )
- {
- // Next argument should be a colon-seperated list of status strings, one for each path
- if( i >= (argc - 1) )
- {
- fprintf(stderr, "commit window: missing text: --status \"A:D:M:M:M\"\n");
- [self cancel:nil];
- }
-
- i += 1;
- argument = [args objectAtIndex:i];
- fFileStatusStrings = [[argument componentsSeparatedByString:@":"] retain];
- }
- else if( [argument isEqualToString:@"--diff-cmd"] )
- {
- // Next argument should be a comma-seperated list of command arguments to use to execute the diff
- if( i >= (argc - 1) )
- {
- fprintf(stderr, "commit window: missing text: --diff-cmd \"/usr/bin/svn,diff\"\n");
- [self cancel:nil];
- }
-
- i += 1;
- argument = [args objectAtIndex:i];
- fDiffCommand = [argument retain];
- }
- else
- {
- NSMutableDictionary * dictionary = [fFilesController newObject];
-
- [dictionary setObject:[argument stringByAbbreviatingWithTildeInPath] forKey:@"path"];
- [fFilesController addObject:dictionary];
- }
- }
-
//
// Done processing arguments, now add status to each item
// and choose default commit state
@@ -121,6 +46,7 @@ - (void) awakeFromNib
{
NSArray * files = [fFilesController arrangedObjects];
int count = MIN([files count], [fFileStatusStrings count]);
+ int i;
UInt32 maxCharsToDisplay = 0;
@@ -139,7 +65,7 @@ - (void) awakeFromNib
}
[dictionary setObject:status forKey:@"status"];
- [dictionary setObject:[self attributedStatusString:status] forKey:@"attributedStatus"];
+ [dictionary setObject:[status attributedStatusString] forKey:@"attributedStatus"];
// Deselect external commits by default
if([status hasPrefix:@"X"])
@@ -346,152 +272,4 @@ - (void) saveSummary
}
}
-#if 0
-#pragma mark -
-#pragma mark Actions
-#endif
-
-
-
-- (IBAction) commit:(id) sender
-{
- NSArray * objects = [fFilesController arrangedObjects];
- int i;
- int pathsToCommitCount = 0;
- NSMutableString * commitString;
-
- [self saveSummary];
-
- //
- // Quote any single-quotes in the commit message
- // \' doesn't work with bash. We must use string concatenation.
- // This sort of thing is why the Unix Hater's Handbook exists.
- //
- commitString = [[[fCommitMessage string] mutableCopy] autorelease];
- [commitString replaceOccurrencesOfString:@"'" withString:@"'\"'\"'" options:0 range:NSMakeRange(0, [commitString length])];
-
- fprintf(stdout, "-m '%s' ", [commitString UTF8String] );
-
- //
- // Return only the files we care about
- //
- for( i = 0; i < [objects count]; i += 1 )
- {
- NSMutableDictionary * dictionary;
- NSNumber * commit;
-
- dictionary = [objects objectAtIndex:i];
- commit = [dictionary objectForKey:@"commit"];
-
- if( commit == nil || [commit boolValue] ) // missing commit key defaults to true
- {
- NSMutableString * path;
-
- //
- // Quote any single-quotes in the path
- //
- path = [dictionary objectForKey:@"path"];
- path = [[[path stringByStandardizingPath] mutableCopy] autorelease];
- [path replaceOccurrencesOfString:@"'" withString:@"'\"'\"'" options:0 range:NSMakeRange(0, [path length])];
-
- fprintf( stdout, "'%s' ", [path UTF8String] );
- pathsToCommitCount += 1;
- }
- }
-
- fprintf( stdout, "\n" );
-
- //
- // SVN will commit the current directory, recursively, if we don't specify files.
- // So, to prevent surprises, if the user's unchecked all the boxes, let's be on the safe side and cancel.
- //
- if( pathsToCommitCount == 0 )
- {
- [self cancel:nil];
- }
-
- [NSApp terminate:self];
-}
-
-- (IBAction) cancel:(id) sender
-{
- [self saveSummary];
-
- fprintf(stdout, "commit window: cancel\n");
- exit(-128);
-}
-
-- (IBAction) doubleClickRowInTable:(id)sender
-{
- if(fDiffCommand != nil)
- {
- NSArray * unquotedArguments = [fDiffCommand componentsSeparatedByString:@","];
- NSString * quoteArgument = @"\"%@\"";
- NSString * diffCommand = @"";
- NSString * mateCommand = [NSString stringWithFormat:@"\"%s/bin/mate\" &> /dev/null &", getenv("TM_SUPPORT_PATH")];
- NSString * filePath = [[[fFilesController arrangedObjects] objectAtIndex:[sender selectedRow]] objectForKey:@"path"];
- unsigned int argumentCount = [unquotedArguments count];
- unsigned int index;
-
- for(index = 0; index < argumentCount; index += 1)
- {
- NSString * argument = [unquotedArguments objectAtIndex:index];
- NSString * quotedArgument = [NSString stringWithFormat:quoteArgument, argument];
-
- diffCommand = [diffCommand stringByAppendingString:quotedArgument];
- diffCommand = [diffCommand stringByAppendingString:@" "];
- }
-
- diffCommand = [diffCommand stringByAppendingString:[NSString stringWithFormat:quoteArgument, filePath]];
- diffCommand = [diffCommand stringByAppendingString:[NSString stringWithFormat:@" | %@", mateCommand]];
-
- system([diffCommand UTF8String]);
- }
-
-}
-
-//
-// Attempt to mirror the appearance of the status and info displays
-//
-
-- (NSAttributedString *) attributedStatusString:(NSString *)statusString
-{
- UInt32 length = [statusString length];
- NSMutableAttributedString * attributedStatusString = [[[NSMutableAttributedString alloc] init] autorelease];
- unsigned int i;
- unichar emSpace = 0x2003;
- unichar hairSpace = 0x200A;
- NSAttributedString * spaceString = [[[NSAttributedString alloc] initWithString:@" " attributes:nil] autorelease];
-
- for( i = 0; i < length; i += 1 )
- {
- unichar character = [statusString characterAtIndex:i];
- NSString * charString;
- NSAttributedString * attributedCharString;
- NSColor * foreColor;
- NSColor * backColor;
- NSDictionary * attributes;
-
- // We pass in underscores for empty multicolumn attributes
- if(character == '_')
- {
- character = emSpace;
- }
- charString = [NSString stringWithCharacters:&character length:1];
-
- ColorsFromStatus( charString, &foreColor, &backColor );
-
- attributes = [NSDictionary dictionaryWithObjectsAndKeys:foreColor, NSForegroundColorAttributeName,
- backColor, NSBackgroundColorAttributeName,
- nil];
-
- attributedCharString = [[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%C%@%C", hairSpace, charString, hairSpace] attributes:attributes] autorelease];
-
- [attributedStatusString appendAttributedString:attributedCharString];
- [attributedStatusString appendAttributedString:spaceString];
- }
-
- return attributedStatusString;
-}
-
@end
View
14 NSString+StatusString.h
@@ -0,0 +1,14 @@
+//
+// NSString+StatusString.h
+// CommitWindow
+//
+// Created by Chris Thomas on 6/24/06.
+// Copyright 2006 Chris Thomas. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface NSString(VersionControlStatusString)
+- (NSAttributedString *) attributedStatusString;
+@end
View
58 VersionControlColors.h → NSString+StatusString.m
@@ -1,3 +1,12 @@
+//
+// NSString+StatusString.m
+// CommitWindow
+//
+// Created by Chris Thomas on 6/24/06.
+// Copyright 2006 __MyCompanyName__. All rights reserved.
+//
+
+#import "NSString+StatusString.h"
#define RGB8ComponentTransform(component) ((component) == 0 ? 0.0 : 1.0/(255.0/(component)))
@@ -65,3 +74,52 @@ static inline void ColorsFromStatus( NSString * status, NSColor ** foreColor, NS
*backColor = [NSColor controlBackgroundColor];
}
}
+
+
+@implementation NSString(VersionControlStatusString)
+
+
+//
+// Return a string with status chars highlighted appropriately appropriate for use in a table, with spaces filled with blanks
+//
+- (NSAttributedString *) attributedStatusString
+{
+ UInt32 length = [self length];
+ NSMutableAttributedString * attributedStatusString = [[[NSMutableAttributedString alloc] init] autorelease];
+ unsigned int i;
+ unichar emSpace = 0x2003;
+ unichar hairSpace = 0x200A;
+ NSAttributedString * spaceString = [[[NSAttributedString alloc] initWithString:@" " attributes:nil] autorelease];
+
+ for( i = 0; i < length; i += 1 )
+ {
+ unichar character = [self characterAtIndex:i];
+ NSString * charString;
+ NSAttributedString * attributedCharString;
+ NSColor * foreColor;
+ NSColor * backColor;
+ NSDictionary * attributes;
+
+ // We pass in underscores for empty multicolumn attributes
+ if(character == '_')
+ {
+ character = emSpace;
+ }
+ charString = [NSString stringWithCharacters:&character length:1];
+
+ ColorsFromStatus( charString, &foreColor, &backColor );
+
+ attributes = [NSDictionary dictionaryWithObjectsAndKeys:foreColor, NSForegroundColorAttributeName,
+ backColor, NSBackgroundColorAttributeName,
+ nil];
+
+ attributedCharString = [[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%C%@%C", hairSpace, charString, hairSpace] attributes:attributes] autorelease];
+
+ [attributedStatusString appendAttributedString:attributedCharString];
+ [attributedStatusString appendAttributedString:spaceString];
+ }
+
+ return attributedStatusString;
+}
+
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.