author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 06 Sep 2013 15:49:08 +0100 | |
branch | jv |
changeset 13530 | 2269bce1636d |
parent 13250 | 0decde6c459d |
parent 13515 | d0cc1ab55768 |
child 13609 | 8b400fde34ef |
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 |
||
12134
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
118 |
priority |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
119 |
"Answers a priority of the service. Services with higher priority |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
120 |
will get the event notification before ones with lower priority. |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
121 |
Therefore, a lower-priority service might not get the event if high |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
122 |
priority service processes it" |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
123 |
|
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
124 |
^ 5 |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
125 |
|
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
126 |
"Created: / 01-02-2012 / 10:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
127 |
! |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
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 |
||
10414 | 204 |
application |
205 |
||
206 |
^codeView application |
|
207 |
||
208 |
"Created: / 27-07-2011 / 12:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
209 |
! |
|
210 |
||
9983 | 211 |
enabled |
212 |
^ enabled |
|
213 |
! |
|
214 |
||
215 |
enabled:aBoolean |
|
216 |
enabled := aBoolean. |
|
217 |
! |
|
218 |
||
219 |
label |
|
220 |
||
221 |
^self class label |
|
222 |
||
223 |
"Created: / 07-03-2010 / 14:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10498 | 224 |
! |
225 |
||
226 |
service: serviceClassName |
|
227 |
||
228 |
^codeView services detect:[:service|service class name == serviceClassName] ifNone:[nil] |
|
229 |
||
230 |
"Created: / 05-08-2011 / 11:48:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
231 |
! |
|
232 |
||
233 |
syntaxHighlighter |
|
234 |
||
235 |
"Returns a syntax highligter class or nil. The highlighting |
|
236 |
process gather all syntaxHighlighterClasses from all services |
|
237 |
and then use them one by one to highlight the text. Individual |
|
238 |
services may override this method to provide additional |
|
239 |
highliging of the source code" |
|
240 |
||
241 |
^nil |
|
242 |
||
243 |
"Created: / 05-08-2011 / 10:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9983 | 244 |
! ! |
245 |
||
246 |
!CodeViewService methodsFor:'change & update'! |
|
247 |
||
248 |
update: aspect with: param from: sender |
|
249 |
||
250 |
"Get updated whenever something changes in the code view. |
|
251 |
Subclasses may override this" |
|
252 |
||
253 |
"Intentionally left blank here" |
|
254 |
||
255 |
"Created: / 06-03-2010 / 19:23:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
256 |
! ! |
|
257 |
||
258 |
!CodeViewService methodsFor:'event handling'! |
|
259 |
||
260 |
buttonMotion: button x:x y:y in: view |
|
261 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 262 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 263 |
by the view." |
264 |
||
265 |
^false |
|
266 |
||
267 |
"Created: / 06-03-2010 / 20:17:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
268 |
"Modified: / 17-06-2011 / 13:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 269 |
"Modified (comment): / 18-08-2011 / 15:57:40 / cg" |
9983 | 270 |
! |
271 |
||
272 |
buttonPress: button x:x y:y in: view |
|
273 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 274 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 275 |
by the view." |
276 |
||
277 |
^false |
|
278 |
||
279 |
"Created: / 06-03-2010 / 20:36:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
280 |
"Modified: / 17-06-2011 / 13:06:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 281 |
"Modified (comment): / 18-08-2011 / 15:57:36 / cg" |
9983 | 282 |
! |
283 |
||
12861
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
284 |
buttonRelease: button x:x y:y in: view |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
285 |
"Handles an event in given view (a subview of codeView). |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
286 |
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
|
287 |
by the view." |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
288 |
|
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
289 |
^false |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
290 |
! |
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
291 |
|
9983 | 292 |
keyPress:key x:x y:y in: view |
293 |
"Handles an event in given view (a subview of codeView). |
|
10589 | 294 |
If the method returns true, it has eaten the event and it will not be processed |
9983 | 295 |
by the view." |
296 |
||
297 |
^false |
|
298 |
||
299 |
"Created: / 06-03-2010 / 20:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
300 |
"Modified: / 17-06-2011 / 13:06:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 301 |
"Modified (comment): / 18-08-2011 / 15:57:28 / cg" |
9983 | 302 |
! |
303 |
||
304 |
keyRelease: 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:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
"Modified: / 17-06-2011 / 13:06:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10589 | 313 |
"Modified (comment): / 18-08-2011 / 15:57:33 / cg" |
10227 | 314 |
! |
315 |
||
316 |
linesDeletedFrom: start to: end |
|
317 |
||
318 |
"Created: / 06-07-2011 / 17:14:23 / jv" |
|
319 |
! |
|
320 |
||
321 |
linesInsertedFrom: start to: end |
|
322 |
||
323 |
"Created: / 06-07-2011 / 17:14:31 / jv" |
|
324 |
! |
|
325 |
||
326 |
linesModifiedFrom: start to: end |
|
327 |
||
328 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
11182
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
329 |
! |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
330 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
331 |
viewRealized |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
332 |
"Sent when a code view has been realized. May be overriden |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
333 |
by subclasses" |
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
334 |
|
90f2879a3926
CodeView2 service refactoring: CodeHighlightingService's background
vrany
parents:
11172
diff
changeset
|
335 |
"Created: / 23-01-2012 / 10:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9983 | 336 |
! ! |
337 |
||
338 |
!CodeViewService methodsFor:'initialization'! |
|
339 |
||
340 |
initialize |
|
341 |
"Invoked when a new instance is created." |
|
342 |
||
343 |
||
344 |
"/ please change as required (and remove this comment) |
|
345 |
"/ enabled := nil. |
|
346 |
"/ codeView := nil. |
|
347 |
"/ textView := nil. |
|
348 |
||
349 |
super initialize. |
|
350 |
||
351 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
352 |
! ! |
|
353 |
||
11172 | 354 |
!CodeViewService methodsFor:'misc'! |
355 |
||
12993
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
356 |
highlightInstanceVariable:name |
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
357 |
! |
2c8d85c82743
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12900
diff
changeset
|
358 |
|
11172 | 359 |
showInfo: aString |
360 |
||
361 |
codeView showInfo: aString |
|
362 |
||
363 |
"Created: / 06-03-2010 / 19:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
364 |
"Created: / 21-01-2012 / 12:44:22 / cg" |
|
365 |
! ! |
|
366 |
||
9983 | 367 |
!CodeViewService methodsFor:'redrawing'! |
368 |
||
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
369 |
drawAnnotationIcon:icon atX:x y:y width:w height:h |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
370 |
|dy dx| |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
371 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
372 |
dx := ((w - icon width) / 2) rounded. |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
373 |
dy := ((h - icon height) / 2) rounded. |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
374 |
icon |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
375 |
displayOn:gutterView |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
376 |
x:x + dx |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
377 |
y:y - h + dy + 4. |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
378 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
379 |
"Modified: / 30-01-2012 / 16:01:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
380 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
381 |
|
9983 | 382 |
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
383 |
||
384 |
"Called by both gutterView and textView (well, not yet) to |
|
385 |
allow services to draw custom things on text view. |
|
386 |
Ask JV what the args means if unsure (I'm lazy to document |
|
387 |
them, now it is just an experiment...)" |
|
388 |
||
389 |
"Intentionally left blank, to be overriden by subclasses" |
|
390 |
||
391 |
"Created: / 17-06-2011 / 13:49:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
392 |
! ! |
|
393 |
||
394 |
!CodeViewService methodsFor:'registering'! |
|
395 |
||
396 |
registerIn: aCodeView |
|
397 |
||
398 |
"Installs myself in aCodeView" |
|
399 |
||
400 |
codeView := aCodeView. |
|
401 |
codeView addDependent: self. |
|
402 |
textView := aCodeView textView. |
|
403 |
gutterView := aCodeView gutterView. |
|
404 |
enabled := true. |
|
405 |
||
406 |
"Created: / 06-03-2010 / 19:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
407 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
408 |
! |
|
409 |
||
410 |
unregister |
|
411 |
||
412 |
"Uninstall myself from my codeView" |
|
413 |
||
414 |
codeView removeDependent: self. |
|
415 |
codeView := nil. |
|
416 |
textView := nil. |
|
417 |
||
418 |
"Created: / 06-03-2010 / 19:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
419 |
"Modified: / 17-06-2011 / 12:57:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
420 |
! ! |
|
421 |
||
422 |
!CodeViewService methodsFor:'testing'! |
|
423 |
||
12900
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
424 |
isBreakpointService |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
425 |
^ false |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
426 |
! |
5a645e7b5961
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
427 |
|
9983 | 428 |
isEnabled |
429 |
||
430 |
^enabled == true |
|
431 |
||
432 |
"Created: / 07-03-2010 / 13:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
433 |
! ! |
|
434 |
||
435 |
!CodeViewService class methodsFor:'documentation'! |
|
436 |
||
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
437 |
version |
12134
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
438 |
^ '$Id: Tools__CodeViewService.st 7860 2012-02-01 10:42:29Z vranyj1 $' |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
439 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
440 |
|
9983 | 441 |
version_CVS |
13515
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
442 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeViewService.st,v 1.14 2013-09-05 23:19:43 cg Exp $' |
9983 | 443 |
! |
444 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12134
diff
changeset
|
445 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12134
diff
changeset
|
446 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12134
diff
changeset
|
447 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12134
diff
changeset
|
448 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12134
diff
changeset
|
449 |
|
9983 | 450 |
version_SVN |
13515
d0cc1ab55768
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
13205
diff
changeset
|
451 |
^ '$Id: Tools__CodeViewService.st,v 1.14 2013-09-05 23:19:43 cg Exp $' |
9983 | 452 |
! ! |
12861
3106975dc3e1
class: Tools::CodeViewService
Claus Gittinger <cg@exept.de>
parents:
11182
diff
changeset
|
453 |