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