- Timestamp:
- Aug 21, 2006, 11:47:29 PM (16 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/MessageWindowController.h
- Property svn:keywords set to Date Rev Author Id
r810 r811 31 31 32 32 NSLock * fLock; 33 NSMutableArray * fBufferArray; 34 NSTimer * fTimer; 33 35 } 34 36 35 37 void addMessage(int level, const char * message); 36 38 - (void) addMessage: (const char *) message level: (int) level; 39 - (void) updateLog: (NSTimer *) timer; 37 40 38 41 - (void) changeLevel: (id) sender; -
trunk/macosx/MessageWindowController.m
- Property svn:keywords set to Date Rev Author Id
r810 r811 30 30 #define LEVEL_DEBUG 2 31 31 32 #define UPDATE_SECONDS 1.0 33 32 34 @interface MessageWindowController (Private) 33 35 … … 45 47 46 48 fLock = [[NSLock alloc] init]; 49 fBufferArray = [[NSMutableArray alloc] init]; 50 51 fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self 52 selector: @selector(updateLog:) userInfo: nil repeats: YES]; 47 53 48 54 [[self window] update]; //make sure nib is loaded right away … … 53 59 - (void) dealloc 54 60 { 61 [fTimer invalidate]; 62 55 63 [fLock release]; 64 [fBufferArray release]; 65 56 66 [super dealloc]; 57 67 } … … 101 111 102 112 [fLock lock]; 103 [ [fTextView textStorage] appendAttributedString: messageString];113 [fBufferArray addObject: messageString]; 104 114 [fLock unlock]; 105 115 106 116 [pool release]; 117 } 118 119 - (void) updateLog: (NSTimer *) timer 120 { 121 [fLock lock]; 122 123 NSEnumerator * enumerator = [fBufferArray objectEnumerator]; 124 NSAttributedString * messageString; 125 while ((messageString = [enumerator nextObject])) 126 [[fTextView textStorage] appendAttributedString: messageString]; 127 128 [fBufferArray removeAllObjects]; 129 130 [fLock unlock]; 107 131 } 108 132
Note: See TracChangeset
for help on using the changeset viewer.