The R Project SVN R-packages

Rev

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

Rev 7916 Rev 7929
Line 31... Line 31...
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 "RScriptEditorTextStorage.h"
35
#import "RScriptEditorTextStorage.h"
36
#import "RScriptEditorTypesetter.h"
36
#import "RScriptEditorTypeSetter.h"
37
#import "RScriptEditorTextView.h"
37
#import "RScriptEditorTextView.h"
38
#import "FoldingSignTextAttachmentCell.h"
38
#import "FoldingSignTextAttachmentCell.h"
39
#import "RGUI.h"
39
#import "RGUI.h"
40
 
40
 
41
@implementation RScriptEditorTextStorage
41
@implementation RScriptEditorTextStorage
Line 166... Line 166...
166
			foldedRanges[i][0] = (NSInteger)range.location;
166
			foldedRanges[i][0] = (NSInteger)range.location;
167
			foldedRanges[i][1] = (NSInteger)range.length;
167
			foldedRanges[i][1] = (NSInteger)range.length;
168
			foldedRanges[i][2] = (NSInteger)NSMaxRange(range);
168
			foldedRanges[i][2] = (NSInteger)NSMaxRange(range);
169
			foldedCounter++;
169
			foldedCounter++;
170
			if(i > currentMaxFoldedIndex) currentMaxFoldedIndex = i;
170
			if(i > currentMaxFoldedIndex) currentMaxFoldedIndex = i;
171
			SLog(@"RScriptEditorTextStorage:registerFoldedRange %@ at position %d : max index %d", NSStringFromRange(range), i, currentMaxFoldedIndex);
171
			SLog(@"RScriptEditorTextStorage:registerFoldedRange %@ at position %ld : max index %ld", NSStringFromRange(range), (long)i, (long)currentMaxFoldedIndex);
172
			break;
172
			break;
173
		}
173
		}
174
	}
174
	}
175
 
175
 
176
	[[selfDelegate undoManager] enableUndoRegistration];
176
	[[selfDelegate undoManager] enableUndoRegistration];
Line 183... Line 183...
183
{
183
{
184
 
184
 
185
	BOOL exists = NO;
185
	BOOL exists = NO;
186
	NSRange range;
186
	NSRange range;
187
	
187
	
188
	SLog(@"RScriptEditorTextStorage:removeFoldedRangeWithIndex %d", index);
188
	SLog(@"RScriptEditorTextStorage:removeFoldedRangeWithIndex %ld", (long)index);
189
	
189
	
190
	if(index > -1 && index < R_MAX_FOLDED_ITEMS) {
190
	if(index > -1 && index < R_MAX_FOLDED_ITEMS) {
191
		if(foldedRanges[index][0] > -1 && foldedRanges[index][1] > 0) {
191
		if(foldedRanges[index][0] > -1 && foldedRanges[index][1] > 0) {
192
			range = NSMakeRange(foldedRanges[index][0], foldedRanges[index][1]);
192
			range = NSMakeRange(foldedRanges[index][0], foldedRanges[index][1]);
193
			exists = YES;
193
			exists = YES;
Line 236... Line 236...
236
		if(foldedRanges[i][0] > -1) {
236
		if(foldedRanges[i][0] > -1) {
237
			if(i > maxCount) maxCount = i;
237
			if(i > maxCount) maxCount = i;
238
		}
238
		}
239
	}
239
	}
240
	currentMaxFoldedIndex = maxCount;
240
	currentMaxFoldedIndex = maxCount;
241
	SLog(@"RScriptEditorTextStorage:removeFoldedRangeWithIndex: done. Max index: %d", currentMaxFoldedIndex);
241
	SLog(@"RScriptEditorTextStorage:removeFoldedRangeWithIndex: done. Max index: %ld", (long) currentMaxFoldedIndex);
242
 
242
 
243
	return YES;
243
	return YES;
244
}
244
}
245
 
245
 
246
- (void)removeAllFoldedRanges
246
- (void)removeAllFoldedRanges
Line 342... Line 342...
342
 
342
 
343
	return attributes;
343
	return attributes;
344
 
344
 
345
}
345
}
346
 
346
 
347
- (void)edited:(NSUInteger)mask range:(NSRange)oldRange changeInLength:(NSInteger)lengthChange
347
- (void)edited:(NSTextStorageEditActions)mask range:(NSRange)oldRange changeInLength:(NSInteger)lengthChange
348
{
348
{
349
 
349
 
350
	if(foldedCounter && mask == NSTextStorageEditedCharacters) {
350
	if(foldedCounter && mask == NSTextStorageEditedCharacters) {
351
		// update foldedRanges array due to changes
351
		// update foldedRanges array due to changes
352
		NSInteger index = oldRange.location-1;
352
		NSInteger index = oldRange.location-1;