| 1493 |
urbaneks |
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-5 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 |
* Created by Simon Urbanek on 5/11/05.
|
|
|
30 |
* $Id: RTextView.h 7927 2021-02-12 02:19:59Z urbaneks $
|
|
|
31 |
*/
|
|
|
32 |
|
| 5708 |
urbaneks |
33 |
#import "CCComp.h"
|
| 1493 |
urbaneks |
34 |
|
|
|
35 |
/* RTextView is a subclass of NSTextView with some additional properties:
|
|
|
36 |
- responds to <Ctrl><.> by sending complete: to self
|
| 5705 |
urbaneks |
37 |
- responds to <Ctrl><h> by sending showHelpForCurrentFunction: to self
|
|
|
38 |
- handle deleteBackward/Forward for linked matchin pairs
|
| 1493 |
urbaneks |
39 |
|
|
|
40 |
Used by: console and editor
|
|
|
41 |
|
|
|
42 |
*/
|
|
|
43 |
|
| 5880 |
bibiko |
44 |
// parser context in text
|
|
|
45 |
#define pcStringSQ 1
|
|
|
46 |
#define pcStringDQ 2
|
|
|
47 |
#define pcStringBQ 3
|
|
|
48 |
#define pcComment 4
|
|
|
49 |
#define pcExpression 5
|
|
|
50 |
|
| 4196 |
urbaneks |
51 |
extern BOOL RTextView_autoCloseBrackets;
|
|
|
52 |
|
| 5705 |
urbaneks |
53 |
@interface RTextView : NSTextView
|
|
|
54 |
{
|
| 6040 |
bibiko |
55 |
BOOL console;
|
| 5995 |
bibiko |
56 |
BOOL isRdDocument;
|
| 6070 |
bibiko |
57 |
|
|
|
58 |
NSInteger snippetControlArray[20][3];
|
|
|
59 |
NSInteger snippetMirroredControlArray[20][3];
|
|
|
60 |
NSInteger snippetControlCounter;
|
|
|
61 |
NSInteger snippetControlMax;
|
|
|
62 |
NSInteger currentSnippetIndex;
|
|
|
63 |
NSInteger mirroredCounter;
|
|
|
64 |
BOOL snippetWasJustInserted;
|
|
|
65 |
BOOL isProcessingMirroredSnippets;
|
|
|
66 |
|
|
|
67 |
|
| 5707 |
urbaneks |
68 |
@private
|
|
|
69 |
NSCharacterSet *separatingTokensSet;
|
| 5737 |
urbaneks |
70 |
NSCharacterSet *undoBreakTokensSet;
|
| 6230 |
bibiko |
71 |
NSMutableCharacterSet *wordCharSet;
|
| 1493 |
urbaneks |
72 |
}
|
|
|
73 |
|
| 6230 |
bibiko |
74 |
// Both methods are already implemented in NSTextView_RAddition but there
|
|
|
75 |
// one cannot init instance variable. That's why it is overwritten here to
|
|
|
76 |
// be able to speed up getRangeForCurrentWordOfRange enormously
|
|
|
77 |
- (NSRange)getRangeForCurrentWord;
|
|
|
78 |
- (NSRange)getRangeForCurrentWordOfRange:(NSRange)curRange;
|
|
|
79 |
|
| 5705 |
urbaneks |
80 |
- (void)setConsoleMode:(BOOL)isConsole;
|
| 4196 |
urbaneks |
81 |
|
| 7927 |
urbaneks |
82 |
- (int) parserContextForPosition:(NSInteger)position;
|
| 6040 |
bibiko |
83 |
- (void) showHelpForCurrentFunction;
|
|
|
84 |
- (void) currentFunctionHint;
|
| 5719 |
urbaneks |
85 |
- (BOOL) wrapSelectionWithPrefix:(NSString *)prefix suffix:(NSString *)suffix;
|
|
|
86 |
- (BOOL) isNextCharMarkedBy:(id)attribute withValue:(id)aValue;
|
|
|
87 |
- (BOOL) isCursorAdjacentToAlphanumCharWithInsertionOf:(unichar)aChar;
|
|
|
88 |
- (BOOL) shiftSelectionRight;
|
|
|
89 |
- (BOOL) shiftSelectionLeft;
|
|
|
90 |
- (BOOL) isRConsole;
|
| 5705 |
urbaneks |
91 |
|
| 6040 |
bibiko |
92 |
- (IBAction)makeASCIIconform:(id)sender;
|
|
|
93 |
- (IBAction)unescapeUnicode:(id)sender;
|
|
|
94 |
|
| 6067 |
bibiko |
95 |
- (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint;
|
|
|
96 |
|
| 6070 |
bibiko |
97 |
- (void)endSnippetSession;
|
|
|
98 |
- (void)processMirroredSnippets;
|
|
|
99 |
- (void)selectCurrentSnippet;
|
|
|
100 |
- (void)insertAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange;
|
|
|
101 |
- (BOOL)checkForCaretInsideSnippet;
|
|
|
102 |
- (BOOL)isSnippetMode;
|
|
|
103 |
- (void)checkSnippets;
|
|
|
104 |
- (NSDictionary*)getCurrentEnvironment;
|
|
|
105 |
|
|
|
106 |
|
| 1493 |
urbaneks |
107 |
@end
|