author | Claus Gittinger <cg@exept.de> |
Wed, 19 Nov 2014 18:43:00 +0100 | |
changeset 14842 | cbd8fde601b7 |
parent 13825 | 981dd341f7cb |
child 14926 | 240ebc7f8f87 |
permissions | -rw-r--r-- |
9983 | 1 |
" |
10070 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
3 |
All Rights Reserved |
|
9983 | 4 |
|
10070 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9983 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
Object subclass:#CodeViewService |
|
31 |
instanceVariableNames:'enabled codeView textView gutterView' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-CodeView' |
|
35 |
! |
|
36 |
||
37 |
!CodeViewService class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
10070 | 41 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
42 |
All Rights Reserved |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
9983 | 52 |
|
10070 | 53 |
The above copyright notice and this permission notice shall be |
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9983 | 64 |
" |
11182
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
65 |
! |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
66 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
67 |
documentation |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
68 |
" |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
69 |
A base class for CodeView2 services. A 'service' is an extension |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
70 |
mechanism for CodeView2. Once plugged in, service gets informed |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
71 |
about changes in the text and it also may intercept events. |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
72 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
73 |
See concrete subclasses how to use and implement code services. |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
74 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
75 |
[author:] |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
76 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
77 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
78 |
[instance variables:] |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
79 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
80 |
[class variables:] |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
81 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
82 |
[see also:] |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
83 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
84 |
" |
9983 | 85 |
! ! |
86 |
||
87 |
!CodeViewService class methodsFor:'instance creation'! |
|
88 |
||
89 |
new |
|
90 |
"return an initialized instance" |
|
91 |
||
92 |
^ self basicNew initialize. |
|
93 |
! ! |
|
94 |
||
95 |
!CodeViewService class methodsFor:'accessing'! |
|
96 |
||
97 |
availableServices |
|
98 |
||
99 |
^self allSubclasses select: |
|
10414 | 100 |
[:cls|cls isAbstract not and:[cls allRequiredServicesAvailable and:[cls isAvailable]]]. |
9983 | 101 |
|
102 |
" |
|
103 |
Tools::CodeViewService availableServices |
|
104 |
" |
|
105 |
||
106 |
"Created: / 07-03-2010 / 13:42:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10414 | 107 |
"Modified: / 27-07-2011 / 11:49:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9983 | 108 |
! |
109 |
||
110 |
label |
|
13104
97e40a3e9c0c
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12993
diff
changeset
|
111 |
"Answers a short label - for UI" |
9983 | 112 |
|
13104
97e40a3e9c0c
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12993
diff
changeset
|
113 |
^self nameWithoutPrefix |
9983 | 114 |
|
115 |
"Created: / 07-03-2010 / 13:58:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10414 | 116 |
! |
117 |
||
13825 | 118 |
priority |
119 |
"Answers a priority of the service. Services with higher priority |
|
120 |
will get the event notification before ones with lower priority. |
|
121 |
Therefore, a lower-priority service might not get the event if high |
|
122 |
priority service processes it" |
|
123 |
||
124 |
^ 5 |
|
125 |
||
126 |
"Created: / 01-02-2012 / 10:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
127 |
! |
|
128 |
||
10414 | 129 |
requiredServices |
130 |
||
131 |
"Returns a list of services required for myself to work |
|
132 |
correctly. A list should contain class names of the services |
|
133 |
(as not all services may be loaded in)" |
|
134 |
||
135 |
^#() |
|
136 |
||
137 |
"Created: / 27-07-2011 / 11:39:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
138 |
! ! |
|
139 |
||
140 |
!CodeViewService class methodsFor:'queries'! |
|
141 |
||
142 |
allRequiredServicesAvailable |
|
143 |
||
144 |
| cls | |
|
145 |
||
13515
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
146 |
^self requiredServices |
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
147 |
allSatisfy:[:clsName| |
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
148 |
cls := Smalltalk at: clsName. |
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
149 |
cls notNil and:[cls allRequiredServicesAvailable and:[cls isAvailable]] |
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
150 |
]. |
10414 | 151 |
|
152 |
"Created: / 27-07-2011 / 11:49:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13205 | 153 |
! |
154 |
||
155 |
isUsefulFor:aCodeView |
|
156 |
"this filters useful services. |
|
157 |
must be redefined to return true in subclasses (but each class must do it only |
|
158 |
for itself - not for subclasses" |
|
159 |
||
160 |
^ false |
|
161 |
||
162 |
"Created: / 22-07-2013 / 13:58:49 / cg" |
|
9983 | 163 |
! ! |
164 |
||
165 |
!CodeViewService class methodsFor:'registering'! |
|
166 |
||
167 |
registerIn: aCodeView |
|
168 |
||
169 |
^self new |
|
170 |
registerIn: aCodeView; |
|
171 |
yourself. |
|
172 |
||
173 |
"Created: / 07-03-2010 / 13:50:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
174 |
! ! |
|
175 |
||
176 |
!CodeViewService class methodsFor:'testing'! |
|
177 |
||
178 |
isAbstract |
|
179 |
||
180 |
^self == Tools::CodeViewService |
|
181 |
||
182 |
"Created: / 07-03-2010 / 13:41:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
183 |
! |
|
184 |
||
185 |
isAvailable |
|
186 |
||
187 |
^true |
|
188 |
||
189 |
"Created: / 03-04-2011 / 23:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10414 | 190 |
! |
191 |
||
192 |
isAvailableFor: applicationClass |
|
193 |
||
194 |
"Returns true if given service may be used in |
|
195 |
given application class." |
|
196 |
||
197 |
^true |
|
198 |
||
199 |
"Created: / 27-07-2011 / 11:45:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9983 | 200 |
! ! |
201 |
||
202 |
!CodeViewService methodsFor:'accessing'! |
|
203 |
||
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
204 |
annotationAtLine:lineNr |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
205 |
^ nil |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
206 |
! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
207 |
|
10414 | 208 |
application |
209 |
||
210 |
^codeView application |
|
211 |
||
212 |
"Created: / 27-07-2011 / 12:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
213 |
! |
|
214 |
||
9983 | 215 |
enabled |
216 |
^ enabled |
|
217 |
! |
|
218 |
||
219 |
enabled:aBoolean |
|
220 |
enabled := aBoolean. |
|
221 |
! |
|
222 |
||
223 |
label |
|
224 |
||
225 |
^self class label |
|
226 |
||
227 |
"Created: / 07-03-2010 / 14:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10498 | 228 |
! |
229 |
||
230 |
service: serviceClassName |
|
231 |
||
232 |
^codeView services detect:[:service|service class name == serviceClassName] ifNone:[nil] |
|
233 |
||
234 |
"Created: / 05-08-2011 / 11:48:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
235 |
! |
|
236 |
||
237 |
syntaxHighlighter |
|
238 |
||
239 |
"Returns a syntax highligter class or nil. The highlighting |
|
240 |
process gather all syntaxHighlighterClasses from all services |
|
241 |
and then use them one by one to highlight the text. Individual |
|
242 |
services may override this method to provide additional |
|
243 |
highliging of the source code" |
|
244 |
||
245 |
^nil |
|
246 |
||
247 |
"Created: / 05-08-2011 / 10:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9983 | 248 |
! ! |
249 |
||
250 |
!CodeViewService methodsFor:'change & update'! |
|
251 |
||
252 |
update: aspect with: param from: sender |
|
253 |
||
254 |
"Get updated whenever something changes in the code view. |
|
255 |
Subclasses may override this" |
|
256 |
||
257 |
"Intentionally left blank here" |
|
258 |
||
259 |
"Created: / 06-03-2010 / 19:23:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
260 |
! ! |
|
261 |
||
262 |
!CodeViewService methodsFor:'event handling'! |
|
263 |
||
264 |
buttonMotion: button x:x y:y in: view |
|
265 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 266 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 267 |
by the view." |
268 |
||
269 |
^false |
|
270 |
||
271 |
"Created: / 06-03-2010 / 20:17:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
272 |
"Modified: / 17-06-2011 / 13:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 273 |
"Modified (comment): / 18-08-2011 / 15:57:40 / cg" |
9983 | 274 |
! |
275 |
||
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
276 |
buttonMultiPress: button x:x y:y in: view |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
277 |
"Handles an event in given view (a subview of codeView). |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
278 |
If the method returns true, it has eaten the event and it will not be processed |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
279 |
by the view." |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
280 |
|
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
281 |
^false |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
282 |
! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
283 |
|
9983 | 284 |
buttonPress: button x:x y:y in: view |
285 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 286 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 287 |
by the view." |
288 |
||
289 |
^false |
|
290 |
||
291 |
"Created: / 06-03-2010 / 20:36:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
292 |
"Modified: / 17-06-2011 / 13:06:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 293 |
"Modified (comment): / 18-08-2011 / 15:57:36 / cg" |
9983 | 294 |
! |
295 |
||
12861
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
296 |
buttonRelease: button x:x y:y in: view |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
297 |
"Handles an event in given view (a subview of codeView). |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
298 |
If the method returns true, it has eaten the event and it will not be processed |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
299 |
by the view." |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
300 |
|
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
301 |
^false |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
302 |
! |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
303 |
|
9983 | 304 |
keyPress:key x:x y:y in: view |
305 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 306 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 307 |
by the view." |
308 |
||
309 |
^false |
|
310 |
||
311 |
"Created: / 06-03-2010 / 20:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
"Modified: / 17-06-2011 / 13:06:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 313 |
"Modified (comment): / 18-08-2011 / 15:57:28 / cg" |
9983 | 314 |
! |
315 |
||
316 |
keyRelease: key x: x y: y in: view |
|
317 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 318 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 319 |
by the view." |
320 |
||
321 |
^false |
|
322 |
||
323 |
"Created: / 06-03-2010 / 20:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
"Modified: / 17-06-2011 / 13:06:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 325 |
"Modified (comment): / 18-08-2011 / 15:57:33 / cg" |
10227 | 326 |
! |
327 |
||
328 |
linesDeletedFrom: start to: end |
|
329 |
||
330 |
"Created: / 06-07-2011 / 17:14:23 / jv" |
|
331 |
! |
|
332 |
||
333 |
linesInsertedFrom: start to: end |
|
334 |
||
335 |
"Created: / 06-07-2011 / 17:14:31 / jv" |
|
336 |
! |
|
337 |
||
338 |
linesModifiedFrom: start to: end |
|
339 |
||
340 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
11182
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
341 |
! |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
342 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
343 |
viewRealized |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
344 |
"Sent when a code view has been realized. May be overriden |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
345 |
by subclasses" |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
346 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
347 |
"Created: / 23-01-2012 / 10:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9983 | 348 |
! ! |
349 |
||
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
350 |
!CodeViewService methodsFor:'help'! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
351 |
|
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
352 |
flyByHelpTextAtLine:aLineNr |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
353 |
^ nil |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
354 |
! ! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
355 |
|
9983 | 356 |
!CodeViewService methodsFor:'initialization'! |
357 |
||
358 |
initialize |
|
359 |
"Invoked when a new instance is created." |
|
360 |
||
361 |
||
362 |
"/ please change as required (and remove this comment) |
|
363 |
"/ enabled := nil. |
|
364 |
"/ codeView := nil. |
|
365 |
"/ textView := nil. |
|
366 |
||
367 |
super initialize. |
|
368 |
||
369 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
370 |
! ! |
|
371 |
||
11172 | 372 |
!CodeViewService methodsFor:'misc'! |
373 |
||
12993
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
374 |
highlightInstanceVariable:name |
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
375 |
! |
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
376 |
|
11172 | 377 |
showInfo: aString |
378 |
||
379 |
codeView showInfo: aString |
|
380 |
||
381 |
"Created: / 06-03-2010 / 19:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
382 |
"Created: / 21-01-2012 / 12:44:22 / cg" |
|
383 |
! ! |
|
384 |
||
9983 | 385 |
!CodeViewService methodsFor:'redrawing'! |
386 |
||
13556
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
387 |
drawAnnotationIcon:icon atX:x y:y width:w height:h |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
388 |
|dy dx| |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
389 |
|
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
390 |
dx := ((w - icon width) / 2) rounded. |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
391 |
dy := ((h - icon height) / 2) rounded. |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
392 |
icon |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
393 |
displayOn:gutterView |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
394 |
x:x + dx |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
395 |
y:y - h + dy + 4. |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
396 |
|
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
397 |
"Created: / 17-09-2013 / 15:40:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
398 |
! |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
399 |
|
9983 | 400 |
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
401 |
||
402 |
"Called by both gutterView and textView (well, not yet) to |
|
403 |
allow services to draw custom things on text view. |
|
404 |
Ask JV what the args means if unsure (I'm lazy to document |
|
405 |
them, now it is just an experiment...)" |
|
406 |
||
407 |
"Intentionally left blank, to be overriden by subclasses" |
|
408 |
||
409 |
"Created: / 17-06-2011 / 13:49:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
410 |
! ! |
|
411 |
||
412 |
!CodeViewService methodsFor:'registering'! |
|
413 |
||
414 |
registerIn: aCodeView |
|
415 |
||
416 |
"Installs myself in aCodeView" |
|
417 |
||
418 |
codeView := aCodeView. |
|
419 |
codeView addDependent: self. |
|
420 |
textView := aCodeView textView. |
|
421 |
gutterView := aCodeView gutterView. |
|
422 |
enabled := true. |
|
423 |
||
424 |
"Created: / 06-03-2010 / 19:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
425 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
426 |
! |
|
427 |
||
428 |
unregister |
|
429 |
||
430 |
"Uninstall myself from my codeView" |
|
431 |
||
432 |
codeView removeDependent: self. |
|
433 |
codeView := nil. |
|
434 |
textView := nil. |
|
435 |
||
436 |
"Created: / 06-03-2010 / 19:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
437 |
"Modified: / 17-06-2011 / 12:57:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
438 |
! ! |
|
439 |
||
440 |
!CodeViewService methodsFor:'testing'! |
|
441 |
||
12900
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
442 |
isBreakpointService |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
443 |
^ false |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
444 |
! |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
445 |
|
9983 | 446 |
isEnabled |
447 |
||
448 |
^enabled == true |
|
449 |
||
450 |
"Created: / 07-03-2010 / 13:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
451 |
! ! |
|
452 |
||
453 |
!CodeViewService class methodsFor:'documentation'! |
|
454 |
||
455 |
version_CVS |
|
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
456 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeViewService.st,v 1.17 2014-11-19 17:43:00 cg Exp $' |
9983 | 457 |
! |
458 |
||
459 |
version_SVN |
|
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
460 |
^ '$Id: Tools__CodeViewService.st,v 1.17 2014-11-19 17:43:00 cg Exp $' |
9983 | 461 |
! ! |
12861
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
462 |