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