Changeset 1503
- Timestamp:
- 08/16/04 19:39:49 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/NSMutableAttributedStringAdditions.m
r1480 r1503 1 /* $Id: NSMutableAttributedStringAdditions.m,v 1.2 0 2004/08/12 17:38:34morris Exp $ */1 /* $Id: NSMutableAttributedStringAdditions.m,v 1.21 2004/08/16 17:39:49 morris Exp $ */ 2 2 3 3 /* … … 122 122 NSEnumerator *enumerator; 123 123 NSScanner *scanner; 124 NSArray *lines ;124 NSArray *lines, *highlightWords; 125 125 NSString *line, *word; 126 NSColor *eventTextColor, *timestampEveryLineTextColor, *highlightWordsTextColor; 126 127 NSRange range, nickRange; 127 128 BOOL foundNick, foundPartialNick, foundAction, foundWord, foundHighlight; … … 141 142 // --- cache settings here 142 143 timestampEveryLine = [WCSettings boolForKey:WCTimestampEveryLine]; 144 eventTextColor = [WCSettings archivedObjectForKey:WCEventTextColor]; 145 timestampEveryLineTextColor = [WCSettings archivedObjectForKey:WCTimestampEveryLineTextColor]; 146 highlightWords = [WCSettings objectForKey:WCHighlightWordsWords]; 147 highlightWordsTextColor = [WCSettings archivedObjectForKey:WCHighlightWordsTextColor]; 143 148 144 149 // --- loop over every line … … 151 156 [scanner setCharactersToBeSkipped:NULL]; 152 157 153 while(![scanner isAtEnd] ) {158 while(![scanner isAtEnd] && !foundHighlight) { 154 159 [scanner skipUpToCharactersFromSet:nonwhitespace]; 155 160 range.location = [scanner scanLocation]; … … 163 168 164 169 [self addAttribute:NSForegroundColorAttributeName 165 value: [WCSettings archivedObjectForKey:WCEventTextColor]170 value:eventTextColor 166 171 range:range]; 167 172 … … 176 181 177 182 [self addAttribute:NSForegroundColorAttributeName 178 value: [WCSettings archivedObjectForKey:WCTimestampEveryLineTextColor]183 value:timestampEveryLineTextColor 179 184 range:range]; 180 185 continue; … … 224 229 225 230 // --- every word in actual chat 226 if(foundNick && !foundHighlight && [ [WCSettings objectForKey:WCHighlightWordsWords]containsSubstring:word]) {231 if(foundNick && !foundHighlight && [highlightWords containsSubstring:word]) { 227 232 nickRange.location += offset; 228 233 229 234 [self addAttribute:NSForegroundColorAttributeName 230 value: [WCSettings archivedObjectForKey:WCHighlightWordsTextColor]235 value:highlightWordsTextColor 231 236 range:nickRange]; 232 237
