1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.54">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0021e7}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
; min-height: 17.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; min-height: 14.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
; min-height: 14.0px}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #606060}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #ad140d}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.0px}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; color: #001bb9; min-height: 14.0px}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #2c7014}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #001bb9}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
28 p
.p19
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
29 p
.p20
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
; color: #001bb9; min-height: 14.0px}
30 p
.p21
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 11.0px Monaco
}
31 p
.p22
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Monaco
}
32 p
.p23
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 9.0px Monaco
}
33 p
.p24
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
}
34 p
.p25
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #ad140d}
35 p
.p26
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #001bb9}
36 span
.s1
{font: 18.0px Helvetica
}
37 span
.s2
{color: #001bb9}
38 span
.s3
{color: #000000}
39 span
.s4
{text-decoration: underline
}
40 span
.s5
{color: #606060}
41 span
.s6
{font: 9.0px Monaco
}
42 span
.s7
{font: 12.0px Helvetica
; color: #000000}
43 span
.s8
{font: 12.0px Helvetica
}
44 span
.s9
{color: #2c7014}
45 span
.s10
{color: #ad140d}
46 span
.s11
{font: 14.0px Helvetica
}
47 span
.s12
{font: 14.0px Impact
}
48 span
.s13
{font: 14.0px Monaco
}
49 span
.s14
{font: 12.0px Lucida Grande
; color: #001bb9}
50 span
.Apple-tab-span
{white-space:pre
}
54 <p class=
"p1"><span class=
"s1"><b>Document
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>an abstract class for editor-specific text document editing classes
</b><span class=
"s1"><b><span class=
"Apple-tab-span"> </span></b></span></p>
55 <p class=
"p2"><br></p>
56 <p class=
"p1"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><span class=
"s2"><b>Object
</b></span></a></p>
57 <p class=
"p3"><br></p>
58 <p class=
"p1">The Document class represents a text document within the context of your text editing environment. You can use the class to programmatically create, modify, and query these documents. While it is an abstract class, you still use it to create a
<b>new
</b> Document. It simply passes on
<b>new
</b> to the appropriate document implementation, e.g. CocoaDocument.
</p>
59 <p class=
"p2"><br></p>
60 <p class=
"p4"><span class=
"s3"><b>See also:
</b> <a href=
"../../OSX/CocoaDocument.html"><span class=
"s4">CocoaDocument
</span></a></span></p>
61 <p class=
"p2"><br></p>
62 <p class=
"p5"><b>Some Important Issues Regarding Document
</b></p>
63 <p class=
"p2"><br></p>
64 <p class=
"p1">Different text-editing environments can be used with SuperCollider. Therefore Document is an abstract class, meaning it doesn't provide all the functionality itself, but relies on subclasses to complete the functionality. Calls to Document.
<b>new
</b> or Document.
<b>open
</b> are actually passed down to the relevant class for the editor you're using, such as CocoaDocument (for most Mac users) or ScelDocument (containing an EmacsDocument).
</p>
65 <p class=
"p2"><br></p>
66 <p class=
"p5"><b>Setting the Environment
</b></p>
67 <p class=
"p6"><br></p>
68 <p class=
"p1">By defualt
<b>envir
</b> it is set to the current
<a href=
"../../Collections/Environment.html"><span class=
"s2">Environment
</span></a>. However, you can make it use its own Environment also. Thus, e.g., if you were to set the Environment variable ~myVar=
12 in the current Environment, you can create a new Document window in which that Environment variable is not set.
</p>
69 <p class=
"p2"><br></p>
70 <p class=
"p5"><b>Creation / Class Methods
</b></p>
71 <p class=
"p7"><br></p>
72 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*new (title, string, makeListener, envir)
</b></p>
73 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
74 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>title
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a> or
<a href=
"../../Core/Symbol.html"><span class=
"s2">Symbol
</span></a>. Default value is
"Untitled".
</p>
75 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>string
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a> . Default value is
"". The contents of the document.
</p>
76 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>makeListener
</b>- Makes this document the lisenter, i.e. the place where SC-lang posts messages. Default value is false. .
</p>
77 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>envir
</b>- An instance of
<a href=
"../../Collections/Environment.html"><span class=
"s2">Environment
</span></a>. The Environment to be used by the interpreter of the document window. By defualt, it is set to the current Environment.
</p>
78 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
79 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.new(
</span>"this is the title"<span class=
"s3">,
</span>"this is the text"<span class=
"s3">);
</span></p>
80 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
81 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*open (path, selectionStart, selectionLength, envir)
</b></p>
82 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
83 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Open a document from a path.
</p>
84 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b>- The file system path to the document. An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
85 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>selectionStart
</b>-The beginning of the cursor seleciton of the file content. Default value is
0.
</p>
86 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>selectionLength
</b>- The length of the cursor seleciton of the file content. Default value is
0.
</p>
87 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>envir
</b>- An instance of
<a href=
"../../Collections/Environment.html"><span class=
"s2">Environment
</span></a>. The Environment to be used by the interpreter of the document window. By defualt, it is set to the current Environment.
</p>
88 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
89 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.open(
</span><span class=
"s5">"README"</span><span class=
"s3">,
292,
253);
</span>// notice the selected text in the open document
</p>
90 <p class=
"p13"><br></p>
91 <p class=
"p13"><br></p>
92 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*openDocuments
</b></p>
93 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
94 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns an Array of all open documents.
</p>
95 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
96 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>d=
<span class=
"s2">Document
</span>.openDocuments.do{
<span class=
"s2">|doc|
</span> doc.name.postln};
</p>
97 <p class=
"p13"><br></p>
98 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*hasEditedDocuments
</b></p>
99 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
100 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns
<b>true
</b> if there are edited Documents.
</p>
101 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
102 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*closeAll (leavePostWindowOpen)
</b></p>
103 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
104 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>CAUTION
</b>Closes all open Documents, whether edited or not.
</p>
105 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>leavePostWindowOpen
</b>- An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>. Default is
<b>true
</b>.
</p>
106 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
107 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*closeAllUnedited (leavePostWindowOpen)
</b></p>
108 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
109 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Closes all unedtited Documents.
</p>
110 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>leavePostWindowOpen
</b>- An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>. Default is
<b>true
</b>.
</p>
111 <p class=
"p7"><br></p>
112 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*current
</b></p>
113 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*current_(arg1)
</b></p>
114 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
115 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets/sets the current Document.
</p>
116 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
117 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.current.name.postln;
</span>// Prints
"Document.html"</p>
118 <p class=
"p13"><br></p>
119 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*listener
</b></p>
120 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
121 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns the current Document which is the listener, i.e. the Document where interpreter messages are posted.
</p>
122 <p class=
"p7"><br></p>
123 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*storePostWin (path)
</b></p>
124 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
125 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Stores the conteng of Document.listener.
</p>
126 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b>- The file system path. An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
127 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
128 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*allDocuments
</b></p>
129 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
130 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. Returns all documents
</p>
131 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Default value is defaultValue.
</p>
132 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
133 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*globalKeyDownAction
</b></p>
134 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*globalKeyDownAction_(arg1)
</b></p>
135 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
136 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. Get/set A global action to be performed when a key is pressed.
</p>
137 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a>.
</p>
138 <p class=
"p7"><br></p>
139 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*globalKeyUpAction
</b></p>
140 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*globalKeyUpAction_(arg1)
</b></p>
141 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
142 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. Get/set A global action to be performed when a key is released.
</p>
143 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a>.
</p>
144 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
145 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*initAction
</b></p>
146 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*initAction_(arg1)
</b></p>
147 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. Get/set A an action to be performed up openning or creating a Document.
</p>
148 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a>.
</p>
149 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
150 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*autoRun
</b></p>
151 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*autoRun_
</b></p>
152 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
153 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. If a document begins with the String,
"/*RUN*/", then the code following it int he file will be exectued on opening the file, if
<b>autorun
</b> is set to true.
</p>
154 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>. Default value is true.
</p>
155 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
156 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*wikiBrowse
</b></p>
157 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*wikiBrowse_(arg1)
</b></p>
158 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
159 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. If set to true, underlining text will create a wiki link.
</p>
160 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>. Default value is true.
</p>
161 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
162 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*implementationClass
</b></p>
163 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*implementationClass_(arg1)
</b></p>
164 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
165 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>A class variable. The editor implementation specific class which will handle Documents.
</p>
166 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - A class for implementing Document, e.g.
<a href=
"../../OSX/CocoaDocument.html"><span class=
"s2">CocoaDocument
</span></a></p>
167 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
168 <p class=
"p8"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span><b>*setTheme(arg1)
</b></p>
169 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
170 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Sets the theme for syntax colorization. The Document class has a preset theme called 'default',
</p>
171 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>which is set as follows (default SC colors):
</p>
172 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
173 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>themes = (
</p>
174 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>default: (
</p>
175 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>classColor:
<span class=
"s2">Color
</span>(
0,
0,
0.75,
1),
</p>
176 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>textColor:
<span class=
"s2">Color
</span>(
0,
0,
0,
1),
</p>
177 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>stringColor:
<span class=
"s2">Color
</span>(
0.375,
0.375,
0.375,
1),
</p>
178 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>commentColor:
<span class=
"s2">Color
</span>(
0.75,
0,
0,
1),
</p>
179 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>symbolColor:
<span class=
"s2">Color
</span>(
0,
0.45,
0,
1),
</p>
180 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>numberColor:
<span class=
"s2">Color
</span>(
0,
0,
0,
1)
</p>
181 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
182 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
183 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
184 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>If you want to have your own themes for syntax colorization, you need to put your color set into
</p>
185 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Document.themes first (preferably in startup.rtf file) and call setTheme by giving it the name of
</p>
186 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>the theme you've added to
"themes" earlier:
</p>
187 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
188 <p class=
"p12"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//putting a custom color theme into Document.themes
</p>
189 <p class=
"p14"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span>.themes.put
</p>
190 <p class=
"p16"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</span>\myTheme
<span class=
"s3">,
<span class=
"Apple-converted-space"> </span></span></p>
191 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
192 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>classColor:
<span class=
"s2">Color
</span>.new255(
53,
74,
187),
</p>
193 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>textColor:
<span class=
"s2">Color
</span>.new255(
0,
0,
0),
</p>
194 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>stringColor:
<span class=
"s2">Color
</span>.new255(
96,
129,
158),
</p>
195 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>commentColor:
<span class=
"s2">Color
</span>.new255(
206,
27,
28),
</p>
196 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>symbolColor:
<span class=
"s2">Color
</span>.new255(
57,
154,
20),
</p>
197 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>numberColor:
<span class=
"s2">Color
</span>.new255(
157,
80,
65)
</p>
198 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
199 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
200 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
201 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//and then calling setTheme with the name:
</p>
202 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.setTheme(
<span class=
"s9">'myTheme'
</span>);
</p>
203 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//to see the current theme:
</p>
204 <p class=
"p17"><span class=
"s10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>Document
<span class=
"s3">.theme;
</span></p>
205 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
206 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>You can switch to the default theme anytime by calling:
</p>
207 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
208 <p class=
"p14"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span>.setTheme(
<span class=
"s9">'default'
</span>);
</p>
209 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
210 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>Next time you invoke syntaxColorize, the color theme set by setTheme will be used for syntax
</p>
211 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>colorization. If you want to change the background color for the document window and selected
</p>
212 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>text, in order to make them fit with your syntax colorization theme, see the help for the
"background" and
"selectedBackground" methods for Document.
</p>
213 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
214 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b> - A Symbol, defining the name of the theme that you've put into Document.themes.
</p>
215 <p class=
"p7"><br></p>
216 <p class=
"p5"><b>Path Utilites
</b></p>
217 <p class=
"p8"><span class=
"s11"><span class=
"Apple-tab-span"> </span></span>Utilities and settings for dealing with documents such as super collider code files. By default the document directory is SuperCollider's application directory.
</p>
218 <p class=
"p7"><br></p>
219 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*dir
</b></p>
220 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*dir_ (path)
</b></p>
221 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
222 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get/set the default document directory. The default is dependent on Document.implementationClass.
</p>
223 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b>- The file system path to the directory. An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
224 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
225 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>In Main-startUp you can set this to a more practical directory:
</p>
226 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
227 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.dir =
</span>"~/Documents/SuperCollider"<span class=
"s3">;
</span></p>
228 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
229 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*wikiDir
</b></p>
230 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*wikiDir_ (path)
</b></p>
231 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
232 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get/set the default wiki directory. The default is dependent on Document.implementationClass.
</p>
233 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b>- The file system path to the directory. An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
234 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
235 <p class=
"p13"><br></p>
236 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*standardizePath (p)
</b></p>
237 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
238 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>If it is a relative path, expand it to an absolute path relative to your document directory.
<span class=
"Apple-tab-span"> </span>Expand tildes in path (your home directory), resolve symbolic links (but not aliases). Also converts from OS9 macintosh path format. See
<a href=
"../../Files/PathName.html"><span class=
"s2">PathName
</span></a><b> </b>for more complex needs.
</p>
239 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b>- The file system path to the directory. An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
240 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
241 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.standardizePath(
</span><span class=
"s5">"~/"</span><span class=
"s3">);
</span>//This will print your home directory
<span class=
"Apple-tab-span"> </span></p>
242 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
243 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.standardizePath(
</span>":Patches:newfoots:fastRuckAndTuck"<span class=
"s3">)
</span></p>
244 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
245 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Returns: /Volumes/Macintosh HD/Users/cruxxial/Documents/SC3docs/Patches/newfoots/fastRuckAndTuck
</p>
246 <p class=
"p13"><span class=
"Apple-tab-span"> </span></p>
247 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.standardizePath(
</span>"~/Documents/SC3docs/Patches/newfoots/fastRuckAndTuck"<span class=
"s3">)
</span></p>
248 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
249 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Returns: Patches/newfoots/fastRuckAndTuck
</p>
250 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
251 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.standardizePath(
</span>"Patches/newfoots/fastRuckAndTuck"<span class=
"s3">)
</span></p>
252 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
253 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Returns: Patches/newfoots/fastRuckAndTuck
</p>
254 <p class=
"p13"><br></p>
255 <p class=
"p13"><br></p>
256 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*abrevPath (path)
</b></p>
257 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
258 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns a path relative to Document.dir, if the path is inside Document.dir.
</p>
259 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b>- The file system path to the directory. An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
260 <p class=
"p6"><br></p>
261 <p class=
"p5"><b>General Document Properties
</b></p>
262 <p class=
"p6"><br></p>
263 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>bounds
</b></p>
264 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>bounds_ (argBounds)
</b></p>
265 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
266 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get/set the bounds of the document.
</p>
267 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>argBounds
</b>- an instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>.
</p>
268 <p class=
"p2"><br></p>
269 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>path
</b></p>
270 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>path_ (apath)
</b></p>
271 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
272 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the the Document's
<b>path
</b>.
</p>
273 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>apath
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>. A files system path.
</p>
274 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
275 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.path.postln;
</p>
276 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
277 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>dir
</b></p>
278 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Returns the directory of a Document.
</p>
279 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
280 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.dir.postln;
</p>
281 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
282 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>== (doc)
</b></p>
283 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
284 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>A binary operator.
</p>
285 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>doc
</b>- An instance of Document.
</p>
286 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
287 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.current ==
</span><span class=
"s2">Document
</span><span class=
"s3">.listener;
</span>//presumaably returns false
</p>
288 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
289 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>editable
</b></p>
290 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>editable_(abool)
</b></p>
291 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
292 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the the document is editable.
</p>
293 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b>- An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>.
</p>
294 <p class=
"p7"><br></p>
295 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>name
</b></p>
296 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>name_ (aname)
</b></p>
297 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>title
</b></p>
298 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>title_ (argName)
</b></p>
299 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
300 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the title.
</p>
301 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>aname/argName
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
302 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
303 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.name.postln
</p>
304 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
305 <p class=
"p8"><span class=
"s12"><span class=
"Apple-tab-span"> </span></span><b>background
</b></p>
306 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>background_ (color)
</b></p>
307 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
308 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the the Document's background color.
</p>
309 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>;
</p>
310 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
311 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
312 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
</span><span class=
"s2">Document
</span><span class=
"s3">(
</span>"background"<span class=
"s3">,
</span>"'hardly see anything"<span class=
"s3">);
</span></p>
313 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.background_(
</span><span class=
"s2">Color
</span><span class=
"s3">.blue(alpha:
0.8));
</span>// notice that alpha controlls th window transparency
</p>
314 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
315 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
316 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>postColor
</b></p>
317 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>postColor_ (color)
</b></p>
318 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
319 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the listeners pen color.
</p>
320 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>;
</p>
321 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
322 <p class=
"p12"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.postColor;
</span>//returns current post color
</p>
323 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.postColor_(
<span class=
"s2">Color
</span>.red);
</p>
324 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.postColor_(
<span class=
"s2">Color
</span>.green);
</p>
325 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.postColor_(
<span class=
"s2">Color
</span>.blue);
</p>
326 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.postColor_(
<span class=
"s2">Color
</span>.black);
</p>
327 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
328 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r =
<span class=
"s2">Routine
</span>({
<span class=
"Apple-converted-space"> </span></p>
329 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>10.do({
</p>
330 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.postColor_(
<span class=
"s2">Color
</span>.rand);
</p>
331 <p class=
"p19"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"There is no blue without yellow and without orange."<span class=
"s3">.postln;
</span></p>
332 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.5.rand.yield;
</p>
333 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
334 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.postColor_(
<span class=
"s2">Color
</span>.black);
</p>
335 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
336 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
337 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
338 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r.play;
</p>
339 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r.stop;
</p>
340 <p class=
"p7"><br></p>
341 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>alwaysOnTop
</b></p>
342 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>alwaysOnTop_ (boolean)
</b></p>
343 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
344 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get/set whether a document is always on top.
</p>
345 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>boolean
</b>- An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>.
</p>
346 <p class=
"p7"><br></p>
347 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>promptToSave
</b></p>
348 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>promptToSave_ (bool)
</b></p>
349 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
350 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get/set whether a document is prompts to save if it has been changed. Use this with caution.
</p>
351 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>bool
</b>- An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>.
</p>
352 <p class=
"p13"><br></p>
353 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>closed
</b></p>
354 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
355 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns
<b>true
</b> if the document has been closed
</p>
356 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
357 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>isEdited
</b></p>
358 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
359 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns true if the document has been edited.
</p>
360 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
361 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.isEdited.postln;
</p>
362 <p class=
"p13"><br></p>
363 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>isFront
</b></p>
364 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
365 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns true if the document is in front.
</p>
366 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
367 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>isListener
</b></p>
368 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
369 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns if the document is the
<b>listener
</b>.
</p>
370 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
371 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>didBecomeKey
</b></p>
372 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
373 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Saves the current Environment, makes the document current, and performs its
<b>toFrontAction
</b>.
</p>
374 <p class=
"p13"><br></p>
375 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>didResignKey
</b></p>
376 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
377 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Performs the Document's
<b>endFrontAction
</b> and restores the current Environment.
</p>
378 <p class=
"p6"><br></p>
379 <p class=
"p5"><b>Controlling Document
</b></p>
380 <p class=
"p6"><br></p>
381 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>close
</b></p>
382 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
383 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Close a document.
</p>
384 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
385 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
386 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Task
</span>({
</p>
387 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> doc;
</p>
388 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc =
</span><span class=
"s2">Document
</span><span class=
"s3">(
</span>"background"<span class=
"s3">,
</span>"closing in 2 seconds"<span class=
"s3">);
</span></p>
389 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.stringColor_(
<span class=
"s2">Color
</span>.blue);
</p>
390 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1.wait;
</p>
391 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.background_(
<span class=
"s2">Color
</span>.blue(alpha:
0.8));
</p>
392 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1.wait;
</p>
393 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.close;
</p>
394 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).play(
<span class=
"s2">AppClock
</span>);
</p>
395 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">)
</span></p>
396 <p class=
"p13"><br></p>
397 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>front
</b></p>
398 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
399 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Bring a document to the front.
</p>
400 <p class=
"p7"><br></p>
401 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.listener.front
</p>
402 <p class=
"p13"><br></p>
403 <p class=
"p13"><br></p>
404 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>unfocusedFront
</b></p>
405 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
406 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Bring a document to the forn without focusing it.
</p>
407 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
408 <p class=
"p14"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span>.listener.unfocusedFront
</p>
409 <p class=
"p7"><br></p>
410 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>onClose
</b></p>
411 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>onClose_(arg1)
</b></p>
412 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
413 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the action to be performed on closing the document.
</p>
414 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b>- An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a><span class=
"s2"> </span>.
</p>
415 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
416 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>endFrontAction
</b></p>
417 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>endFrontAction_(arg1)
</b></p>
418 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
419 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the action to be performed when the document becomes no longer the front document.
</p>
420 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b>- An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a><span class=
"s2"> .
</span></p>
421 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
422 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>toFrontAction
</b></p>
423 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>toFrontAction_(arg1)
</b></p>
424 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
425 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the action to be performed when the document become the front document.
</p>
426 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b>- An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a><span class=
"s2"> .
</span></p>
427 <p class=
"p20"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
428 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>mouseDownAction
</b></p>
429 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>mouseDownAction_(arg1)
</b></p>
430 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>mouseUpAction
</b></p>
431 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>mouseUpAction_(arg1)
</b></p>
432 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
433 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the action to be performed on mouseDown or mouseUp.
</p>
434 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>Note:
</b> The Mac OSX built-in editor supports only mouseUpAction. A mouseDownAction that you supply will be ignored.
</p>
435 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
436 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b>- An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a><span class=
"s2"> </span>The arguments passed to the function are.
</p>
437 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
438 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>x, y, modifiers, buttonNumber, clickCount, clickPos
</b></p>
439 <p class=
"p7"><br></p>
440 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
441 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
442 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//add a mouse action to this document:
</p>
443 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//example: easy button:
</p>
444 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//when you click in front of a
17 a SinOsc will start up;
</p>
445 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>s.waitForBoot({
<span class=
"Apple-tab-span"> </span></p>
446 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.mouseUpAction_({
<span class=
"s2">arg
</span> doc;
</p>
447 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> char;
</p>
448 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>char = doc.rangeText(doc.selectionStart,
2);
</p>
449 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if(char ==
<span class=
"s5">"17"</span>,{
</p>
450 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>{
<span class=
"s2">EnvGen
</span>.kr(
<span class=
"s2">Env
</span>.perc, doneAction:
2) *
<span class=
"s2">SinOsc
</span>.ar([
600,
720,
300].choose,
0,
0.5)}.play;
</p>
451 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
452 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if(char ==
<span class=
"s5">"23"</span>,{
</p>
453 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>{
<span class=
"s2">EnvGen
</span>.kr(
<span class=
"s2">Env
</span>.perc, doneAction:
2) *
<span class=
"s2">PinkNoise
</span>.ar(
0.2)}.play;
</p>
454 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
455 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>})
</p>
456 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
457 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
458 <p class=
"p21"><span class=
"s6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>test here and click in front of the number:
</p>
459 <p class=
"p21"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s13">17</span></p>
460 <p class=
"p22"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>23</p>
461 <p class=
"p14"><span class=
"s13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span>.current.mouseUpAction=
<span class=
"s2">nil
</span>;
<span class=
"s10">//clear mouseUpActiont
</span></p>
462 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
463 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keyDownAction
</b></p>
464 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keyDownAction_(arg1)
</b></p>
465 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keyUpAction
</b></p>
466 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keyUpAction_(arg1)
</b></p>
467 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
468 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Get / set the action to be performed on keyDown or keyUp.
</p>
469 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arg1
</b>- An instance of
<a href=
"../../Core/Kernel/Function.html"><span class=
"s2">Function
</span></a> or
<a href=
"../../Core/Kernel/FunctionList.html"><span class=
"s2">FunctionList
</span></a><span class=
"s2"> </span>The arguments passed to the function are
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
470 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>char, modifiers, unicode,keycode
</b></p>
471 <p class=
"p10"><br></p>
472 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.keyDownAction={
<span class=
"s2">arg
</span> ...args; args.postln};
</p>
473 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// now type some text
</p>
474 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.keyDownAction=
<span class=
"s2">nil
</span>;
</p>
475 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
476 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>makeWikiPage (wikiWord, extension, directory)
</b></p>
477 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
478 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Creates a wiki page .
</p>
479 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>wikiWord
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>. The name of the document.
</p>
480 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>extension
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>. The file extension. Default value is
".rtf".
</p>
481 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>directory
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>. The directory in which to save the page.
</p>
482 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
483 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.makeWikiPage(
<span class=
"s5">"test1"</span>);
</p>
484 <p class=
"p13"><br></p>
485 <p class=
"p13"><br></p>
486 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>openWikiPage
</b></p>
487 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
488 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Opens/creates a wiki page out of the currently selected text.
</p>
489 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
490 <p class=
"p5"><b>Editing Content
</b></p>
491 <p class=
"p6"><br></p>
492 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectLine (line)
</b></p>
493 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
494 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Select a line of the document by number.
</p>
495 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>line
</b>- An
<a href=
"../../Math/Integer.html"><span class=
"s2">Integer
</span></a>.
</p>
496 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
497 <p class=
"p23"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span>.current.selectLine(
390);
</p>
498 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
499 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectRange (start, length)
</b></p>
500 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
501 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Select a text range in the string of the document
</p>
502 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>start
</b>-The start index.
</p>
503 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>length
</b>- The length of the seleciton.
</p>
504 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
505 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
506 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.selectRange(
<span class=
"s2">Document
</span>.current.selectedRangeLocation+
3,
</p>
507 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>150);
</p>
508 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
509 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
510 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>balanceParens (level)
</b></p>
511 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
512 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Starting from the current selection, increase the selection
<span class=
"Apple-converted-space"> </span></p>
513 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>until matching parentheses are selected.
</p>
514 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>level
</b>- do this as many times to find ever wider brackets. Set to
<b>inf
</b> for outmost.
</p>
515 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
516 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>((((
</p>
517 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.balanceParens(
<span class=
"s2">1</span>);
</p>
518 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.balanceParens(
<span class=
"s2">3</span>);
</p>
519 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.balanceParens(
<span class=
"s2">inf
</span>);
</p>
520 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>))))
</p>
521 <p class=
"p13"><br></p>
522 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectionStart
</b></p>
523 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
524 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns the start of a current selection.
</p>
525 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
526 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.selectionStart.postln;
</p>
527 <p class=
"p13"><br></p>
528 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectionSize
</b></p>
529 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
530 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns the size of a current selection.
</p>
531 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
532 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
533 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> doc;
</p>
534 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc =
<span class=
"s2">Document
</span>.current;
</p>
535 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectRange(doc.selectionStart-
40,
10);
</p>
536 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectionSize.postln;
</p>
537 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
<span class=
"s8"><span class=
"Apple-tab-span"> </span></span></p>
538 <p class=
"p13"><br></p>
539 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedString_ (txt)
</b></p>
540 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedString
</b></p>
541 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
542 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets/sets the selected string.
</p>
543 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>txt
</b>- An instance of
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
544 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
545 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
546 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> doc;
</p>
547 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc =
<span class=
"s2">Document
</span>.current;
</p>
548 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectRange(doc.selectionStart-
40,
10);
</p>
549 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectedString.postln;
</p>
550 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
<span class=
"s8"><span class=
"Apple-tab-span"> </span></span></p>
551 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
552 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>currentLine
</b></p>
553 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
554 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns the current line as a
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
555 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
556 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
557 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> doc;
</p>
558 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc =
<span class=
"s2">Document
</span>.current;
</p>
559 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectRange(doc.selectionStart-
40,
10);
</p>
560 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.currentLine.postln;
</p>
561 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
562 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
563 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>getSelectedLines(rangestart, rangesize)
</b></p>
564 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
565 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns all full lines from before rangestart to after rangestart + rangesize as a
<a href=
"../../Collections/String.html"><span class=
"s2">String
</span></a>.
</p>
566 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
567 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
568 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> doc;
</p>
569 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc =
<span class=
"s2">Document
</span>.current;
</p>
570 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectRange(doc.selectionStart-
40,
10);
</p>
571 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.getSelectedLines(doc.selectionStart-
40,
130).postln;
</p>
572 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
573 <p class=
"p7"><br></p>
574 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>string (rangestart, rangesize)
</b></p>
575 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>string_ (string, rangestart, rangesize)
</b></p>
576 <p class=
"p7"><br></p>
577 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets/sets the string within a certain range.
</p>
578 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>string
</b>- Explanation of string. Default value is nil. Other information.
</p>
579 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rangestart
</b>- An integer. Default value is nil.
</p>
580 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rangesize
</b>- An integer. Default value is
1.
</p>
581 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
582 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Select the following code in parentheses and execute it
</p>
583 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
584 <p class=
"p11"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Document
</span><span class=
"s3">.current.string_(
</span>": test test test test test "<span class=
"s3">,
</span></p>
585 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.selectedRangeLocation+
12,
</p>
586 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>18);
</p>
587 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
588 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Watch me change content
</p>
589 <p class=
"p13"><span class=
"Apple-tab-span"> </span></p>
590 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>font_ (font, rangestart, rangesize)
</b></p>
591 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
592 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets/sets the font within a certain range.
</p>
593 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>font
</b>- An instance of
<a href=
"../Main-GUI/Font.html"><span class=
"s2">Font
</span></a>.
</p>
594 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rangestart
</b>- An integer. Default value is -
1. If rangestart = -
1, the whole document is selected.
</p>
595 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rangesize
</b>- An integer. Default value is
0.
</p>
596 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
597 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Select the following code in parentheses and execute it
</p>
598 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
599 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.font_(
<span class=
"s2">Font
</span>(
<span class=
"s5">"Impact"</span>,
14),
</p>
600 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.selectedRangeLocation+
12,
</p>
601 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>18);
</p>
602 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
603 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Watch me change font
</p>
604 <p class=
"p13"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
605 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>stringColor
</b></p>
606 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
607 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets the last color set with stringColor_.
</p>
608 <p class=
"p13"><br></p>
609 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>stringColor_ (color, rangeStart, rangeSize)
</b></p>
610 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
611 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Sets the string color of a specific range of already printed text. Default is the whole document.
</p>
612 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>To set the listener text color for posting, see:
<b>postColor
</b></p>
613 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of Color.
</p>
614 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rangeStart
</b>- An
<a href=
"../../Math/Integer.html"><span class=
"s2">Integer
</span></a>. Default is -
1.
</p>
615 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rangeSize
</b>- An
<a href=
"../../Math/Integer.html"><span class=
"s2">Integer
</span></a>. Default value is
0</p>
616 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
617 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Select the following code in parentheses and execute it
</p>
618 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
619 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.stringColor_(
<span class=
"s2">Color
</span>.rand(
0.2,
0.8),
</p>
620 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.selectedRangeLocation+
13,
</p>
621 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>16);
</p>
622 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
623 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//
</span><b>Watch me change color
</b></p>
624 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
625 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedBackground
</b></p>
626 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
627 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets the document's background color for selected text.
</p>
628 <p class=
"p13"><br></p>
629 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedBackground_ (color)
</b></p>
630 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
631 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Sets the document's background color for selected text.
</p>
632 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Applies to the whole document instance.
</p>
633 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of Color.
</p>
634 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
635 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Document
</span>.current.selectedBackground;
<span class=
"s10">//returns default color
</span></p>
636 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
637 <p class=
"p19"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
</span><span class=
"s2">Document
</span><span class=
"s3">.new(
</span>"Test"<span class=
"s3">,
</span>"Here is a selected text..."<span class=
"s3">);
</span></p>
638 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.selectedBackground_(
<span class=
"s2">Color
</span>.new255(
120,
180,
110));
</p>
639 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.selectRange(
10,
13);
</p>
640 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
641 <p class=
"p7"><br></p>
642 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>syntaxColorize
</b></p>
643 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
644 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Syntax colorize a document.
</p>
645 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
646 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>underlineSelection
</b></p>
647 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
648 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Underlines the current selection of a Document.
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
649 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
650 <p class=
"p24"><b>Auto-Completion
</b></p>
651 <p class=
"p8"><span class=
"s11"><span class=
"Apple-tab-span"> </span></span>OSX version only, currently. See
<a href=
"DocumentAutoCompletion.html"><span class=
"s14">DocumentAutoCompletion
</span></a></p>
652 <p class=
"p6"><br></p>
653 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*allowAutoComp
</b></p>
654 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*autoCompAll
</b></p>
655 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*autoComplete
</b></p>
656 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*autoCompleteKeyAction
</b></p>
657 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*openFileAutoComplete (path)
</b></p>
658 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*openAutoComplete
</b></p>
659 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>autoComplete
</b></p>
660 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
661 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
662 <p class=
"p24"><b>Subclassing and Internal Methods
</b></p>
663 <p class=
"p8"><span class=
"s11"><span class=
"Apple-tab-span"> </span></span>The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.
</p>
664 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
665 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*startup
</b></p>
666 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*numberOfOpen
</b></p>
667 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>mouseUp (x, y, modifiers, buttonNumber, clickCount, clickPos)
</b></p>
668 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keyDown (character, modifiers, unicode, keycode)
</b></p>
669 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keyUp (character, modifiers, unicode, keycode)
</b></p>
670 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>getIdentifierCoordFromEnd (endPos)
</b></p>
671 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>dataptr
</b></p>
672 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span></b></p>
673 <p class=
"p8"><span class=
"Apple-tab-span"> </span>Private. Used only internally:
</p>
674 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*newFromIndex (idx)
</b></p>
675 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*prnumberOfOpen
</b></p>
676 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*prGetLast
</b></p>
677 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*prGetIndexOfListener
</b></p>
678 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*prBasicNew
</b></p>
679 <p class=
"p8"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>prAdd
</b></p>
680 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prGetLastIndex
</b></p>
681 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>setFont (font, rangeStart, rangeSize)
</b></p>
682 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>setTextColor (color, rangeStart, rangeSize)
<span class=
"Apple-tab-span"> </span></b></p>
683 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>propen (path, selectionStart, selectionLength)
</b></p>
684 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>rangeText (rangestart, rangesize)
</b></p>
685 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>insertTextRange (string, rangestart, rangesize)
</b></p>
686 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prinitByString (title, str, makeListener)
</b></p>
687 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prSetBackgroundColor (color)
</b></p>
688 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prGetBackgroundColor (color)
</b></p>
689 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prSelectLine (line)
</b></p>
690 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prIsEditable_ (editable)
</b></p>
691 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prSetTitle (argName)
</b></p>
692 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prGetTitle
</b></p>
693 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prGetFileName
</b></p>
694 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prSetFileName (apath)
</b></p>
695 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prGetBounds (argBounds)
</b></p>
696 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prSetBounds (argBounds)
</b></p>
697 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prclose
</b></p>
698 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prinsertText (dataPtr, txt)
</b></p>
699 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>prinitByIndex (idx)
</b></p>
700 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>envir
</b></p>
701 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>envir_ (ev)
</b></p>
702 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>text
</b></p>
703 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>removeUndo
<span class=
"Apple-converted-space"> </span></b></p>
704 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedText
</b></p>
705 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectUnderlinedText (clickPos)
</b></p>
706 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>linkAtClickPos (clickPos)
</b></p>
707 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedRangeLocation
</b></p>
708 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>selectedRangeSize
</b></p>
709 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>restoreCurrentEnvironment
</b></p>
710 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>saveCurrentEnvironment
</b></p>
711 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>initByIndex (idx)
</b></p>
712 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>initLast
</b></p>
713 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>initFromPath (path, selectionStart, selectionLength)
</b></p>
714 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>initByString (argTitle, str, makeListener)
</b></p>
715 <p class=
"p13"><br></p>
716 <p class=
"p24"><b>Examples
</b></p>
717 <p class=
"p3"><br></p>
718 <p class=
"p25">//unfocusedFront_
</p>
720 <p class=
"p18"><span class=
"s2">Document
</span>.allDocuments.at(
0).unfocusedFront
</p>
722 <p class=
"p3"><br></p>
723 <p class=
"p3"><br></p>
725 <p class=
"p3"><br></p>
726 <p class=
"p18"><span class=
"s2">var
</span> doc;
</p>
727 <p class=
"p18">doc =
<span class=
"s2">Document
</span>(
<span class=
"s5">""</span>,
<span class=
"s5">"||"</span>);
</p>
728 <p class=
"p18">doc.background_(
<span class=
"s2">Color
</span>.blue(alpha:
1.0.rand));
</p>
729 <p class=
"p26">Task
<span class=
"s3">({
</span></p>
730 <p class=
"p18"><span class=
"Apple-tab-span"> </span>1000.do({
</p>
731 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.setFont(rangeSize: [
7,
8,
9,
24].choose);
</p>
732 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.08.wait;
</p>
733 <p class=
"p18"><span class=
"Apple-tab-span"> </span>})
</p>
734 <p class=
"p18">}).play(
<span class=
"s2">AppClock
</span>);
</p>
735 <p class=
"p26">Task
<span class=
"s3">({
</span></p>
736 <p class=
"p18"><span class=
"Apple-tab-span"> </span>100.do({
</p>
737 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1.01.wait;
</p>
738 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.stringColor_([
<span class=
"s2">Color
</span>.red(alpha:
1.0.rand),
<span class=
"s2">Color
</span>.green(alpha:
1.0.rand)].choose);
</p>
739 <p class=
"p18"><span class=
"Apple-tab-span"> </span>})
</p>
740 <p class=
"p18">}).play(
<span class=
"s2">AppClock
</span>);
</p>
741 <p class=
"p26">Task
<span class=
"s3">({
</span></p>
742 <p class=
"p18"><span class=
"Apple-tab-span"> </span>100.do({
</p>
743 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1.01.wait;
</p>
744 <p class=
"p18"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>doc.selectedString_([
<span class=
"s5">"\"\n#
"</span>,<span class="s5
">"||
"</span>,<span class="s5
">"-
"</span>, <span class="s5
">"--
"</span>].choose);</p>
745 <p class="p18
"><span class="Apple-tab-span
"> </span>})</p>
746 <p class="p18
">}).play(<span class="s2
">AppClock</span>);</p>
747 <p class="p26
">Task<span class="s3
">({</span></p>
748 <p class="p18
"><span class="Apple-tab-span
"> </span><span class="s2
">var</span> co, mul;</p>
749 <p class="p18
"><span class="Apple-tab-span
"> </span>co = 0.1;</p>
750 <p class="p18
"><span class="Apple-tab-span
"> </span>mul = 1.02;</p>
751 <p class="p18
"><span class="Apple-tab-span
"> </span>100.do({</p>
752 <p class="p18
"><span class="Apple-tab-span
"> </span><span class="Apple-tab-span
"> </span>0.16.wait;</p>
753 <p class="p18
"><span class="Apple-tab-span
"> </span><span class="Apple-tab-span
"> </span>co = co * mul;</p>
754 <p class="p18
"><span class="Apple-tab-span
"> </span><span class="Apple-tab-span
"> </span>if(co > 0.99, { co = 0.1 });</p>
755 <p class="p18
"><span class="Apple-tab-span
"> </span><span class="Apple-tab-span
"> </span>doc.background_(<span class="s2
">Color</span>.blue(alpha: co));</p>
756 <p class="p18
"><span class="Apple-tab-span
"> </span><span class="Apple-tab-span
"> </span>});</p>
757 <p class="p18
"><span class="Apple-tab-span
"> </span>doc.close;</p>
758 <p class="p18
">}).play(<span class="s2
">AppClock</span>)</p>
759 <p class="p3
"><br></p>
761 <p class="p3
"><br></p>
762 <p class="p3
"><br></p>
763 <p class="p3
"><br></p>
764 <p class="p25
">// a simple implementation of TBT (time based text)</p>
765 <p class="p25
">// http://tbt.dyne.org/?info=download</p>
766 <p class="p3
"><br></p>
767 <p class="p25
">// record: type some text</p>
769 <p class="p18
"><span class="s2
">var</span> time = <span class="s2
">Main</span>.elapsedTime;</p>
770 <p class="p18
">a = <span class="s2
">List</span>.new;</p>
771 <p class="p26
"><span class="s3
">r = </span>Routine<span class="s3
"> { </span>|char|</p>
772 <p class="p18
">loop {</p>
773 <p class="p18
">a = a.add([char, <span class="s2
">Main</span>.elapsedTime - time]);</p>
774 <p class="p18
">char = 0.yield;</p>
776 <p class="p18
">};</p>
777 <p class="p3
"><br></p>
778 <p class="p19
"><span class="s2
">Document</span><span class="s3
">.new(</span>"type some text
"<span class="s3
">)</span></p>
779 <p class="p18
"><span class="Apple-tab-span
"> </span>.bounds_(<span class="s2
">Rect</span>(100,<span class="s2
">SCWindow</span>.screenBounds.height-250,400,200))</p>
780 <p class="p18
"><span class="Apple-tab-span
"> </span>.keyDownAction = { <span class="s2
">|doc, key|</span> r.value(key) ; time=<span class="s2
">Main</span>.elapsedTime};</p>
782 <p class="p3
"><br></p>
783 <p class="p25
">// play back text in time</p>
785 <p class="p19
"><span class="s3
">d=</span><span class="s2
">Document</span><span class="s3
">.new(</span>"type some text
"<span class="s3
">)</span></p>
786 <p class="p18
"><span class="Apple-tab-span
"> </span>.bounds_(<span class="s2
">Rect</span>(550,<span class="s2
">SCWindow</span>.screenBounds.height-250,400,200));</p>
787 <p class="p18
">fork({</p>
788 <p class="p18
">a.do { <span class="s2
">|pair|</span></p>
789 <p class="p18
">d.string = d.string ++ pair[0];</p>
790 <p class="p18
">pair[1].wait;</p>
792 <p class="p26
"><span class="s3
">}, </span>AppClock<span class="s3
">)</span></p>
794 <p class="p3
"><br></p>