The R Project SVN R-packages

Rev

Rev 6238 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6238 Rev 6240
1
/*
1
/*
2
 *  R.app : a Cocoa front end to: "R A Computer Language for Statistical Data Analysis"
2
 *  R.app : a Cocoa front end to: "R A Computer Language for Statistical Data Analysis"
3
 *  
3
 *  
4
 *  R.app Copyright notes:
4
 *  R.app Copyright notes:
5
 *                     Copyright (C) 2004-12  The R Foundation
5
 *                     Copyright (C) 2004-12  The R Foundation
6
 *                     written by Stefano M. Iacus and Simon Urbanek
6
 *                     written by Stefano M. Iacus and Simon Urbanek
7
 *
7
 *
8
 *                  
8
 *                  
9
 *  R Copyright notes:
9
 *  R Copyright notes:
10
 *                     Copyright (C) 1995-1996   Robert Gentleman and Ross Ihaka
10
 *                     Copyright (C) 1995-1996   Robert Gentleman and Ross Ihaka
11
 *                     Copyright (C) 1998-2001   The R Development Core Team
11
 *                     Copyright (C) 1998-2001   The R Development Core Team
12
 *                     Copyright (C) 2002-2004   The R Foundation
12
 *                     Copyright (C) 2002-2004   The R Foundation
13
 *
13
 *
14
 *  This program is free software; you can redistribute it and/or modify
14
 *  This program is free software; you can redistribute it and/or modify
15
 *  it under the terms of the GNU General Public License as published by
15
 *  it under the terms of the GNU General Public License as published by
16
 *  the Free Software Foundation; either version 2 of the License, or
16
 *  the Free Software Foundation; either version 2 of the License, or
17
 *  (at your option) any later version.
17
 *  (at your option) any later version.
18
 *
18
 *
19
 *  This program is distributed in the hope that it will be useful,
19
 *  This program is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
22
 *  GNU General Public License for more details.
23
 *
23
 *
24
 *  A copy of the GNU General Public License is available via WWW at
24
 *  A copy of the GNU General Public License is available via WWW at
25
 *  http://www.gnu.org/copyleft/gpl.html.  You can also obtain it by
25
 *  http://www.gnu.org/copyleft/gpl.html.  You can also obtain it by
26
 *  writing to the Free Software Foundation, Inc., 59 Temple Place,
26
 *  writing to the Free Software Foundation, Inc., 59 Temple Place,
27
 *  Suite 330, Boston, MA  02111-1307  USA.
27
 *  Suite 330, Boston, MA  02111-1307  USA.
28
 *
28
 *
29
 *  RScriptEditorLayoutManager.m
29
 *  RScriptEditorLayoutManager.m
30
 *
30
 *
31
 *  Created by Hans-J. Bibiko on 01/03/2012.
31
 *  Created by Hans-J. Bibiko on 01/03/2012.
32
 *
32
 *
33
 */
33
 */
34
 
34
 
35
#import "RScriptEditorLayoutManager.h"
35
#import "RScriptEditorLayoutManager.h"
36
#import "RScriptEditorTypeSetter.h"
36
#import "RScriptEditorTypeSetter.h"
37
#import "RScriptEditorGlyphGenerator.h"
37
#import "RScriptEditorGlyphGenerator.h"
38
#import "RScriptEditorTextStorage.h"
38
#import "RScriptEditorTextStorage.h"
39
#import "PreferenceKeys.h"
39
#import "PreferenceKeys.h"
40
 
40
 
41
@implementation RScriptEditorLayoutManager
41
@implementation RScriptEditorLayoutManager
42
 
42
 
43
- (id)init
43
- (id)init
44
{
44
{
45
 
45
 
46
	self = [super init];
46
	self = [super init];
47
    
47
    
48
	if (nil == self) return nil;
48
	if (nil == self) return nil;
49
 
49
 
50
	// Setup LineFoldingTypesetter
50
	// Setup LineFoldingTypesetter
51
	RScriptEditorTypeSetter *typesetter = [[RScriptEditorTypeSetter alloc] init];
51
	RScriptEditorTypeSetter *typesetter = [[RScriptEditorTypeSetter alloc] init];
52
	[self setTypesetter:typesetter];
52
	[self setTypesetter:typesetter];
53
	[typesetter release];
53
	[typesetter release];
54
	
54
	
55
	// Setup LineFoldingGlyphGenerator
55
	// Setup LineFoldingGlyphGenerator
56
	RScriptEditorGlyphGenerator *glyphGenerator = [[RScriptEditorGlyphGenerator alloc] init];
56
	RScriptEditorGlyphGenerator *glyphGenerator = [[RScriptEditorGlyphGenerator alloc] init];
57
	[self setGlyphGenerator:glyphGenerator];
57
	[self setGlyphGenerator:glyphGenerator];
58
	[glyphGenerator release];
58
	[glyphGenerator release];
59
 
59
 
60
	[self setBackgroundLayoutEnabled:YES];
60
	[self setBackgroundLayoutEnabled:NO];
61
 
61
 
62
	return self;
62
	return self;
63
 
63
 
64
}
64
}
65
 
65
 
66
- (void)dealloc
66
- (void)dealloc
67
{
67
{
68
	if(_attributedString) [_attributedString release];
68
	if(_attributedString) [_attributedString release];
69
	[super dealloc];
69
	[super dealloc];
70
}
70
}
71
 
71
 
72
- (void)replaceTextStorage:(id)textStorage
72
- (void)replaceTextStorage:(id)textStorage
73
{
73
{
74
	if(_attributedString) [_attributedString release];
74
	if(_attributedString) [_attributedString release];
75
	_attributedString = [(RScriptEditorTextStorage*)textStorage retain];
75
	_attributedString = [(RScriptEditorTextStorage*)textStorage retain];
76
	[(RScriptEditorGlyphGenerator*)[self glyphGenerator] setTextStorage:textStorage];
76
	[(RScriptEditorGlyphGenerator*)[self glyphGenerator] setTextStorage:textStorage];
77
	[super replaceTextStorage:textStorage];
77
	[super replaceTextStorage:textStorage];
78
}
78
}
79
 
79
 
80
@end
80
@end