Update of /cvsroot/radmind/radmind-assistant/rte
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25850
Modified Files:
NSMutableDictionary(RXAdditions).m
Log Message:
Handle setting ellipsis truncation in displayedPath attributed string.
Index: NSMutableDictionary(RXAdditions).m
===================================================================
RCS file: /cvsroot/radmind/radmind-assistant/rte/NSMutableDictionary(RXAdditions).m,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** NSMutableDictionary(RXAdditions).m 17 Aug 2004 15:54:05 -0000 1.7
--- NSMutableDictionary(RXAdditions).m 29 Aug 2006 01:26:08 -0000 1.8
***************
*** 1,3 ****
--- 1,4 ----
#import "NSMutableDictionary(RXAdditions).h"
+ #import <Cocoa/Cocoa.h>
#include <sys/param.h>
***************
*** 153,156 ****
--- 154,158 ----
NSMutableDictionary *dict;
CFRange range = { 0, 0 };
+ static NSMutableParagraphStyle *style = nil;
if ( [ line characterAtIndex: 0 ] == '\n' ) {
***************
*** 194,197 ****
--- 196,205 ----
}
+ /* set appropriate linebreak mode for display */
+ if ( style == nil ) {
+ style = [[ NSParagraphStyle defaultParagraphStyle ] mutableCopy ];
+ [ style setLineBreakMode: NSLineBreakByTruncatingMiddle ];
+ }
+
dict = [ NSMutableDictionary dictionaryForType: type
atTIndex: 0
***************
*** 200,203 ****
--- 208,225 ----
line: l ];
+ if ( dict ) {
+ NSMutableAttributedString *attrString;
+
+ if ( [ dict objectForKey: @"path" ] != nil ) {
+ attrString = [[ NSMutableAttributedString alloc ] initWithString:
+ [ dict objectForKey: @"path" ]];
+ [ attrString addAttribute: NSParagraphStyleAttributeName
+ value: style
+ range: NSMakeRange( 0, [[ attrString string ] length ] ) ];
+ [ dict setObject: attrString forKey: @"displayedPath" ];
+ [ attrString release ];
+ }
+ }
+
return( dict );
}
|