| Line 54... |
Line 54... |
| 54 |
fontSize = 8.0;
|
54 |
fontSize = 8.0;
|
| 55 |
} else {
|
55 |
} else {
|
| 56 |
fontSize = 9.0;
|
56 |
fontSize = 9.0;
|
| 57 |
}
|
57 |
}
|
| 58 |
|
58 |
|
| 59 |
[[Preferences sharedPreferences] addDependent:self];
|
- |
|
| 60 |
[self updatePreferences];
|
59 |
[self updatePreferences];
|
| - |
|
60 |
[[Preferences sharedPreferences] addDependent:self];
|
| 61 |
|
61 |
|
| 62 |
marginAttributes = [[NSMutableDictionary alloc] init];
|
62 |
marginAttributes = [[NSMutableDictionary alloc] init];
|
| 63 |
[marginAttributes setObject:[NSFont boldSystemFontOfSize: fontSize] forKey: NSFontAttributeName];
|
63 |
[marginAttributes setObject:[NSFont boldSystemFontOfSize: fontSize] forKey: NSFontAttributeName];
|
| 64 |
[marginAttributes setObject:[NSColor disabledControlTextColor] forKey: NSForegroundColorAttributeName];
|
64 |
[marginAttributes setObject:[NSColor disabledControlTextColor] forKey: NSForegroundColorAttributeName];
|
| 65 |
|
65 |
|
| Line 123... |
Line 123... |
| 123 |
NSRange lineRange;
|
123 |
NSRange lineRange;
|
| 124 |
NSLayoutManager *lm;
|
124 |
NSLayoutManager *lm;
|
| 125 |
NSRect docRect, lineRect, numRect;
|
125 |
NSRect docRect, lineRect, numRect;
|
| 126 |
BOOL displayNextLineNumber;
|
126 |
BOOL displayNextLineNumber;
|
| 127 |
|
127 |
|
| 128 |
SLog(@"RRulerView.drawNumbersInMargin: %f:%f %f:%f", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
|
128 |
//SLog(@"RRulerView.drawNumbersInMargin: %f:%f %f:%f", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
|
| 129 |
docRect = [[self scrollView] documentVisibleRect];
|
129 |
docRect = [[self scrollView] documentVisibleRect];
|
| 130 |
id textView = [[[NSDocumentController sharedDocumentController] currentDocument] textView];
|
130 |
id textView = [[[NSDocumentController sharedDocumentController] currentDocument] textView];
|
| 131 |
|
131 |
|
| 132 |
lm = [textView layoutManager];
|
132 |
lm = [textView layoutManager];
|
| 133 |
numberOfGlyphs = [lm numberOfGlyphs];
|
133 |
numberOfGlyphs = [lm numberOfGlyphs];
|
| Line 167... |
Line 167... |
| 167 |
// This offsets the margin of our rulerView so that it scrolls with the textView properly.
|
167 |
// This offsets the margin of our rulerView so that it scrolls with the textView properly.
|
| 168 |
lineRect = NSOffsetRect(lineRect, -docRect.origin.x, -docRect.origin.y);
|
168 |
lineRect = NSOffsetRect(lineRect, -docRect.origin.x, -docRect.origin.y);
|
| 169 |
numRect = NSMakeRect(aRect.origin.x, lineRect.origin.y, aRect.size.width, lineRect.size.height);
|
169 |
numRect = NSMakeRect(aRect.origin.x, lineRect.origin.y, aRect.size.width, lineRect.size.height);
|
| 170 |
if (lineRect.origin.y+lineRect.size.height>=aRect.origin.y && lineRect.origin.y<=aRect.origin.y+aRect.size.height)
|
170 |
if (lineRect.origin.y+lineRect.size.height>=aRect.origin.y && lineRect.origin.y<=aRect.origin.y+aRect.size.height)
|
| 171 |
[self drawOneNumberInMargin: rLineNumber inRect: numRect];
|
171 |
[self drawOneNumberInMargin: rLineNumber inRect: numRect];
|
| 172 |
SLog(@" - done drawing numbers");
|
172 |
//SLog(@" - done drawing numbers");
|
| 173 |
}
|
173 |
}
|
| 174 |
|
174 |
|
| 175 |
-(void)drawOneNumberInMargin:(unsigned) aNumber inRect:(NSRect)r
|
175 |
-(void)drawOneNumberInMargin:(unsigned) aNumber inRect:(NSRect)r
|
| 176 |
{
|
176 |
{
|
| 177 |
NSString *s;
|
177 |
NSString *s;
|