author | Claus Gittinger <cg@exept.de> |
Thu, 04 Dec 2014 03:00:43 +0100 | |
changeset 14987 | 7a8543ad91ee |
parent 14926 | 240ebc7f8f87 |
child 14994 | 19512695e936 |
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 |
|
14987
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
208 |
annotations |
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
209 |
"return my annotations - if any" |
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
210 |
|
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
211 |
^ nil |
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
212 |
! |
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
213 |
|
10414 | 214 |
application |
215 |
||
216 |
^codeView application |
|
217 |
||
218 |
"Created: / 27-07-2011 / 12:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
219 |
! |
|
220 |
||
9983 | 221 |
enabled |
222 |
^ enabled |
|
223 |
! |
|
224 |
||
225 |
enabled:aBoolean |
|
14926
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
226 |
enabled ~~ aBoolean ifTrue:[ |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
227 |
enabled := aBoolean. |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
228 |
aBoolean ifTrue:[ |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
229 |
codeView notNil ifTrue:[ |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
230 |
self registerIn: codeView. |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
231 |
]. |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
232 |
] ifFalse:[ |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
233 |
self unregister. |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
234 |
]. |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
235 |
]. |
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
236 |
|
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
237 |
"Modified: / 27-11-2014 / 15:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9983 | 238 |
! |
239 |
||
240 |
label |
|
241 |
||
242 |
^self class label |
|
243 |
||
244 |
"Created: / 07-03-2010 / 14:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10498 | 245 |
! |
246 |
||
247 |
service: serviceClassName |
|
248 |
||
249 |
^codeView services detect:[:service|service class name == serviceClassName] ifNone:[nil] |
|
250 |
||
251 |
"Created: / 05-08-2011 / 11:48:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
252 |
! |
|
253 |
||
254 |
syntaxHighlighter |
|
255 |
||
256 |
"Returns a syntax highligter class or nil. The highlighting |
|
257 |
process gather all syntaxHighlighterClasses from all services |
|
258 |
and then use them one by one to highlight the text. Individual |
|
259 |
services may override this method to provide additional |
|
260 |
highliging of the source code" |
|
261 |
||
262 |
^nil |
|
263 |
||
264 |
"Created: / 05-08-2011 / 10:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9983 | 265 |
! ! |
266 |
||
267 |
!CodeViewService methodsFor:'change & update'! |
|
268 |
||
269 |
update: aspect with: param from: sender |
|
270 |
||
271 |
"Get updated whenever something changes in the code view. |
|
272 |
Subclasses may override this" |
|
273 |
||
274 |
"Intentionally left blank here" |
|
275 |
||
276 |
"Created: / 06-03-2010 / 19:23:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
277 |
! ! |
|
278 |
||
279 |
!CodeViewService methodsFor:'event handling'! |
|
280 |
||
281 |
buttonMotion: button x:x y:y in: view |
|
282 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 283 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 284 |
by the view." |
285 |
||
286 |
^false |
|
287 |
||
288 |
"Created: / 06-03-2010 / 20:17:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
289 |
"Modified: / 17-06-2011 / 13:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 290 |
"Modified (comment): / 18-08-2011 / 15:57:40 / cg" |
9983 | 291 |
! |
292 |
||
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
293 |
buttonMultiPress: button x:x y:y in: view |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
294 |
"Handles an event in given view (a subview of codeView). |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
295 |
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
|
296 |
by the view." |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
297 |
|
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
298 |
^false |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
299 |
! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
300 |
|
9983 | 301 |
buttonPress: button x:x y:y in: view |
302 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 303 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 304 |
by the view." |
305 |
||
306 |
^false |
|
307 |
||
308 |
"Created: / 06-03-2010 / 20:36:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
309 |
"Modified: / 17-06-2011 / 13:06:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 310 |
"Modified (comment): / 18-08-2011 / 15:57:36 / cg" |
9983 | 311 |
! |
312 |
||
12861
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
313 |
buttonRelease: button x:x y:y in: view |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
314 |
"Handles an event in given view (a subview of codeView). |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
315 |
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
|
316 |
by the view." |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
317 |
|
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
318 |
^false |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
319 |
! |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
320 |
|
9983 | 321 |
keyPress:key x:x y:y in: view |
322 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 323 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 324 |
by the view." |
325 |
||
326 |
^false |
|
327 |
||
328 |
"Created: / 06-03-2010 / 20:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
329 |
"Modified: / 17-06-2011 / 13:06:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 330 |
"Modified (comment): / 18-08-2011 / 15:57:28 / cg" |
9983 | 331 |
! |
332 |
||
333 |
keyRelease: key x: x y: y in: view |
|
334 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 335 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 336 |
by the view." |
337 |
||
338 |
^false |
|
339 |
||
340 |
"Created: / 06-03-2010 / 20:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
341 |
"Modified: / 17-06-2011 / 13:06:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 342 |
"Modified (comment): / 18-08-2011 / 15:57:33 / cg" |
10227 | 343 |
! |
344 |
||
345 |
linesDeletedFrom: start to: end |
|
346 |
||
347 |
"Created: / 06-07-2011 / 17:14:23 / jv" |
|
348 |
! |
|
349 |
||
350 |
linesInsertedFrom: start to: end |
|
351 |
||
352 |
"Created: / 06-07-2011 / 17:14:31 / jv" |
|
353 |
! |
|
354 |
||
355 |
linesModifiedFrom: start to: end |
|
356 |
||
357 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
11182
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
358 |
! |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
359 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
360 |
viewRealized |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
361 |
"Sent when a code view has been realized. May be overriden |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
362 |
by subclasses" |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
363 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
364 |
"Created: / 23-01-2012 / 10:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9983 | 365 |
! ! |
366 |
||
14842
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
367 |
!CodeViewService methodsFor:'help'! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
368 |
|
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
369 |
flyByHelpTextAtLine:aLineNr |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
370 |
^ nil |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
371 |
! ! |
cbd8fde601b7
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13825
diff
changeset
|
372 |
|
9983 | 373 |
!CodeViewService methodsFor:'initialization'! |
374 |
||
375 |
initialize |
|
376 |
"Invoked when a new instance is created." |
|
377 |
||
378 |
||
379 |
"/ please change as required (and remove this comment) |
|
380 |
"/ enabled := nil. |
|
381 |
"/ codeView := nil. |
|
382 |
"/ textView := nil. |
|
383 |
||
384 |
super initialize. |
|
385 |
||
386 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
387 |
! ! |
|
388 |
||
11172 | 389 |
!CodeViewService methodsFor:'misc'! |
390 |
||
12993
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
391 |
highlightInstanceVariable:name |
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
392 |
! |
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
393 |
|
11172 | 394 |
showInfo: aString |
395 |
||
396 |
codeView showInfo: aString |
|
397 |
||
398 |
"Created: / 06-03-2010 / 19:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
399 |
"Created: / 21-01-2012 / 12:44:22 / cg" |
|
400 |
! ! |
|
401 |
||
9983 | 402 |
!CodeViewService methodsFor:'redrawing'! |
403 |
||
13556
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
404 |
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
|
405 |
|dy dx| |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
406 |
|
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
407 |
dx := ((w - icon width) / 2) rounded. |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
408 |
dy := ((h - icon height) / 2) rounded. |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
409 |
icon |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
410 |
displayOn:gutterView |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
411 |
x:x + dx |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
412 |
y:y - h + dy + 4. |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
413 |
|
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
414 |
"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
|
415 |
! |
54e1ef230e31
class: Tools::CodeViewService
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13515
diff
changeset
|
416 |
|
9983 | 417 |
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
418 |
||
419 |
"Called by both gutterView and textView (well, not yet) to |
|
420 |
allow services to draw custom things on text view. |
|
421 |
Ask JV what the args means if unsure (I'm lazy to document |
|
422 |
them, now it is just an experiment...)" |
|
423 |
||
424 |
"Intentionally left blank, to be overriden by subclasses" |
|
425 |
||
426 |
"Created: / 17-06-2011 / 13:49:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
427 |
! ! |
|
428 |
||
429 |
!CodeViewService methodsFor:'registering'! |
|
430 |
||
431 |
registerIn: aCodeView |
|
432 |
||
433 |
"Installs myself in aCodeView" |
|
434 |
||
435 |
codeView := aCodeView. |
|
436 |
codeView addDependent: self. |
|
437 |
textView := aCodeView textView. |
|
438 |
gutterView := aCodeView gutterView. |
|
439 |
enabled := true. |
|
440 |
||
441 |
"Created: / 06-03-2010 / 19:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
442 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
443 |
! |
|
444 |
||
445 |
unregister |
|
446 |
||
447 |
"Uninstall myself from my codeView" |
|
448 |
||
449 |
codeView removeDependent: self. |
|
14926
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
450 |
"/ Do not nil out a codeView, required for enable/disable functionality |
9983 | 451 |
textView := nil. |
14926
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
452 |
gutterView := nil. |
9983 | 453 |
|
454 |
"Created: / 06-03-2010 / 19:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14926
240ebc7f8f87
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14842
diff
changeset
|
455 |
"Modified (comment): / 27-11-2014 / 15:42:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9983 | 456 |
! ! |
457 |
||
458 |
!CodeViewService methodsFor:'testing'! |
|
459 |
||
12900
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
460 |
isBreakpointService |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
461 |
^ false |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
462 |
! |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
463 |
|
9983 | 464 |
isEnabled |
465 |
||
466 |
^enabled == true |
|
467 |
||
468 |
"Created: / 07-03-2010 / 13:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
469 |
! ! |
|
470 |
||
471 |
!CodeViewService class methodsFor:'documentation'! |
|
472 |
||
473 |
version_CVS |
|
14987
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
474 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeViewService.st,v 1.19 2014-12-04 02:00:43 cg Exp $' |
9983 | 475 |
! |
476 |
||
477 |
version_SVN |
|
14987
7a8543ad91ee
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
14926
diff
changeset
|
478 |
^ '$Id: Tools__CodeViewService.st,v 1.19 2014-12-04 02:00:43 cg Exp $' |
9983 | 479 |
! ! |
12861
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
480 |