The R Project SVN R-packages

Rev

Rev 1459 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1459 Rev 5707
Line 44... Line 44...
44
 
44
 
45
@implementation RRulerView
45
@implementation RRulerView
46
 
46
 
47
- (id)initWithScrollView:(NSScrollView *)aScrollView orientation:(NSRulerOrientation)orientation showLineNumbers:(BOOL) use textView:(NSTextView *) tv {
47
- (id)initWithScrollView:(NSScrollView *)aScrollView orientation:(NSRulerOrientation)orientation showLineNumbers:(BOOL) use textView:(NSTextView *) tv {
48
	SLog(@"RRulerView.initWithScrollView setting up line No ruler");
48
	SLog(@"RRulerView.initWithScrollView setting up line No ruler");
49
	showLineNos = use;
-
 
50
    if (self = [super initWithScrollView: aScrollView orientation: orientation]) 
49
    if ((self = [super initWithScrollView: aScrollView orientation: orientation]) )
51
    {
50
    {
52
        unsigned textViewFontSize = [[tv font] pointSize];
-
 
53
        if (textViewFontSize <= 10.0) {
51
        myTextView = tv;
54
            fontSize = 8.0;
52
        showLineNos = use;
55
        } else {
-
 
-
 
53
 
56
            fontSize = 9.0;
54
        fontSize = ([[tv font] pointSize] <= 10.0) ? 8.0 : 9.0;
57
        }
-
 
58
     
55
     
59
		[self updatePreferences];
56
		[self updatePreferences];
60
		[[Preferences sharedPreferences] addDependent:self];
57
		[[Preferences sharedPreferences] addDependent:self];
61
		
58
		
62
        marginAttributes = [[NSMutableDictionary alloc] init];
59
        marginAttributes = [[NSMutableDictionary alloc] init];
Line 64... Line 61...
64
        [marginAttributes setObject:[NSColor disabledControlTextColor] forKey: NSForegroundColorAttributeName];
61
        [marginAttributes setObject:[NSColor disabledControlTextColor] forKey: NSForegroundColorAttributeName];
65
        
62
        
66
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
63
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
67
        [paragraphStyle setAlignment: NSRightTextAlignment];
64
        [paragraphStyle setAlignment: NSRightTextAlignment];
68
        
65
        
69
        [marginAttributes setObject:[[paragraphStyle copy] autorelease] forKey: NSParagraphStyleAttributeName];
66
        [marginAttributes setObject:paragraphStyle forKey: NSParagraphStyleAttributeName];
-
 
67
            [paragraphStyle release];
70
		
68
		
71
        NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
69
        NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
72
        [nc addObserver:self selector:@selector(windowDidUpdate:) name: NSWindowDidUpdateNotification object: myTextView];
70
        [nc addObserver:self selector:@selector(windowDidUpdate:) name: NSWindowDidUpdateNotification object: myTextView];
73
    }
71
    }
74
	myTextView = tv;
-
 
75
	SLog(@" - line No ruler is done");
72
	SLog(@" - line No ruler is done");
76
    return self;
73
    return self;
77
}
74
}
78
 
75
 
79
- (void)dealloc
76
- (void)dealloc