=================================================================== RCS file: /home/cvs/OpenXM/src/cfep/MyOutputWindowController.m,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -p -r1.1.1.1 -r1.3 --- OpenXM/src/cfep/MyOutputWindowController.m 2006/03/03 23:31:12 1.1.1.1 +++ OpenXM/src/cfep/MyOutputWindowController.m 2006/03/07 11:15:23 1.3 @@ -71,9 +71,24 @@ } -(void)outputStringToOutputWindow:(NSString *)msg { + [self outputStringToOutputWindow: msg withColor: [NSColor blackColor]]; +} +-(void)outputStringToOutputWindow:(NSString *)msg withColor: (NSColor *) color { + int oldEnd, newEnd; NSRange myRange = NSMakeRange([[textViewOut textStorage] length],0); + oldEnd = myRange.location; // NSLog(@" outputStringToOutputWindow\n"); [textViewOut replaceCharactersInRange: myRange withString: msg]; + myRange = NSMakeRange([[textViewOut textStorage] length],0); + newEnd = myRange.location; + [textViewOut setTextColor: color range: NSMakeRange(oldEnd,newEnd-oldEnd)]; + [textViewOut scrollRangeToVisible: myRange]; +} + +-(void)insertText: (id) text { + NSRange myRange = NSMakeRange([[textViewOut textStorage] length],0); + [textViewOut replaceCharactersInRange: myRange withString: @""]; // goto the end of output window. + [textViewOut insertText: text]; [textViewOut scrollRangeToVisible: NSMakeRange([[textViewOut textStorage] length],0)]; }