2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #import <Cocoa/Cocoa.h>
23 #import "SCTextView.h"
24 #include "PyrObject.h"
25 #include "PyrKernel.h"
27 #include "VMGlobals.h"
29 extern pthread_mutex_t gLangMutex
;
30 extern PyrSymbol
*s_closed
;
32 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
33 @interface MyDocument
: NSDocument
<NSOpenSavePanelDelegate
, NSTextViewDelegate
>
35 @interface MyDocument
: NSDocument
39 IBOutlet SCTextView
* initTextView
;
40 IBOutlet SCTextView
* textView
;
41 IBOutlet NSScrollView
* scrollView
;
42 IBOutlet NSSplitView
*mySplitView
;
43 IBOutlet SCTextView
*textView2
;
44 IBOutlet NSScrollView
*scrollView2
;
45 SCTextView
*activeTextView
;
47 struct PyrObject
*mWindowObj
;
49 NSString
*pathToSaveAttachments
;
54 - (SCTextView
*)makeTextView
;
55 - (SCTextView
*) textView
;
56 - (SCTextView
*) textView2
;
58 - (void)windowControllerDidLoadNib
:(NSWindowController
*) aController
;
62 - (IBAction
)openCode
:(id
)sender
;
63 - (IBAction
)methodTemplates
: (id
)sender
;
64 - (IBAction
)methodReferences
: (id
)sender
;
66 - (IBAction
)balanceParens
: (id
)sender
;
68 - (IBAction
)syntaxColorize
: (id
)sender
;
69 - (void) insertText
: (char*) text length
: (int)length
;
70 - (IBAction
)shiftLeft
: (id
)sender
;
71 - (IBAction
)shiftRight
: (id
)sender
;
72 - (IBAction
)commentCode
: (id
)sender
;
73 - (IBAction
)uncommentCode
:(id
)sender
;
74 - (IBAction
)wrapParens
: (int)sender
;
75 - (IBAction
)wrapSquareBrackets
: (int)sender
;
76 - (IBAction
)wrapCurlyBrackets
: (int)sender
;
78 - (IBAction
) executeSelection
: (id
) sender
;
79 //- (NSString*)currentlySelectedTextOrLine: (NSRange*) outRange;
80 -(void)selectRangeStart
:(int)rangeStart size
:(int)rangeSize
;
82 - (IBAction
) showHelpFor
: (id
) sender
;
83 - (IBAction
)showClassBrowser
:(id
)sender
;
85 - (BOOL
) textView
: (NSTextView
*) textView
86 clickedOnLink
: (id
) link
87 atIndex
: (unsigned) charIndex
;
88 - (IBAction
) createLink
: (id
) sender
;
90 - (void)sendSelection
: (const char*) methodName
;
92 - (NSString
*)windowNibName
;
94 - (BOOL
)writeToFile
:(NSString
*) path ofType
:(NSString
*)aType
;
95 - (BOOL
)readFromFile
:(NSString
*)path ofType
:(NSString
*)aType
;
97 - (BOOL
) shouldRunSavePanelWithAccessoryView
;
99 - (BOOL
)windowShouldClose
:(id
)sender
;
100 - (void)windowWillClose
:(NSNotification
*)aNotification
;
101 - (IBAction
) becomePostWindow
: (id
) sender
;
102 - (BOOL
) isDocumentEdited
;
104 - (void)doToggleRich
;
105 // toggleRich: puts up an alert before ultimately calling doToggleRich
106 - (IBAction
)toggleRich
:(id
)sender
;
107 - (void)setRichText
:(BOOL
)flag
;
109 - (BOOL
)validateMenuItem
:(NSMenuItem
*)aCell
;
111 - (void)setSCObject
: (struct PyrObject
*)inObject
;
112 - (struct PyrObject
*)getSCObject
;
113 - (void) closeWindow
;
114 - (void)setBackgroundColor
:(NSColor
*)color
;
115 - (void)setSelectedBackgroundColor
:(NSColor
*)color
;
116 - (NSScrollView
*) scrollView
;
117 - (SCTextView
*) initTextView
;
118 - (SCTextView
*) activeTextView
;
119 - (void)initialiseTextViewParams
: (SCTextView
*)aTextView
;
120 - (void)selectLine
:(int)linenum
;
121 - (IBAction
)selectLineWindow
: (id
) sender
;
122 - (IBAction
)advancedFindReplaceAction
:(id
)sender
;
123 - (void) callSCLangWithMethod
: (PyrSymbol
*) method
;
124 - (BOOL
) promptToSave
;
125 - (void) setPromptToSave
: (BOOL
) flag
;
126 - (void) keyUp
: (NSEvent
*) event
;
127 - (void) keyDown
: (NSEvent
*) event
;
128 - (BOOL
) handleKeyDown
: (NSEvent
*) event
;
129 - (void) mouseDown
: (NSEvent
*) event
;
131 - (BOOL
)textView
:(NSTextView
*)textView shouldChangeTextInRange
:(NSRange
)affectedCharRange replacementString
:(NSString
*)replacementString
;
132 - (void)flashHighlight
: (BOOL
)onoff atIndex
: (int)index wait
: (NSTimeInterval
)interval timesLeft
: (int)timesLeft
;
133 - (void)replaceOldStyleHelpLinksWithHyperLinks
;
134 - (IBAction
)convertHelpLinksToHyperlinks
:(id
)sender
;
135 - (void)convertFileLinksToRelative
:(NSTextStorage
*)textStorage
;
137 - (void) loadHTML
:(NSURL
*)url
;
139 - (IBAction
)toggleSplitWindow
: (id
)sender
;
140 - (void)setActiveTextView
:(SCTextView
*)aTextView
;
141 - (void) setUsesAutoInOutdent
: (bool)flag
;
144 NSString
* pathOfHelpFileFor(NSString
* selection
);
145 void showHelpFor(NSString
* selection
);
146 void fixHTMLBoldUnderline(NSMutableString
* html
);
147 NSString
* pathOfFileRelativeToBaseDir(NSString
*filepath
, NSString
*baseDir
);