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