author | vrany |
Fri, 07 Oct 2011 19:02:04 +0200 | |
changeset 10780 | 1093fdd69f27 |
parent 10767 | 2432e277a643 |
child 10781 | f9ad38e58704 |
permissions | -rw-r--r-- |
9985 | 1 |
" |
10072 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
3 |
All Rights Reserved |
|
4 |
||
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. |
|
9985 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
SimpleView subclass:#CodeView2 |
|
31 |
instanceVariableNames:'gutterView textView textViewScroller methodHolder languageHolder |
|
32 |
classHolder browserHolder codeAspect modifiedChannel |
|
10409 | 33 |
showGutterChannel modeHolder serviceManager services |
10767 | 34 |
servicesFromClient syntaxElements syntaxElementSelection |
35 |
highlightEmphasis diffMode synchronizedCodeViews' |
|
9985 | 36 |
classVariableNames:'TraceSelectors' |
37 |
poolDictionaries:'' |
|
38 |
category:'Interface-CodeView' |
|
39 |
! |
|
40 |
||
41 |
SimpleView subclass:#GutterView |
|
10312 | 42 |
instanceVariableNames:'codeView textView textViewScroller widthAnnotations widthDiffInfo |
43 |
firstLineShown lastLineShown' |
|
9985 | 44 |
classVariableNames:'' |
45 |
poolDictionaries:'' |
|
46 |
privateIn:CodeView2 |
|
47 |
! |
|
48 |
||
49 |
CodeView subclass:#TextView |
|
50 |
instanceVariableNames:'codeView gutterView diffMode deletedLines insertedLines |
|
51 |
lastFirstLine changedLines scrolled originDiffText emptyLines |
|
10224 | 52 |
changedDiffText suppressNotifications' |
9985 | 53 |
classVariableNames:'' |
54 |
poolDictionaries:'' |
|
55 |
privateIn:CodeView2 |
|
56 |
! |
|
57 |
||
58 |
!CodeView2 class methodsFor:'documentation'! |
|
59 |
||
60 |
copyright |
|
61 |
" |
|
10072 | 62 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
63 |
All Rights Reserved |
|
64 |
||
65 |
Permission is hereby granted, free of charge, to any person |
|
66 |
obtaining a copy of this software and associated documentation |
|
67 |
files (the 'Software'), to deal in the Software without |
|
68 |
restriction, including without limitation the rights to use, |
|
69 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
70 |
copies of the Software, and to permit persons to whom the |
|
71 |
Software is furnished to do so, subject to the following |
|
72 |
conditions: |
|
73 |
||
74 |
The above copyright notice and this permission notice shall be |
|
75 |
included in all copies or substantial portions of the Software. |
|
76 |
||
77 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
78 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
79 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
80 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
81 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
82 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
83 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
84 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9985 | 85 |
" |
86 |
! ! |
|
87 |
||
88 |
!CodeView2 class methodsFor:'initialization'! |
|
89 |
||
90 |
initialize |
|
91 |
"Invoked at system start or when the class is dynamically loaded." |
|
92 |
||
93 |
"/ please change as required (and remove this comment) |
|
94 |
||
95 |
TraceSelectors := IdentitySet new. |
|
96 |
||
97 |
"Modified: / 14-02-2010 / 15:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
98 |
! ! |
|
99 |
||
100 |
!CodeView2 class methodsFor:'debugging'! |
|
101 |
||
102 |
trace: aSelector |
|
103 |
||
104 |
TraceSelectors add: aSelector |
|
105 |
||
106 |
"Created: / 14-02-2010 / 09:26:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
107 |
! |
|
108 |
||
109 |
untrace: aSelector |
|
110 |
||
111 |
TraceSelectors remove: aSelector ifAbsent:[] |
|
112 |
||
113 |
"Created: / 14-02-2010 / 09:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
114 |
! |
|
115 |
||
116 |
untraceAll |
|
117 |
||
118 |
TraceSelectors := IdentitySet new |
|
119 |
||
120 |
"Created: / 14-02-2010 / 09:53:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
121 |
! ! |
|
122 |
||
123 |
!CodeView2 class methodsFor:'examples'! |
|
124 |
||
125 |
example1 |
|
126 |
||
127 |
| window codeView | |
|
128 |
||
129 |
||
130 |
window := StandardSystemView new. |
|
131 |
window extent: 300 @ 300. |
|
132 |
window label: 'CodeView2 example1'. |
|
133 |
||
134 |
codeView := Tools::CodeView2 in: window. |
|
135 |
codeView |
|
136 |
origin: 0.1 @ 0.1 |
|
137 |
corner: 0.9 @ 0.9. |
|
138 |
||
139 |
||
140 |
window open. |
|
141 |
||
142 |
"Created: / 02-09-2009 / 21:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
143 |
! ! |
|
144 |
||
145 |
!CodeView2 class methodsFor:'menu specs'! |
|
146 |
||
10293 | 147 |
debugMenu |
148 |
"This resource specification was automatically generated |
|
149 |
by the MenuEditor of ST/X." |
|
150 |
||
151 |
"Do not manually edit this!! If it is corrupted, |
|
152 |
the MenuEditor may not be able to read the specification." |
|
153 |
||
154 |
" |
|
155 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_stxStyle |
|
156 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_stxStyle)) startUp |
|
157 |
" |
|
158 |
||
159 |
<resource: #menu> |
|
160 |
||
161 |
^ |
|
162 |
#(Menu |
|
163 |
( |
|
164 |
(MenuItem |
|
165 |
label: 'Inspect ' |
|
166 |
itemValue: inspectView |
|
167 |
translateLabel: true |
|
168 |
) |
|
169 |
(MenuItem |
|
170 |
label: 'Inspect Syntax Elements' |
|
171 |
itemValue: inspectSyntaxElements |
|
172 |
translateLabel: true |
|
173 |
) |
|
174 |
(MenuItem |
|
175 |
label: 'Inspect selected selector' |
|
176 |
itemValue: inspectSelectedSelector |
|
177 |
translateLabel: true |
|
178 |
) |
|
179 |
) |
|
180 |
nil |
|
181 |
nil |
|
182 |
) |
|
183 |
||
184 |
"Created: / 08-07-2011 / 13:36:02 / cg" |
|
185 |
! |
|
186 |
||
9985 | 187 |
editMenu |
188 |
"This resource specification was automatically generated |
|
189 |
by the MenuEditor of ST/X." |
|
190 |
||
191 |
"Do not manually edit this!! If it is corrupted, |
|
192 |
the MenuEditor may not be able to read the specification." |
|
193 |
||
194 |
" |
|
195 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu |
|
196 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu)) startUp |
|
197 |
" |
|
198 |
||
10290 | 199 |
UserPreferences current eclipseStyleMenus ifTrue:[ |
200 |
^ self editMenu_eclipseStyle |
|
201 |
]. |
|
202 |
^ self editMenu_stxStyle |
|
203 |
||
204 |
"Modified: / 08-07-2011 / 13:23:35 / cg" |
|
205 |
! |
|
206 |
||
207 |
editMenu_eclipseStyle |
|
208 |
"This resource specification was automatically generated |
|
209 |
by the MenuEditor of ST/X." |
|
210 |
||
211 |
"Do not manually edit this!! If it is corrupted, |
|
212 |
the MenuEditor may not be able to read the specification." |
|
213 |
||
214 |
" |
|
215 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu |
|
216 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu)) startUp |
|
217 |
" |
|
218 |
||
9985 | 219 |
<resource: #menu> |
220 |
||
221 |
^ |
|
222 |
#(Menu |
|
223 |
( |
|
224 |
(MenuItem |
|
10262 | 225 |
label: 'Implementors...' |
9985 | 226 |
itemValue: browseImplementorsOfIt |
227 |
translateLabel: true |
|
10262 | 228 |
submenuChannel: implementorsMenu |
9985 | 229 |
shortcutKey: ImplementorsOfIt |
230 |
) |
|
231 |
(MenuItem |
|
10262 | 232 |
label: 'Senders...' |
9985 | 233 |
itemValue: browseSendersOfIt |
234 |
translateLabel: true |
|
10262 | 235 |
submenuChannel: sendersMenu |
9985 | 236 |
shortcutKey: SendersOfIt |
237 |
) |
|
238 |
(MenuItem |
|
239 |
label: 'Refactor' |
|
240 |
translateLabel: true |
|
241 |
isVisible: false |
|
242 |
shortcutKey: Shift |
|
243 |
) |
|
244 |
(MenuItem |
|
245 |
label: '-' |
|
246 |
) |
|
247 |
(MenuItem |
|
248 |
label: 'Accept' |
|
249 |
itemValue: accept |
|
250 |
translateLabel: true |
|
251 |
shortcutKey: Accept |
|
252 |
) |
|
253 |
(MenuItem |
|
254 |
label: '-' |
|
255 |
) |
|
256 |
(MenuItem |
|
257 |
label: 'Cut' |
|
258 |
itemValue: cut |
|
259 |
translateLabel: true |
|
260 |
shortcutKey: Cut |
|
261 |
) |
|
262 |
(MenuItem |
|
263 |
label: 'Copy' |
|
264 |
itemValue: copySelection |
|
265 |
translateLabel: true |
|
266 |
shortcutKey: Copy |
|
267 |
) |
|
268 |
(MenuItem |
|
269 |
label: 'Paste' |
|
270 |
itemValue: pasteOrReplace |
|
271 |
translateLabel: true |
|
272 |
shortcutKey: Paste |
|
273 |
) |
|
274 |
(MenuItem |
|
275 |
label: '-' |
|
276 |
) |
|
277 |
(MenuItem |
|
278 |
label: 'Undo' |
|
279 |
itemValue: undo |
|
280 |
translateLabel: true |
|
281 |
shortcutKey: Undo |
|
282 |
) |
|
283 |
(MenuItem |
|
284 |
label: '-' |
|
285 |
) |
|
286 |
(MenuItem |
|
287 |
label: 'Do it' |
|
288 |
itemValue: doIt |
|
289 |
translateLabel: true |
|
290 |
shortcutKey: DoIt |
|
291 |
) |
|
292 |
(MenuItem |
|
293 |
label: 'Print it' |
|
294 |
itemValue: printIt |
|
295 |
translateLabel: true |
|
296 |
shortcutKey: PrintIt |
|
297 |
) |
|
298 |
(MenuItem |
|
299 |
label: 'Inspect it' |
|
300 |
itemValue: inspectIt |
|
301 |
translateLabel: true |
|
302 |
shortcutKey: InspectIt |
|
303 |
) |
|
304 |
(MenuItem |
|
305 |
label: 'Profile it' |
|
306 |
itemValue: profileIt |
|
307 |
translateLabel: true |
|
308 |
shortcutKey: InspectIt |
|
309 |
) |
|
310 |
(MenuItem |
|
311 |
label: '-' |
|
312 |
) |
|
313 |
(MenuItem |
|
314 |
label: 'Show Gutter' |
|
315 |
nameKey: ShowGutter |
|
316 |
translateLabel: true |
|
317 |
indication: showGutterChannel |
|
318 |
) |
|
319 |
(MenuItem |
|
320 |
label: 'More' |
|
321 |
nameKey: More |
|
322 |
translateLabel: true |
|
323 |
) |
|
324 |
(MenuItem |
|
325 |
label: 'Services' |
|
326 |
translateLabel: true |
|
327 |
submenuChannel: servicesMenu |
|
328 |
) |
|
329 |
(MenuItem |
|
330 |
label: 'Debug' |
|
331 |
translateLabel: true |
|
332 |
submenu: |
|
333 |
(Menu |
|
334 |
( |
|
335 |
(MenuItem |
|
336 |
label: 'Inspect ' |
|
337 |
itemValue: inspectView |
|
338 |
translateLabel: true |
|
339 |
) |
|
340 |
(MenuItem |
|
341 |
label: 'Inspect Syntax Elements' |
|
342 |
itemValue: inspectSyntaxElements |
|
343 |
translateLabel: true |
|
344 |
) |
|
345 |
(MenuItem |
|
346 |
label: 'Inspect selected selector' |
|
347 |
itemValue: inspectSelectedSelector |
|
348 |
translateLabel: true |
|
349 |
) |
|
350 |
) |
|
351 |
nil |
|
352 |
nil |
|
353 |
) |
|
354 |
) |
|
355 |
) |
|
356 |
nil |
|
357 |
nil |
|
358 |
) |
|
10290 | 359 |
|
360 |
"Created: / 08-07-2011 / 13:20:47 / cg" |
|
361 |
! |
|
362 |
||
363 |
editMenu_stxStyle |
|
364 |
"This resource specification was automatically generated |
|
365 |
by the MenuEditor of ST/X." |
|
366 |
||
367 |
"Do not manually edit this!! If it is corrupted, |
|
368 |
the MenuEditor may not be able to read the specification." |
|
369 |
||
370 |
" |
|
371 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_stxStyle |
|
372 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_stxStyle)) startUp |
|
373 |
" |
|
374 |
||
375 |
<resource: #menu> |
|
376 |
||
377 |
^ |
|
378 |
#(Menu |
|
379 |
( |
|
380 |
(MenuItem |
|
381 |
label: 'Undo' |
|
382 |
itemValue: undo |
|
383 |
translateLabel: true |
|
384 |
shortcutKey: Undo |
|
385 |
) |
|
386 |
(MenuItem |
|
387 |
label: 'Again' |
|
388 |
itemValue: again |
|
389 |
translateLabel: true |
|
390 |
shortcutKey: Again |
|
391 |
) |
|
392 |
(MenuItem |
|
393 |
label: '-' |
|
394 |
) |
|
395 |
(MenuItem |
|
396 |
label: 'Cut' |
|
397 |
itemValue: cut |
|
398 |
translateLabel: true |
|
399 |
shortcutKey: Cut |
|
400 |
) |
|
401 |
(MenuItem |
|
402 |
label: 'Copy' |
|
403 |
itemValue: copySelection |
|
404 |
translateLabel: true |
|
405 |
shortcutKey: Copy |
|
406 |
) |
|
407 |
(MenuItem |
|
408 |
label: 'Paste' |
|
409 |
itemValue: pasteOrReplace |
|
410 |
translateLabel: true |
|
411 |
shortcutKey: Paste |
|
412 |
) |
|
413 |
(MenuItem |
|
414 |
label: '-' |
|
415 |
) |
|
416 |
(MenuItem |
|
417 |
label: 'DoIt' |
|
418 |
itemValue: doIt |
|
419 |
translateLabel: true |
|
420 |
shortcutKey: DoIt |
|
421 |
) |
|
422 |
(MenuItem |
|
423 |
label: 'PrintIt' |
|
424 |
itemValue: printIt |
|
425 |
translateLabel: true |
|
426 |
shortcutKey: PrintIt |
|
427 |
) |
|
428 |
(MenuItem |
|
429 |
label: 'InspectIt' |
|
430 |
itemValue: inspectIt |
|
431 |
translateLabel: true |
|
432 |
shortcutKey: InspectIt |
|
433 |
) |
|
434 |
(MenuItem |
|
435 |
label: '-' |
|
436 |
) |
|
437 |
(MenuItem |
|
438 |
label: 'Accept' |
|
439 |
itemValue: accept |
|
440 |
translateLabel: true |
|
441 |
shortcutKey: Accept |
|
442 |
) |
|
443 |
(MenuItem |
|
444 |
label: '-' |
|
445 |
) |
|
446 |
(MenuItem |
|
447 |
label: 'Refactor' |
|
448 |
translateLabel: true |
|
449 |
isVisible: false |
|
450 |
shortcutKey: Shift |
|
451 |
) |
|
452 |
(MenuItem |
|
453 |
label: 'Services' |
|
454 |
translateLabel: true |
|
455 |
submenuChannel: servicesMenu |
|
456 |
) |
|
457 |
(MenuItem |
|
458 |
label: '-' |
|
459 |
) |
|
460 |
(MenuItem |
|
461 |
label: 'More' |
|
462 |
nameKey: More |
|
463 |
translateLabel: true |
|
464 |
shortcutKey: Ctrl |
|
465 |
) |
|
466 |
) |
|
467 |
nil |
|
468 |
nil |
|
469 |
) |
|
9985 | 470 |
! ! |
471 |
||
472 |
!CodeView2 methodsFor:'accessing'! |
|
473 |
||
474 |
acceptAction:aBlock |
|
475 |
||
476 |
textView acceptAction: aBlock |
|
477 |
||
478 |
"Modified: / 01-08-2010 / 20:40:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
479 |
! |
|
480 |
||
10224 | 481 |
breakpoints |
482 |
||
483 |
services do:[:each| |
|
484 |
(each isKindOf: BreakpointService) ifTrue:[ |
|
485 |
^each breakpoints |
|
486 |
] |
|
487 |
]. |
|
10767 | 488 |
^ nil |
10224 | 489 |
|
490 |
"Created: / 06-07-2011 / 18:05:35 / jv" |
|
10767 | 491 |
"Modified: / 06-10-2011 / 14:13:53 / cg" |
10224 | 492 |
! |
493 |
||
10245 | 494 |
browser |
495 |
||
496 |
^self browserHolder value |
|
497 |
||
498 |
"Created: / 07-07-2011 / 12:25:59 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
499 |
! |
|
500 |
||
9985 | 501 |
codeAspect |
502 |
||
503 |
|app| |
|
504 |
codeAspect ifNotNil:[^codeAspect]. |
|
10409 | 505 |
methodHolder value ifNotNil:[^#method]. |
9985 | 506 |
|
507 |
^((app := self topView application) notNil and:[app respondsTo: #codeAspect]) |
|
508 |
ifTrue:[app codeAspect] |
|
509 |
ifFalse:[#expression] |
|
510 |
||
10409 | 511 |
"Modified: / 27-07-2011 / 13:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 512 |
! |
513 |
||
514 |
codeAspect:aSymbol |
|
515 |
codeAspect := aSymbol. |
|
516 |
! |
|
517 |
||
518 |
contents |
|
519 |
||
520 |
^textView contents |
|
521 |
||
522 |
"Created: / 14-02-2010 / 22:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
523 |
! |
|
524 |
||
525 |
contents: aStringOrStringCollection |
|
526 |
||
527 |
textView contents: aStringOrStringCollection. |
|
528 |
"/self update:#value with: aStringOrStringCollection from: textView model |
|
529 |
||
10330 | 530 |
"Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 531 |
! |
532 |
||
533 |
diffMode |
|
534 |
^ diffMode |
|
535 |
! |
|
536 |
||
537 |
diffMode:aBoolean |
|
538 |
diffMode := aBoolean. |
|
539 |
textView diffMode: aBoolean |
|
540 |
||
541 |
"Modified: / 08-04-2011 / 20:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
542 |
! |
|
543 |
||
544 |
font |
|
545 |
||
546 |
^textView font |
|
547 |
||
548 |
"Created: / 16-02-2010 / 10:26:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
549 |
! |
|
550 |
||
551 |
font: aFont |
|
552 |
||
553 |
^textView font: aFont |
|
554 |
||
555 |
"Created: / 16-02-2010 / 10:26:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
556 |
! |
|
557 |
||
558 |
mode |
|
559 |
||
560 |
^self modeHolder value |
|
561 |
||
562 |
"Created: / 13-06-2011 / 10:49:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
563 |
! |
|
564 |
||
565 |
mode: aSymbol |
|
566 |
||
567 |
self assert: (#(expression method) includes: aSymbol). |
|
568 |
||
569 |
^self modeHolder value: aSymbol |
|
570 |
||
571 |
"Created: / 13-06-2011 / 10:50:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
572 |
"Modified: / 15-06-2011 / 16:37:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
573 |
! |
|
574 |
||
10409 | 575 |
model |
576 |
||
577 |
^textView model. |
|
578 |
||
579 |
"Created: / 27-07-2011 / 12:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
580 |
! |
|
581 |
||
582 |
model: aValueModel |
|
583 |
||
584 |
|oldValue newValue| |
|
585 |
||
586 |
textView model notNil ifTrue:[ |
|
587 |
oldValue := textView model value. |
|
588 |
textView model removeDependent:self. |
|
589 |
]. |
|
590 |
textView model: aValueModel. |
|
591 |
textView model notNil ifTrue:[ |
|
592 |
textView model addDependent:self. |
|
593 |
]. |
|
594 |
newValue := textView model value. |
|
595 |
oldValue ~~ newValue ifTrue:[ |
|
596 |
self update:#value with:newValue from:textView model. |
|
597 |
]. |
|
598 |
||
599 |
"Modified: / 27-07-2011 / 12:58:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
600 |
! |
|
601 |
||
9985 | 602 |
modified |
603 |
"return true if text was modified" |
|
604 |
||
10245 | 605 |
^ self modifiedChannel value |
606 |
||
607 |
"Modified: / 07-07-2011 / 12:15:43 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 608 |
! |
609 |
||
610 |
modified:aBoolean |
|
611 |
"set/clear the modified flag" |
|
612 |
||
10245 | 613 |
self modifiedChannel value:aBoolean |
614 |
||
615 |
"Modified: / 14-02-1997 / 16:44:05 / cg" |
|
616 |
"Modified: / 07-07-2011 / 12:15:39 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 617 |
! |
618 |
||
619 |
scrolledView |
|
620 |
||
621 |
^self |
|
622 |
||
623 |
"Created: / 14-02-2010 / 22:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
624 |
! |
|
625 |
||
10487 | 626 |
services |
10767 | 627 |
^ services ? #() |
10487 | 628 |
|
629 |
"Created: / 05-08-2011 / 10:14:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 630 |
"Modified (format): / 06-10-2011 / 14:11:11 / cg" |
10487 | 631 |
! |
632 |
||
10755 | 633 |
services:aCollectionOfServices |
634 |
"allow setting of the services (instances); |
|
635 |
this is needed for FileBrowser, to setup a codeView2 without Smalltalk-specific |
|
636 |
services" |
|
637 |
||
10767 | 638 |
servicesFromClient := true. |
639 |
services := aCollectionOfServices. |
|
640 |
||
641 |
"Created: / 06-10-2011 / 14:15:36 / cg" |
|
10755 | 642 |
! |
643 |
||
9985 | 644 |
showGutter |
645 |
||
646 |
^showGutterChannel value |
|
647 |
||
648 |
"Created: / 23-06-2010 / 19:37:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
649 |
! |
|
650 |
||
651 |
synchronizeWith: aCodeView |
|
652 |
||
653 |
self assert: aCodeView ~= self. |
|
654 |
(synchronizedCodeViews includes: aCodeView) ifTrue:[^self]. |
|
655 |
synchronizedCodeViews := synchronizedCodeViews copyWith: aCodeView. |
|
656 |
||
657 |
"Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>" |
|
658 |
"Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
659 |
! ! |
|
660 |
||
10409 | 661 |
!CodeView2 methodsFor:'accessing - code component'! |
662 |
||
663 |
klass |
|
664 |
||
665 |
| v | |
|
666 |
||
667 |
(v := self classHolder value) notNil ifTrue:[^v]. |
|
668 |
(v := self methodHolder value) notNil ifTrue:[^v mclass]. |
|
669 |
||
670 |
^UndefinedObject |
|
671 |
||
672 |
"Created: / 27-07-2011 / 13:14:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
673 |
! |
|
674 |
||
675 |
klass: aClass |
|
676 |
||
677 |
"Created: / 27-07-2011 / 13:13:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
678 |
! |
|
679 |
||
680 |
language |
|
681 |
"return the value in 'languageHolder'" |
|
682 |
||
683 |
| v | |
|
684 |
||
685 |
(v := self languageHolder value) notNil ifTrue:[^v]. |
|
686 |
(v := self methodHolder value) notNil ifTrue:[^v programmingLanguage]. |
|
687 |
(v := self classHolder value) notNil ifTrue:[^v programmingLanguage]. |
|
688 |
||
689 |
^SmalltalkLanguage instance |
|
690 |
||
691 |
"Modified: / 17-06-2011 / 12:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
692 |
! |
|
693 |
||
694 |
language: newValue |
|
695 |
"set the value in 'languageHolder'" |
|
696 |
||
697 |
self languageHolder value: newValue |
|
698 |
! |
|
699 |
||
700 |
method |
|
701 |
||
702 |
^self methodHolder value |
|
703 |
||
704 |
"Created: / 27-07-2011 / 13:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
705 |
! |
|
706 |
||
707 |
method: aMethod |
|
708 |
||
709 |
^self methodHolder value: aMethod |
|
710 |
||
711 |
"Created: / 27-07-2011 / 13:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
712 |
! ! |
|
713 |
||
9985 | 714 |
!CodeView2 methodsFor:'aspects'! |
715 |
||
716 |
browserHolder |
|
717 |
browserHolder ifNil:[ |
|
718 |
browserHolder := ValueHolder new |
|
719 |
]. |
|
720 |
^browserHolder |
|
721 |
||
722 |
"Modified: / 14-02-2010 / 19:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
723 |
! |
|
724 |
||
725 |
browserHolder:aValueModel |
|
726 |
browserHolder := aValueModel. |
|
727 |
! |
|
728 |
||
729 |
classHolder |
|
730 |
"return/create the 'classHolder' value holder (automatically generated)" |
|
731 |
||
732 |
classHolder isNil ifTrue:[ |
|
10409 | 733 |
classHolder := ValueHolder with: nil. |
9985 | 734 |
classHolder addDependent:self. |
735 |
]. |
|
736 |
^ classHolder |
|
737 |
||
10409 | 738 |
"Modified: / 27-07-2011 / 13:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 739 |
! |
740 |
||
741 |
classHolder:aValueModel |
|
742 |
"set the 'classHolder' value holder (automatically generated)" |
|
743 |
||
744 |
|old oldValue newValue| |
|
745 |
||
746 |
classHolder notNil ifTrue:[ |
|
747 |
oldValue := classHolder value. |
|
748 |
classHolder removeDependent:self. |
|
749 |
]. |
|
750 |
classHolder := aValueModel. |
|
751 |
classHolder notNil ifTrue:[ |
|
752 |
classHolder addDependent:self. |
|
753 |
]. |
|
754 |
old := methodHolder. |
|
755 |
newValue := classHolder value. |
|
756 |
oldValue ~~ newValue ifTrue:[ |
|
757 |
self update:#value with:newValue from:classHolder. |
|
758 |
]. |
|
759 |
||
760 |
self changed: #classHolder with: old -> classHolder |
|
761 |
||
762 |
"Modified: / 17-06-2011 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
763 |
! |
|
764 |
||
765 |
languageHolder |
|
766 |
languageHolder isNil ifTrue:[ |
|
10723 | 767 |
"/ cg: I dont like this default here; everyone who is not showing ST-code (expecco, filebrowser etc.) |
768 |
"/ has to explicitely clear the valueholder. I guess, it is better for the few |
|
769 |
"/ others to explicitely set it, if they do not provide syntaxHighlighter per method |
|
770 |
"/ or class. |
|
771 |
languageHolder := ValueHolder with: nil "SmalltalkLanguage instance". |
|
9985 | 772 |
languageHolder addDependent:self. |
773 |
]. |
|
774 |
^ languageHolder |
|
10723 | 775 |
|
776 |
"Modified (format): / 26-09-2011 / 17:04:04 / cg" |
|
9985 | 777 |
! |
778 |
||
779 |
languageHolder:aValueModel |
|
780 |
"set the 'languageHolder' value holder (automatically generated)" |
|
781 |
||
782 |
|old oldValue newValue| |
|
783 |
||
784 |
languageHolder notNil ifTrue:[ |
|
785 |
oldValue := languageHolder value. |
|
786 |
languageHolder removeDependent:self. |
|
787 |
]. |
|
788 |
languageHolder := aValueModel. |
|
789 |
languageHolder notNil ifTrue:[ |
|
790 |
languageHolder addDependent:self. |
|
791 |
]. |
|
792 |
old := languageHolder. |
|
793 |
newValue := languageHolder value. |
|
794 |
oldValue ~~ newValue ifTrue:[ |
|
795 |
self update:#value with:newValue from:languageHolder. |
|
796 |
]. |
|
797 |
||
798 |
self changed: #languageHolder with: old -> languageHolder |
|
799 |
||
800 |
"Modified: / 17-06-2011 / 12:56:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
801 |
! |
|
802 |
||
803 |
methodHolder |
|
804 |
"return/create the 'methodHolder' value holder (automatically generated)" |
|
805 |
||
806 |
methodHolder isNil ifTrue:[ |
|
807 |
methodHolder := ValueHolder new. |
|
808 |
methodHolder addDependent:self. |
|
809 |
]. |
|
810 |
^ methodHolder |
|
811 |
! |
|
812 |
||
813 |
methodHolder:aValueModel |
|
814 |
"set the 'methodHolder' value holder (automatically generated)" |
|
815 |
||
816 |
|old oldValue newValue| |
|
817 |
||
818 |
methodHolder notNil ifTrue:[ |
|
819 |
oldValue := methodHolder value. |
|
820 |
methodHolder removeDependent:self. |
|
821 |
]. |
|
822 |
old := methodHolder. |
|
823 |
methodHolder := aValueModel. |
|
824 |
methodHolder notNil ifTrue:[ |
|
825 |
methodHolder addDependent:self. |
|
826 |
]. |
|
827 |
newValue := methodHolder value. |
|
828 |
oldValue ~~ newValue ifTrue:[ |
|
829 |
self update:#value with:newValue from:methodHolder. |
|
830 |
]. |
|
831 |
||
832 |
self changed: #methodHolder with: old -> methodHolder |
|
833 |
||
834 |
"Modified: / 17-06-2011 / 12:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
835 |
! |
|
836 |
||
837 |
modeHolder |
|
838 |
"return/create the 'modeHolder' value holder (automatically generated)" |
|
839 |
||
840 |
modeHolder isNil ifTrue:[ |
|
841 |
modeHolder := #expression asValue. |
|
842 |
modeHolder addDependent:self. |
|
843 |
]. |
|
844 |
^ modeHolder |
|
845 |
||
846 |
"Modified: / 13-06-2011 / 10:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
847 |
! |
|
848 |
||
849 |
modeHolder:something |
|
850 |
"set the 'modeHolder' value holder (automatically generated)" |
|
851 |
||
852 |
|oldValue newValue| |
|
853 |
||
854 |
modeHolder notNil ifTrue:[ |
|
855 |
oldValue := modeHolder value. |
|
856 |
modeHolder removeDependent:self. |
|
857 |
]. |
|
858 |
modeHolder := something. |
|
859 |
modeHolder notNil ifTrue:[ |
|
860 |
modeHolder addDependent:self. |
|
861 |
]. |
|
862 |
newValue := modeHolder value. |
|
863 |
oldValue ~~ newValue ifTrue:[ |
|
864 |
self update:#value with:newValue from:modeHolder. |
|
865 |
]. |
|
866 |
||
867 |
self changed: #modeHolder with: modeHolder |
|
868 |
||
869 |
"Modified: / 17-06-2011 / 12:55:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
870 |
! ! |
|
871 |
||
872 |
!CodeView2 methodsFor:'change & update'! |
|
873 |
||
874 |
update:aspect with:param from:sender |
|
875 |
||
10245 | 876 |
sender == showGutterChannel ifTrue: [ |
877 |
self updateGutterVisibility. |
|
878 |
^self. |
|
879 |
]. |
|
9985 | 880 |
|
10662
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
881 |
services do:[:each | |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
882 |
each isEnabled ifTrue:[ |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
883 |
each update:aspect with:param from:sender |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
884 |
] |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
885 |
]. |
9985 | 886 |
|
887 |
super update:aspect with:param from:sender |
|
888 |
||
889 |
"Modified: / 23-06-2010 / 19:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10245 | 890 |
"Modified: / 07-07-2011 / 12:07:04 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
10767 | 891 |
"Modified: / 06-10-2011 / 14:14:36 / cg" |
9985 | 892 |
! |
893 |
||
894 |
updateGutterVisibility |
|
895 |
||
896 |
self showGutterChannel value ifTrue:[ |
|
897 |
textViewScroller origin:(gutterView width @ 0.0) corner:(1.0 @ 1.0). |
|
898 |
gutterView beVisible. |
|
899 |
] ifFalse:[ |
|
900 |
textViewScroller origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
901 |
gutterView beInvisible. |
|
902 |
] |
|
903 |
||
904 |
"Created: / 23-06-2010 / 19:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
905 |
! ! |
|
906 |
||
907 |
!CodeView2 methodsFor:'channels'! |
|
908 |
||
909 |
modifiedChannel |
|
910 |
"return the valueHolder holding true if text was modified" |
|
911 |
||
10245 | 912 |
^ textView modifiedChannel |
913 |
"/ ^ modifiedChannel |
|
914 |
||
915 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 916 |
! |
917 |
||
918 |
modifiedChannel:aValueHolder |
|
919 |
"set the valueHolder holding true if text was modified" |
|
920 |
||
10662
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
921 |
textView modifiedChannel removeDependent:self. |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
922 |
textView modifiedChannel:aValueHolder. |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
923 |
textView modifiedChannel addDependent:self. |
10245 | 924 |
|
925 |
"/ |prev| |
|
926 |
"/ |
|
927 |
"/ prev := modifiedChannel. |
|
928 |
"/ modifiedChannel := aValueHolder. |
|
929 |
"/ self setupChannel:aValueHolder for:nil withOld:prev |
|
930 |
||
931 |
"Created: / 30-01-1998 / 14:51:32 / cg" |
|
932 |
"Modified: / 07-07-2011 / 12:07:43 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
10662
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
933 |
"Modified: / 05-09-2011 / 05:13:27 / cg" |
9985 | 934 |
! |
935 |
||
936 |
showGutterChannel |
|
937 |
||
938 |
^showGutterChannel |
|
939 |
||
940 |
"Created: / 23-06-2010 / 19:02:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
941 |
! |
|
942 |
||
943 |
showGutterChannel:aValueHolder |
|
944 |
"set the valueHolder holding true if text was modified" |
|
945 |
||
946 |
|prev| |
|
947 |
||
948 |
prev := showGutterChannel. |
|
949 |
showGutterChannel := aValueHolder. |
|
950 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
951 |
||
952 |
"Created: / 23-06-2010 / 19:03:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
953 |
! ! |
|
954 |
||
10262 | 955 |
!CodeView2 methodsFor:'code services'! |
956 |
||
957 |
browseMethod: method |
|
958 |
||
959 |
self browseMethod: method label: nil. |
|
960 |
||
961 |
"Created: / 14-02-2010 / 19:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
962 |
! |
|
963 |
||
964 |
browseMethod: method label: label |
|
965 |
||
966 |
self browser ifNil: [^NewSystemBrowser openInMethod:method]. |
|
967 |
(UserPreferences current alwaysOpenNewTabWhenCtrlClick |
|
968 |
or:[self browser navigationState modified]) |
|
969 |
ifTrue: |
|
970 |
[self browser |
|
971 |
spawnFullBrowserInClass: method mclass |
|
972 |
selector:method selector |
|
973 |
in:#newBuffer] |
|
974 |
ifFalse: |
|
975 |
[self browser |
|
976 |
switchToClass: method containingClass |
|
977 |
selector: method selector]. |
|
978 |
||
979 |
"Modified: / 19-02-2008 / 10:15:17 / janfrog" |
|
980 |
"Created: / 19-10-2008 / 08:16:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
981 |
"Modified: / 25-07-2010 / 13:34:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
982 |
! |
|
983 |
||
984 |
browseMethods: methods label: label |
|
985 |
||
986 |
methods size = 1 ifTrue: |
|
987 |
[^self browseMethod: methods anyOne label: label]. |
|
988 |
||
989 |
self browser |
|
990 |
ifNil: [NewSystemBrowser browseMethods: methods title: label] |
|
991 |
ifNotNil:[self browser spawnMethodBrowserFor:methods in:#newBuffer label:label] |
|
992 |
||
993 |
"Created: / 26-12-2007 / 11:32:04 / janfrog" |
|
994 |
"Modified: / 19-10-2008 / 08:17:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
995 |
! |
|
996 |
||
997 |
extractSelectorAndSelectedTextFrom: givenSelectedText |
|
998 |
||
999 |
| selector selectedText compilerClass na | |
|
1000 |
selectedText := givenSelectedText. |
|
1001 |
compilerClass := self language compilerClass. |
|
1002 |
selectedText size > 0 ifTrue:[ |
|
1003 |
self windowGroup withWaitCursorDo:[ |
|
1004 |
"/ hack, for now and expecco; must ask the Parser eventually... |
|
1005 |
(compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser]) ifTrue:[ |
|
1006 |
"/ selector is in one piece anyway |
|
1007 |
(selectedText includes:$_) ifFalse:[ |
|
1008 |
"/ zero or one args - sigh (need to parse more to figure this out) |
|
1009 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:1. |
|
1010 |
selectedText := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:0. |
|
1011 |
] ifTrue:[ |
|
1012 |
"/ count _#s plus one arg - sigh |
|
1013 |
na := (selectedText occurrencesOf:$_) + 1. |
|
1014 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:na |
|
1015 |
]. |
|
1016 |
] ifFalse:[ |
|
1017 |
selector := SystemBrowser extractSelectorFrom:selectedText. |
|
1018 |
]. |
|
1019 |
] |
|
1020 |
]. |
|
1021 |
^Array with: selector with: selectedText |
|
1022 |
||
1023 |
"Created: / 30-06-2011 / 19:49:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1024 |
! |
|
1025 |
||
1026 |
implementorsOf: selector |
|
1027 |
||
1028 |
selector ifNil:[^#()]. |
|
1029 |
^SystemBrowser |
|
1030 |
findImplementorsOf: selector |
|
1031 |
in: Smalltalk allClasses |
|
1032 |
ignoreCase: false |
|
1033 |
||
1034 |
"Created: / 26-12-2007 / 11:37:11 / janfrog" |
|
1035 |
! |
|
1036 |
||
1037 |
sendersOf: selector |
|
1038 |
||
1039 |
selector ifNil:[^#()]. |
|
1040 |
^SystemBrowser |
|
1041 |
findSendersOf: selector |
|
1042 |
in: Smalltalk allClasses |
|
1043 |
ignoreCase: false |
|
1044 |
||
1045 |
"Created: / 26-12-2007 / 11:37:22 / janfrog" |
|
1046 |
"Modified: / 30-06-2011 / 19:32:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1047 |
! ! |
|
1048 |
||
9985 | 1049 |
!CodeView2 methodsFor:'delegation'! |
1050 |
||
1051 |
doesNotUnderstand: aMessage |
|
1052 |
||
1053 |
((textView respondsTo: aMessage selector) |
|
1054 |
and:[(TraceSelectors includes:aMessage selector) not]) |
|
1055 |
ifTrue:[^aMessage sendTo: textView]. |
|
1056 |
^super doesNotUnderstand: aMessage |
|
1057 |
||
1058 |
"Created: / 13-02-2010 / 23:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1059 |
"Modified: / 14-02-2010 / 09:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1060 |
! |
|
1061 |
||
1062 |
hasSelection |
|
1063 |
||
1064 |
^textView hasSelection |
|
1065 |
||
1066 |
"Created: / 14-02-2010 / 09:53:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1067 |
! ! |
|
1068 |
||
1069 |
!CodeView2 methodsFor:'delegation - drawing'! |
|
1070 |
||
1071 |
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
|
1072 |
"See the comment in |
|
1073 |
CodeViewService>>drawLine:in:atX..." |
|
1074 |
||
1075 |
services do:[:each| |
|
1076 |
each drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
|
1077 |
] |
|
1078 |
||
1079 |
"Created: / 17-06-2011 / 13:50:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1080 |
"Modified: / 06-10-2011 / 14:14:04 / cg" |
9985 | 1081 |
! |
1082 |
||
1083 |
redrawVisibleLine: visLineNr |
|
1084 |
||
1085 |
"Created: / 07-03-2010 / 14:44:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1086 |
! |
|
1087 |
||
1088 |
redrawVisibleLine:visLine col:colNr |
|
1089 |
||
1090 |
"Modified: / 05-11-2007 / 17:35:53 / cg" |
|
1091 |
"Modified: / 07-03-2010 / 14:45:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1092 |
! |
|
1093 |
||
1094 |
redrawVisibleLine:visLine from:startCol |
|
1095 |
||
1096 |
"Modified: / 07-03-2010 / 14:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1097 |
! |
|
1098 |
||
1099 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
1100 |
||
1101 |
"Modified: / 07-03-2010 / 14:46:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1102 |
! ! |
|
1103 |
||
1104 |
!CodeView2 methodsFor:'delegation - events'! |
|
1105 |
||
1106 |
buttonMotion: button x:x y:y in: view |
|
1107 |
||
1108 |
"Delegates events to services. Answers true iff at least |
|
1109 |
one service handler method returns true. In that case, |
|
1110 |
the event is is NOT processes by the view." |
|
1111 |
||
10767 | 1112 |
^ services |
9985 | 1113 |
inject: false |
1114 |
into: |
|
1115 |
[:processed :service| |
|
1116 |
service isEnabled |
|
1117 |
ifFalse: |
|
1118 |
[processed] |
|
1119 |
ifTrue: |
|
1120 |
[processed | ((service buttonMotion: button x:x y:y in: view) == true)]]. |
|
1121 |
||
1122 |
"Modified: / 07-03-2010 / 13:53:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1123 |
"Modified: / 06-10-2011 / 14:13:57 / cg" |
9985 | 1124 |
! |
1125 |
||
1126 |
buttonPress: button x:x y:y in: view |
|
1127 |
"Delegates events to services. Answers true iff at least |
|
1128 |
one service handler method returns true. In that case, |
|
1129 |
the event is is NOT processes by the view." |
|
1130 |
||
10767 | 1131 |
^ services |
9985 | 1132 |
inject: false |
1133 |
into: |
|
1134 |
[:processed :service| |
|
1135 |
service isEnabled |
|
1136 |
ifFalse: |
|
1137 |
[processed] |
|
1138 |
ifTrue: |
|
1139 |
[processed | ((service buttonPress: button x:x y:y in: view) == true)]]. |
|
1140 |
||
1141 |
"Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1142 |
"Modified: / 06-10-2011 / 14:14:00 / cg" |
9985 | 1143 |
! |
1144 |
||
1145 |
keyPress: key x:x y:y in: view |
|
1146 |
||
1147 |
"Delegates events to services. Answers true iff at least |
|
1148 |
one service handler method returns true. In that case, |
|
1149 |
the event is is NOT processes by the view." |
|
1150 |
||
10767 | 1151 |
^ services |
9985 | 1152 |
inject: false |
1153 |
into: |
|
1154 |
[:processed :service| |
|
1155 |
service isEnabled |
|
1156 |
ifFalse: |
|
1157 |
[processed] |
|
1158 |
ifTrue: |
|
1159 |
[processed | ((service keyPress: key x:x y:y in: view) == true)]]. |
|
1160 |
||
1161 |
"Modified: / 07-03-2010 / 13:54:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1162 |
"Modified: / 06-10-2011 / 14:14:11 / cg" |
9985 | 1163 |
! |
1164 |
||
1165 |
keyRelease: key x:x y:y in: view |
|
1166 |
||
1167 |
"Delegates events to services. Answers true iff at least |
|
1168 |
one service handler method returns true. In that case, |
|
1169 |
the event is is NOT processes by the view." |
|
1170 |
||
10767 | 1171 |
^ services |
9985 | 1172 |
inject: false |
1173 |
into: |
|
1174 |
[:processed :service| |
|
1175 |
service isEnabled |
|
1176 |
ifFalse: |
|
1177 |
[processed] |
|
1178 |
ifTrue: |
|
1179 |
[processed | ((service keyRelease: key x:x y:y in: view) == true)]]. |
|
1180 |
||
1181 |
"Modified: / 07-03-2010 / 13:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1182 |
"Modified: / 06-10-2011 / 14:14:13 / cg" |
9985 | 1183 |
! |
1184 |
||
10224 | 1185 |
linesDeletedFrom: start to: end |
1186 |
||
1187 |
services do: [:each | |
|
1188 |
each isEnabled ifTrue: [ |
|
1189 |
each linesDeletedFrom: start to: end |
|
1190 |
] |
|
1191 |
]. |
|
1192 |
||
1193 |
"Created: / 06-07-2011 / 17:12:54 / jv" |
|
10767 | 1194 |
"Modified: / 06-10-2011 / 14:14:16 / cg" |
10224 | 1195 |
! |
1196 |
||
1197 |
linesInsertedFrom: start to: end |
|
1198 |
||
1199 |
services do: [:each | |
|
1200 |
each isEnabled ifTrue: [ |
|
1201 |
each linesInsertedFrom: start to: end |
|
1202 |
] |
|
1203 |
]. |
|
1204 |
||
1205 |
"Created: / 06-07-2011 / 17:12:48 / jv" |
|
10767 | 1206 |
"Modified: / 06-10-2011 / 14:14:20 / cg" |
10224 | 1207 |
! |
1208 |
||
1209 |
linesModifiedFrom: start to: end |
|
1210 |
||
1211 |
services do: [:each | |
|
1212 |
each isEnabled ifTrue: [ |
|
1213 |
each linesModifiedFrom: start to: end |
|
1214 |
] |
|
1215 |
]. |
|
1216 |
||
1217 |
"Created: / 06-07-2011 / 17:12:58 / jv" |
|
10767 | 1218 |
"Modified: / 06-10-2011 / 14:13:44 / cg" |
10224 | 1219 |
! |
1220 |
||
9985 | 1221 |
scrollDown: nLines in: view |
1222 |
||
1223 |
view == textView |
|
1224 |
ifTrue: |
|
1225 |
["/my text view scrolled... |
|
1226 |
synchronizedCodeViews do:[:codeView|codeView scrollDown: nLines in: view]] |
|
1227 |
ifFalse: |
|
1228 |
["/other code view scrolls and I'm notified about that |
|
1229 |
textView basicScrollDown: nLines] |
|
1230 |
||
1231 |
"Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>" |
|
1232 |
! |
|
1233 |
||
1234 |
scrollUp: nLines in: view |
|
1235 |
||
1236 |
view == textView |
|
1237 |
ifTrue: |
|
1238 |
["/my text view scrolled... |
|
1239 |
synchronizedCodeViews do:[:codeView|codeView scrollUp: nLines in: view]] |
|
1240 |
ifFalse: |
|
1241 |
["/other code view scrolls and I'm notified about that |
|
1242 |
textView basicScrollUp: nLines] |
|
1243 |
||
1244 |
"Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>" |
|
1245 |
! ! |
|
1246 |
||
1247 |
!CodeView2 methodsFor:'diff mode'! |
|
1248 |
||
1249 |
recomputeDiff:view |
|
1250 |
|t1 t2 pom diffHelper view2| |
|
1251 |
||
1252 |
t1 := view getNewOriginText. |
|
1253 |
synchronizedCodeViews do:[:codeView | |
|
1254 |
view2 := codeView |
|
1255 |
]. |
|
1256 |
view changedDiffText:false. |
|
1257 |
view2 changedDiffText:false. |
|
1258 |
t2 := view2 getNewOriginText. |
|
1259 |
pom := DiffCodeView2 new. |
|
1260 |
(view == textView) ifTrue:[ |
|
1261 |
diffHelper := pom computeDiffDataForText1:t1 text2:t2. |
|
1262 |
(view) contents:(diffHelper text1). |
|
1263 |
(view) deletedLines:(diffHelper deleted). |
|
1264 |
(view) changedLines:(diffHelper changed). |
|
1265 |
(view) originDiffText:t1. |
|
1266 |
(view) emptyLines:(diffHelper inserted). |
|
1267 |
(view) changedLines:(diffHelper changed). |
|
1268 |
(view2) contents:(diffHelper text2). |
|
1269 |
(view2) insertedLines:(diffHelper inserted). |
|
1270 |
(view2) changedLines:(diffHelper changed). |
|
1271 |
(view2) originDiffText:t2. |
|
1272 |
(view2) emptyLines:(diffHelper deleted). |
|
1273 |
]. |
|
1274 |
||
1275 |
"Modified: / 22-06-2010 / 23:35:41 / Jakub <zelenja7@fel.cvut.cz>" |
|
1276 |
"Modified: / 23-06-2010 / 17:25:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1277 |
! ! |
|
1278 |
||
1279 |
!CodeView2 methodsFor:'initialization'! |
|
1280 |
||
1281 |
initialize |
|
1282 |
"Invoked when a new instance is created." |
|
1283 |
"Call super initialize" |
|
1284 |
||
1285 |
super initialize. |
|
1286 |
"Now set up some visual properties" |
|
1287 |
self level:-1. |
|
1288 |
"Now initialize sub-views" |
|
1289 |
showGutterChannel := (ValueHolder with: true). |
|
1290 |
showGutterChannel addDependent: self. |
|
1291 |
self initializeGutterView. |
|
1292 |
self initializeTextView. |
|
1293 |
gutterView setCodeView:self. |
|
1294 |
textView setCodeView:self. |
|
1295 |
modifiedChannel := ValueHolder with:false. |
|
1296 |
diffMode := false. |
|
1297 |
synchronizedCodeViews := #(). |
|
10767 | 1298 |
|
1299 |
servicesFromClient := false. |
|
9985 | 1300 |
services := OrderedCollection new. |
1301 |
||
1302 |
"Modified: / 14-12-2009 / 13:59:53 / Jindra <a>" |
|
1303 |
"Modified: / 06-04-2010 / 13:56:35 / Jakub <zelenja7@fel.cvut.cz>" |
|
10409 | 1304 |
"Modified (comment): / 27-07-2011 / 11:36:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10767 | 1305 |
"Modified: / 06-10-2011 / 14:15:48 / cg" |
9985 | 1306 |
! |
1307 |
||
1308 |
initializeGutterView |
|
1309 |
||
1310 |
gutterView := CodeView2::GutterView new. |
|
1311 |
gutterView origin:(0.0 @ 0.0) corner:(gutterView preferredWidth @ 1.0). |
|
1312 |
showGutterChannel value ifTrue:[self addSubView: gutterView]. |
|
1313 |
||
1314 |
"Created: / 02-09-2009 / 21:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1315 |
"Modified: / 23-06-2010 / 19:14:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1316 |
! |
|
1317 |
||
1318 |
initializeServices |
|
1319 |
| serviceClasses | |
|
10409 | 1320 |
|
10755 | 1321 |
"/ only do it, if the services have not yet been defined by the user of this view |
1322 |
"/ (FileBrowser does not want Smalltalk-specific services) |
|
10767 | 1323 |
servicesFromClient ifFalse:[ |
10755 | 1324 |
serviceClasses := CodeViewService availableServices sort:[:a :b|name < b name]. |
1325 |
serviceClasses do:[:cls| |
|
1326 |
self registerService: cls new |
|
1327 |
]. |
|
1328 |
]. |
|
9985 | 1329 |
|
10409 | 1330 |
"Modified: / 27-07-2011 / 11:37:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10767 | 1331 |
"Modified: / 06-10-2011 / 14:16:01 / cg" |
9985 | 1332 |
! |
1333 |
||
1334 |
initializeTextView |
|
1335 |
||
1336 |
"Initialize textView. gutterView have to be |
|
1337 |
already initialized!!" |
|
1338 |
||
1339 |
textViewScroller := HVScrollableView for: CodeView2::TextView in: self. |
|
1340 |
textViewScroller |
|
1341 |
origin: ((self showGutter ifTrue:[gutterView width] ifFalse:[0.0]) @ 0.0) |
|
1342 |
corner: 1.0@1.0; |
|
1343 |
level: 0. |
|
1344 |
textView := textViewScroller scrolledView. |
|
1345 |
textView level: 0. |
|
1346 |
||
1347 |
textView modifiedChannel addDependent: self. |
|
1348 |
||
1349 |
"Created: / 02-09-2009 / 21:36:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1350 |
"Modified: / 23-06-2010 / 19:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1351 |
! ! |
|
1352 |
||
1353 |
!CodeView2 methodsFor:'menu actions'! |
|
1354 |
||
10689 | 1355 |
accept |
1356 |
textView accept |
|
1357 |
||
1358 |
"Created: / 07-09-2011 / 21:29:07 / cg" |
|
1359 |
! |
|
1360 |
||
10375 | 1361 |
again |
1362 |
textView again |
|
1363 |
||
1364 |
"Created: / 16-02-2010 / 19:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1365 |
"Created: / 22-07-2011 / 17:44:31 / cg" |
|
1366 |
! |
|
1367 |
||
9985 | 1368 |
browseImplementorsOfIt |
10262 | 1369 |
|
1370 |
textView browseImplementorsOfIt |
|
1371 |
||
1372 |
"Modified: / 30-06-2011 / 19:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1373 |
! |
1374 |
||
1375 |
browseSendersOfIt |
|
10262 | 1376 |
|
1377 |
textView browseSendersOfIt |
|
1378 |
||
1379 |
"Modified: / 30-06-2011 / 19:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1380 |
! |
1381 |
||
1382 |
copySelection |
|
1383 |
||
1384 |
textView copySelection |
|
1385 |
||
1386 |
"Created: / 16-02-2010 / 19:36:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1387 |
! |
|
1388 |
||
1389 |
cut |
|
1390 |
||
1391 |
textView cut |
|
1392 |
||
1393 |
"Created: / 16-02-2010 / 19:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1394 |
! |
|
1395 |
||
1396 |
doIt |
|
1397 |
||
1398 |
textView doIt |
|
1399 |
||
1400 |
"Modified: / 16-02-2010 / 19:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1401 |
! |
|
1402 |
||
1403 |
inspectIt |
|
1404 |
||
1405 |
textView inspectIt |
|
1406 |
||
1407 |
"Modified: / 16-02-2010 / 19:38:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1408 |
! |
|
1409 |
||
1410 |
inspectSelectedSelector |
|
1411 |
||
1412 |
self error: 'Not yet implemented' |
|
1413 |
||
1414 |
"Modified: / 14-02-2010 / 15:58:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1415 |
! |
|
1416 |
||
1417 |
inspectSyntaxElements |
|
1418 |
||
1419 |
syntaxElements inspect |
|
1420 |
||
1421 |
"Modified: / 14-02-2010 / 15:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1422 |
! |
|
1423 |
||
1424 |
inspectView |
|
1425 |
||
1426 |
self inspect |
|
1427 |
||
1428 |
"Modified: / 25-03-2010 / 17:58:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1429 |
! |
|
1430 |
||
1431 |
pasteOrReplace |
|
1432 |
||
1433 |
textView pasteOrReplace |
|
1434 |
||
1435 |
"Created: / 16-02-2010 / 19:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1436 |
! |
|
1437 |
||
1438 |
printIt |
|
1439 |
||
1440 |
textView printIt |
|
1441 |
||
1442 |
"Modified: / 16-02-2010 / 19:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1443 |
! |
|
1444 |
||
1445 |
profileIt |
|
1446 |
||
1447 |
textView profileIt |
|
1448 |
||
1449 |
"Created: / 27-08-2010 / 22:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1450 |
! |
|
1451 |
||
1452 |
undo |
|
1453 |
||
1454 |
textView undo |
|
1455 |
||
1456 |
"Created: / 16-02-2010 / 19:35:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1457 |
! ! |
|
1458 |
||
1459 |
!CodeView2 methodsFor:'menus-dynamic'! |
|
1460 |
||
1461 |
editMenu |
|
10780 | 1462 |
| editMenu superEditMenu moreMenu moreMenuItem | |
1463 |
||
1464 |
superEditMenu := textView superEditMenu. |
|
1465 |
moreMenu := superEditMenu subMenuAt: superEditMenu numberOfItems. |
|
1466 |
||
1467 |
textView sensor ctrlDown ifTrue:[ |
|
1468 |
^superEditMenu |
|
1469 |
]. |
|
10293 | 1470 |
|
9985 | 1471 |
editMenu := self class editMenu decodeAsLiteralArray. |
1472 |
moreMenuItem := editMenu menuItemLabeled: 'More'. |
|
1473 |
moreMenuItem submenu: moreMenu asMenu. |
|
1474 |
editMenu findGuiResourcesIn: self. |
|
1475 |
^editMenu |
|
1476 |
||
1477 |
"Created: / 25-12-2007 / 10:10:01 / janfrog" |
|
1478 |
"Modified: / 25-12-2007 / 19:50:53 / janfrog" |
|
1479 |
"Modified: / 18-10-2008 / 20:31:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10293 | 1480 |
"Modified: / 08-07-2011 / 13:35:31 / cg" |
10780 | 1481 |
"Modified: / 07-10-2011 / 17:58:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1482 |
! |
1483 |
||
10262 | 1484 |
implementorsMenu |
1485 |
||
1486 |
| selectorAndSelectedText selector selectedText implementors | |
|
1487 |
||
1488 |
selectedText := textView selectionAsString. |
|
1489 |
selectedText size > 0 ifTrue:[ |
|
1490 |
self windowGroup withWaitCursorDo:[ |
|
1491 |
selectorAndSelectedText := self extractSelectorAndSelectedTextFrom: selectedText. |
|
1492 |
selector := selectorAndSelectedText first. |
|
1493 |
selectedText := selectorAndSelectedText second. |
|
1494 |
||
1495 |
(selector notNil and:[selector = selectedText]) ifTrue:[ |
|
1496 |
implementors := (SystemBrowser |
|
1497 |
findImplementorsOfAny:(Array with:selectedText) |
|
1498 |
in:(Smalltalk allClasses) |
|
1499 |
ignoreCase:false) |
|
1500 |
||
1501 |
] ifFalse:[ |
|
1502 |
implementors := (SystemBrowser |
|
1503 |
findImplementorsOfAny:(Array with:selectedText with: selector) |
|
1504 |
in:(Smalltalk allClasses) |
|
1505 |
ignoreCase:false) |
|
1506 |
]. |
|
1507 |
] |
|
1508 |
] ifFalse:[ |
|
1509 |
implementors := #(). |
|
1510 |
]. |
|
1511 |
||
1512 |
^self implementorsMenu: implementors selector: (selector ? selectedText) |
|
1513 |
||
1514 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1515 |
"Created: / 30-06-2011 / 19:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1516 |
! |
|
1517 |
||
9985 | 1518 |
implementorsMenu: implementors selector: selector |
1519 |
| menu| |
|
1520 |
||
1521 |
menu := Menu new. |
|
10465 | 1522 |
implementors isEmptyOrNil ifTrue:[ |
9985 | 1523 |
menu addItem:(MenuItem label:'No implementors found') disable |
1524 |
] ifFalse:[ |
|
1525 |
menu addItem:(MenuItem |
|
1526 |
label:(selector storeString , (' (all implementors) ') asText allItalic) |
|
1527 |
value:[ |
|
1528 |
self browseMethods:implementors |
|
1529 |
label:'Implementors of ' , selector storeString |
|
1530 |
]). |
|
1531 |
menu addSeparator. |
|
1532 |
implementors do:[:mth | |
|
1533 |
menu |
|
1534 |
addItem:(MenuItem label:(selector storeString |
|
1535 |
, (' in ' , mth containingClass name asText allBold)) |
|
1536 |
value:[ self browseMethod:mth label: 'Implementor of ' , selector storeString ]) |
|
1537 |
] |
|
1538 |
]. |
|
1539 |
^ menu |
|
1540 |
||
1541 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1542 |
"Created: / 14-02-2010 / 19:39:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10465 | 1543 |
"Modified: / 04-08-2011 / 19:05:15 / cg" |
9985 | 1544 |
! |
1545 |
||
10262 | 1546 |
sendersMenu |
1547 |
||
1548 |
| selectorAndSelectedText selector selectedText senders | |
|
1549 |
||
1550 |
selectedText := textView selectionAsString. |
|
1551 |
selectedText size > 0 ifTrue:[ |
|
1552 |
self windowGroup withWaitCursorDo:[ |
|
1553 |
selectorAndSelectedText := self extractSelectorAndSelectedTextFrom: selectedText. |
|
1554 |
selector := selectorAndSelectedText first. |
|
1555 |
selectedText := selectorAndSelectedText second. |
|
1556 |
||
1557 |
(selector notNil and:[selector = selectedText]) ifTrue:[ |
|
1558 |
senders := (SystemBrowser |
|
1559 |
findSendersOfAny:(Array with:selectedText) |
|
1560 |
in:(Smalltalk allClasses) |
|
1561 |
ignoreCase:false) |
|
1562 |
||
1563 |
] ifFalse:[ |
|
1564 |
senders := (SystemBrowser |
|
1565 |
findSendersOfAny:(Array with:selectedText with: selector) |
|
1566 |
in:(Smalltalk allClasses) |
|
1567 |
ignoreCase:false) |
|
1568 |
]. |
|
1569 |
] |
|
1570 |
] ifFalse:[ |
|
1571 |
senders := #(). |
|
1572 |
]. |
|
1573 |
||
1574 |
^self sendersMenu: senders selector: (selector ? selectedText) |
|
1575 |
||
1576 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1577 |
"Created: / 30-06-2011 / 19:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1578 |
! |
|
1579 |
||
9985 | 1580 |
sendersMenu: senders selector: selector |
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1581 |
| menu shownSenderItems numCut| |
9985 | 1582 |
|
10262 | 1583 |
menu := Menu new. |
10465 | 1584 |
senders isEmptyOrNil ifTrue:[ |
9985 | 1585 |
menu addItem:(MenuItem label:'No senders found') disable |
1586 |
] ifFalse:[ |
|
1587 |
menu addItem:(MenuItem |
|
1588 |
label:(selector storeString , (' (all senders)') asText allItalic) |
|
1589 |
value:[ |
|
1590 |
self browseMethods:senders |
|
1591 |
label:'Senders of ' , selector storeString |
|
1592 |
]). |
|
1593 |
menu addSeparator. |
|
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1594 |
shownSenderItems := (senders size > 20) ifTrue:[senders copyTo:20] ifFalse:[senders]. |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1595 |
numCut := senders size - 20. |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1596 |
shownSenderItems do:[:mth | |
9985 | 1597 |
menu |
1598 |
addItem:(MenuItem label:(mth selector storeString |
|
1599 |
, (' in ' , mth containingClass name asText allBold)) |
|
1600 |
value:[ self browseMethod:mth label: 'Sender of ' , selector storeString ]) |
|
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1601 |
]. |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1602 |
numCut > 0 ifTrue:[ |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1603 |
menu addSeparator. |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1604 |
menu addItem:(MenuItem label:('... %1 more senders not shown here' bindWith:numCut)) disable |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1605 |
]. |
9985 | 1606 |
]. |
1607 |
^ menu |
|
1608 |
||
1609 |
"Modified: / 19-10-2008 / 08:17:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1610 |
"Created: / 14-02-2010 / 19:40:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10262 | 1611 |
"Modified: / 07-07-2011 / 14:51:54 / jv" |
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
1612 |
"Modified: / 21-08-2011 / 11:44:00 / cg" |
9985 | 1613 |
! |
1614 |
||
1615 |
servicesMenu |
|
10293 | 1616 |
|menu item anyService| |
1617 |
||
9985 | 1618 |
menu := Menu new. |
10293 | 1619 |
|
1620 |
item := MenuItem label:(resources string:'Show Gutter'). |
|
1621 |
item indication:(self showGutterChannel). |
|
1622 |
menu addItem:item. |
|
1623 |
menu addSeparator. |
|
1624 |
||
1625 |
anyService := false. |
|
1626 |
services do:[:service | |
|
1627 |
|item| |
|
1628 |
||
1629 |
item := MenuItem label:(resources string:service label). |
|
1630 |
item indication:((AspectAdaptor forAspect:#enabled) subject:service). |
|
1631 |
menu addItem:item. |
|
1632 |
anyService := true. |
|
1633 |
]. |
|
1634 |
||
1635 |
anyService ifTrue:[ |
|
1636 |
menu addSeparator. |
|
1637 |
]. |
|
1638 |
||
1639 |
item := MenuItem label:(resources string:'Debug'). |
|
1640 |
item submenuChannel:[ self class debugMenu ]. |
|
1641 |
menu addItem:item. |
|
1642 |
||
1643 |
^ menu |
|
9985 | 1644 |
|
1645 |
"Created: / 07-03-2010 / 14:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1646 |
"Modified: / 06-10-2011 / 14:14:30 / cg" |
9985 | 1647 |
! ! |
1648 |
||
1649 |
!CodeView2 methodsFor:'private'! |
|
1650 |
||
1651 |
codeCompletion |
|
1652 |
|cls |
|
1653 |
"/ crsrPos interval node checkedNode |
|
1654 |
"/ char start stop selectorSoFar matchingSelectors |
|
1655 |
| |
|
1656 |
||
1657 |
||
1658 |
cls := self classHolder value. |
|
1659 |
cls isNil ifTrue:[ |
|
1660 |
self showInfo:'No class'. |
|
1661 |
^ self. |
|
1662 |
]. |
|
1663 |
UserInformation handle:[:ex | |
|
1664 |
self showInfo:(ex messageText). |
|
1665 |
ex proceed. |
|
1666 |
] do:[ |
|
1667 |
self withWaitCursorDo:[ |
|
1668 |
DoWhatIMeanSupport codeCompletionForClass:cls codeView:self. |
|
1669 |
] |
|
1670 |
]. |
|
1671 |
^ self. |
|
1672 |
||
1673 |
"/ |
|
1674 |
"/ interval := self selectedInterval. |
|
1675 |
"/ interval isEmpty ifTrue:[ |
|
1676 |
"/ crsrPos := codeView characterPositionOfCursor - 1. |
|
1677 |
"/ char := codeView characterUnderCursor. |
|
1678 |
"/ [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[ |
|
1679 |
"/ crsrPos := crsrPos - 1. |
|
1680 |
"/ char := codeView characterAtCharacterPosition:crsrPos. |
|
1681 |
"/ ]. |
|
1682 |
"/ interval := crsrPos to:crsrPos. |
|
1683 |
"/ ]. |
|
1684 |
"/ |
|
1685 |
"/ node := self findNodeForInterval:interval allowErrors:true. |
|
1686 |
"/ [node isNil] whileTrue:[ |
|
1687 |
"/ "/ expand to the left ... |
|
1688 |
"/ interval start > 1 ifFalse:[ |
|
1689 |
"/ self showInfo:'No parseNode found'. |
|
1690 |
"/ ^ self. |
|
1691 |
"/ ]. |
|
1692 |
"/ interval start:(interval start - 1). |
|
1693 |
"/ node := self findNodeForInterval:interval allowErrors:true. |
|
1694 |
"/ ]. |
|
1695 |
"/ |
|
1696 |
"/ node isVariable ifTrue:[ |
|
1697 |
"/ self codeCompletionForVariable:node inClass:cls. |
|
1698 |
"/ ^ self. |
|
1699 |
"/ ]. |
|
1700 |
"/ |
|
1701 |
"/ checkedNode := node. |
|
1702 |
"/ [checkedNode notNil] whileTrue:[ |
|
1703 |
"/ checkedNode isMessage ifTrue:[ |
|
1704 |
"/ self codeCompletionForMessage:checkedNode inClass:cls. |
|
1705 |
"/ ^ self |
|
1706 |
"/ ]. |
|
1707 |
"/ checkedNode isMethod ifTrue:[ |
|
1708 |
"/ self codeCompletionForMethod:checkedNode inClass:cls. |
|
1709 |
"/ ^ self. |
|
1710 |
"/ ]. |
|
1711 |
"/ checkedNode := checkedNode parent. |
|
1712 |
"/ ]. |
|
1713 |
"/ |
|
1714 |
"/ self showInfo:'Node is neither variable nor message.'. |
|
1715 |
||
1716 |
"Modified: / 04-07-2006 / 18:48:26 / fm" |
|
1717 |
"Modified: / 20-11-2006 / 12:30:59 / cg" |
|
1718 |
"Modified: / 16-02-2010 / 10:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1719 |
! |
|
1720 |
||
1721 |
reallyModified |
|
1722 |
"check for modified code by comparing the source against |
|
1723 |
the codeViews contents. |
|
1724 |
Thats the true modified value (in case user undid its changes, |
|
1725 |
and the displayed text is actually original" |
|
1726 |
||
1727 |
|modified changedSource originalSource s1 s2| |
|
1728 |
||
1729 |
textView modified ifTrue:[^true]. |
|
1730 |
||
1731 |
"/ higher prio to prevent it from being changed while we convert it (by editing) |
|
1732 |
Processor activeProcess |
|
1733 |
withHigherPriorityDo:[ |
|
1734 |
changedSource := textView contentsAsString asStringCollection. |
|
1735 |
]. |
|
1736 |
changedSource := changedSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded]. |
|
1737 |
changedSource := changedSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]]. |
|
1738 |
[changedSource size > 0 and:[changedSource last isNil]] whileTrue:[ |
|
1739 |
changedSource := changedSource copyWithoutLast:1 |
|
1740 |
]. |
|
1741 |
changedSource := changedSource asString. |
|
1742 |
||
1743 |
originalSource := textView model value ? ''. |
|
1744 |
||
1745 |
originalSource := originalSource asStringCollection. |
|
1746 |
originalSource := originalSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded]. |
|
1747 |
originalSource := originalSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]]. |
|
1748 |
[originalSource size > 0 and:[originalSource last isNil]] whileTrue:[ |
|
1749 |
originalSource := originalSource copyWithoutLast:1 |
|
1750 |
]. |
|
1751 |
||
1752 |
s1 := originalSource asString. |
|
1753 |
s2 := changedSource asString. |
|
1754 |
modified := (s1 ~= s2). |
|
1755 |
||
1756 |
^ modified |
|
1757 |
||
1758 |
"Created: / 06-02-2010 / 19:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1759 |
! |
|
1760 |
||
1761 |
showInfo: message |
|
1762 |
||
1763 |
| app | |
|
1764 |
(app := self topView application) ifNotNil: |
|
1765 |
[(app respondsTo: #showInfo:) ifTrue: |
|
1766 |
[app showInfo: message]]. |
|
1767 |
||
1768 |
"Modified: / 13-02-2010 / 23:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1769 |
! ! |
|
1770 |
||
1771 |
!CodeView2 methodsFor:'private-accessing'! |
|
1772 |
||
1773 |
gutterView |
|
1774 |
||
1775 |
^gutterView |
|
1776 |
||
1777 |
"Created: / 14-02-2010 / 15:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1778 |
! |
|
1779 |
||
1780 |
syntaxElementSelection |
|
1781 |
^ syntaxElementSelection |
|
1782 |
! |
|
1783 |
||
1784 |
syntaxElementSelection:something |
|
1785 |
syntaxElementSelection := something. |
|
1786 |
! |
|
1787 |
||
1788 |
syntaxElements |
|
1789 |
^ syntaxElements |
|
1790 |
! |
|
1791 |
||
1792 |
syntaxElements:something |
|
1793 |
syntaxElements := something. |
|
1794 |
! |
|
1795 |
||
1796 |
textView |
|
1797 |
||
1798 |
^textView |
|
1799 |
||
1800 |
"Created: / 14-02-2010 / 15:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1801 |
! |
|
1802 |
||
1803 |
textViewScroller |
|
1804 |
||
1805 |
^textViewScroller |
|
1806 |
||
1807 |
"Created: / 14-02-2010 / 15:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1808 |
! ! |
|
1809 |
||
10409 | 1810 |
!CodeView2 methodsFor:'realization'! |
1811 |
||
1812 |
postRealize |
|
1813 |
||
1814 |
self initializeServices |
|
1815 |
||
1816 |
"Created: / 27-07-2011 / 11:36:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1817 |
! ! |
|
1818 |
||
9985 | 1819 |
!CodeView2 methodsFor:'services'! |
1820 |
||
1821 |
registerService: aCodeViewService |
|
1822 |
||
1823 |
services add: aCodeViewService. |
|
1824 |
aCodeViewService registerIn: self |
|
1825 |
||
1826 |
"Created: / 06-03-2010 / 19:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1827 |
! |
|
1828 |
||
1829 |
underService: aCodeViewService |
|
1830 |
||
1831 |
services remove: aCodeViewService ifAbsent:[^self]. |
|
1832 |
aCodeViewService unregister. |
|
1833 |
||
1834 |
"Created: / 06-03-2010 / 19:21:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1835 |
! ! |
|
1836 |
||
1837 |
!CodeView2 methodsFor:'testing'! |
|
1838 |
||
10722 | 1839 |
isCodeView2 |
1840 |
||
1841 |
^true |
|
1842 |
||
1843 |
"Created: / 20-07-2010 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1844 |
! |
|
1845 |
||
9985 | 1846 |
isTextView |
1847 |
||
1848 |
^true |
|
1849 |
||
1850 |
"Created: / 14-02-2010 / 22:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1851 |
! ! |
|
1852 |
||
1853 |
!CodeView2::GutterView methodsFor:'accessing'! |
|
1854 |
||
1855 |
setTextView: aTextView |
|
1856 |
||
1857 |
self assert: textView isNil message:'Attempting to set textView twice'. |
|
1858 |
textView := aTextView. |
|
1859 |
||
10577 | 1860 |
"/ self backgroundPaint: textView backgroundPaint darkened lighter. |
1861 |
self viewBackground: (View defaultBackgroundColor). "/ textView backgroundPaint darkened lighter. |
|
9985 | 1862 |
self paint: textView paint. |
1863 |
self font: textView font. |
|
1864 |
||
1865 |
"Created: / 02-09-2009 / 21:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1866 |
"Modified: / 14-12-2009 / 15:09:29 / Jindra <a>" |
|
1867 |
"Modified: / 09-02-2010 / 20:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10577 | 1868 |
"Modified: / 17-08-2011 / 15:15:09 / cg" |
9985 | 1869 |
! |
1870 |
||
1871 |
setTextViewScroller:aScr |
|
1872 |
textViewScroller := aScr. |
|
1873 |
||
1874 |
"Created: / 07-12-2009 / 22:36:31 / Jindra <a>" |
|
1875 |
! ! |
|
1876 |
||
1877 |
!CodeView2::GutterView methodsFor:'accessing-dimensions'! |
|
1878 |
||
1879 |
padding |
|
1880 |
||
1881 |
^self paddingLeft + self paddingRight |
|
1882 |
+ (widthAnnotations ? 0) |
|
1883 |
+ (widthDiffInfo ? 0) |
|
1884 |
||
1885 |
"Created: / 14-02-2010 / 22:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1886 |
"Modified: / 16-06-2011 / 14:01:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1887 |
! |
|
1888 |
||
1889 |
paddingLeft |
|
1890 |
||
1891 |
^0"px" |
|
1892 |
||
1893 |
"Created: / 14-02-2010 / 22:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1894 |
"Modified: / 16-06-2011 / 13:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1895 |
! |
|
1896 |
||
1897 |
paddingRight |
|
1898 |
||
1899 |
^0"px" |
|
1900 |
||
1901 |
"Created: / 14-02-2010 / 22:27:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1902 |
"Modified: / 16-06-2011 / 13:47:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1903 |
! |
|
1904 |
||
1905 |
preferredExtent |
|
1906 |
||
1907 |
| w h | |
|
1908 |
||
1909 |
explicitExtent ifNotNil:[^explicitExtent]. |
|
1910 |
preferredExtent ifNotNil:[^preferredExtent]. |
|
1911 |
||
1912 |
w := (self font widthOf:'00') + self padding. |
|
1913 |
h := textView ifNotNil:[textView height] ifNil:[self font height * 12]. |
|
1914 |
||
1915 |
^preferredExtent := w @ h |
|
1916 |
||
1917 |
"Modified: / 16-06-2011 / 14:03:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1918 |
! ! |
|
1919 |
||
1920 |
!CodeView2::GutterView methodsFor:'change & update'! |
|
1921 |
||
1922 |
update:something with:aParameter from:changedObject |
|
1923 |
self shown ifFalse:[^self]. |
|
1924 |
||
10326 | 1925 |
(changedObject == textView) ifTrue:[ |
1926 |
(something == #sizeOfContents) ifTrue:[ |
|
1927 |
"/ cg: with that test, it does not update when the text becomes smaller... |
|
1928 |
"/ (firstLineShown ~= textView firstLineShown |
|
1929 |
"/ or:[lastLineShown ~= (textView lastLineShown - 1)]) ifTrue:[ |
|
10312 | 1930 |
self invalidate. |
1931 |
^self. |
|
10326 | 1932 |
"/ ] |
1933 |
]. |
|
10312 | 1934 |
]. |
9985 | 1935 |
|
1936 |
"/ changedObject == someOfMyValueHolders ifTrue:[ |
|
1937 |
"/ self doSomethingApropriate. |
|
1938 |
"/ ^ self. |
|
1939 |
"/ ]. |
|
1940 |
super update:something with:aParameter from:changedObject |
|
1941 |
||
10312 | 1942 |
"Modified: / 12-07-2011 / 17:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10326 | 1943 |
"Modified (format): / 15-07-2011 / 20:14:04 / cg" |
9985 | 1944 |
! ! |
1945 |
||
1946 |
!CodeView2::GutterView methodsFor:'event handling'! |
|
1947 |
||
1948 |
buttonPress: btn x: x y: y |
|
1949 |
||
1950 |
"Do not allow clicking on line numbers..." |
|
1951 |
||
1952 |
((x < (self paddingLeft + widthAnnotations)) or: |
|
1953 |
[x > (self width - self paddingRight - widthDiffInfo)]) |
|
1954 |
ifTrue:[ |
|
1955 |
(codeView buttonPress: btn x:x y:y in: self) |
|
1956 |
ifFalse:[super buttonPress: btn x: x y: y] |
|
1957 |
] ifFalse:[ |
|
1958 |
super buttonPress: btn x: x y: y |
|
1959 |
] |
|
1960 |
||
1961 |
"Created: / 17-06-2011 / 13:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1962 |
! ! |
|
1963 |
||
1964 |
!CodeView2::GutterView methodsFor:'initialization'! |
|
1965 |
||
1966 |
initialize |
|
1967 |
||
1968 |
super initialize. |
|
1969 |
widthAnnotations := 16. |
|
1970 |
widthDiffInfo := 5. |
|
1971 |
||
1972 |
"Created: / 16-06-2011 / 13:47:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1973 |
! |
|
1974 |
||
1975 |
setCodeView: aCodeView2 |
|
1976 |
||
1977 |
codeView := aCodeView2. |
|
1978 |
codeView addDependent: self. |
|
1979 |
textView := aCodeView2 textView. |
|
1980 |
textView addDependent: self. |
|
1981 |
textViewScroller := aCodeView2 textViewScroller. |
|
10577 | 1982 |
"/ self backgroundPaint: (textView viewBackground "backgroundPaint" blendWith: (Color gray:80)). |
1983 |
self viewBackground: (View defaultBackgroundColor). |
|
9985 | 1984 |
|
1985 |
"Created: / 14-02-2010 / 15:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1986 |
"Modified: / 17-06-2011 / 12:43:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10577 | 1987 |
"Modified: / 17-08-2011 / 15:15:55 / cg" |
9985 | 1988 |
! ! |
1989 |
||
1990 |
!CodeView2::GutterView methodsFor:'queries'! |
|
1991 |
||
1992 |
displayedString: line |
|
1993 |
"get text to display in gutter for specified list line number" |
|
1994 |
||
1995 |
^(line asString). |
|
1996 |
||
1997 |
"Created: / 14-12-2009 / 13:37:47 / Jindra <a>" |
|
1998 |
! |
|
1999 |
||
2000 |
lineColor:line |
|
2001 |
"return special color for given line if required, nil otherwise" |
|
2002 |
"used only if lineFont return nil" |
|
2003 |
||
2004 |
^nil |
|
2005 |
||
2006 |
"Created: / 14-12-2009 / 15:01:31 / Jindra <a>" |
|
2007 |
! |
|
2008 |
||
2009 |
lineDisplayable:line |
|
2010 |
"true if this list line can be displayed" |
|
2011 |
^(textView listLineIsVisible:line) |
|
2012 |
||
2013 |
"Created: / 14-12-2009 / 13:38:23 / Jindra <a>" |
|
2014 |
! |
|
2015 |
||
2016 |
lineFont:line |
|
2017 |
"return special font for given line if required, nil otherwise" |
|
2018 |
||
2019 |
^nil |
|
2020 |
||
2021 |
"Created: / 14-12-2009 / 14:40:17 / Jindra <a>" |
|
2022 |
! |
|
2023 |
||
2024 |
yOfTextViewLine:line |
|
2025 |
^(textView yOfLine:line) + 1 |
|
2026 |
||
2027 |
"Created: / 14-12-2009 / 13:35:07 / Jindra <a>" |
|
2028 |
! ! |
|
2029 |
||
2030 |
!CodeView2::GutterView methodsFor:'redrawing'! |
|
2031 |
||
2032 |
redrawBackgroundX:x y:y width:w height:h |
|
2033 |
"redraws gutter background" |
|
2034 |
||
2035 |
"background is filled with background color" |
|
2036 |
self |
|
2037 |
fillRectangleX:x |
|
2038 |
y:y |
|
2039 |
width:w |
|
2040 |
height:h |
|
10577 | 2041 |
color: self viewBackground "backgroundPaint". |
9985 | 2042 |
|
2043 |
"separator line is drawn with foreground color" |
|
2044 |
self |
|
2045 |
displayLineFromX:(self width - 2) |
|
2046 |
y:y |
|
2047 |
toX:(self width - 2) |
|
2048 |
y:(y+h). |
|
2049 |
||
2050 |
"Created: / 14-12-2009 / 13:15:53 / Jindra <a>" |
|
2051 |
"Modified: / 14-12-2009 / 15:09:54 / Jindra <a>" |
|
10577 | 2052 |
"Modified: / 17-08-2011 / 15:12:47 / cg" |
9985 | 2053 |
! |
2054 |
||
2055 |
redrawLine:line |
|
2056 |
||
2057 |
^self redrawLine:line cleared: false. |
|
2058 |
||
2059 |
"Modified: / 17-06-2011 / 14:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2060 |
! |
|
2061 |
||
2062 |
redrawLine:line cleared: cleared |
|
2063 |
"redraws specified line. Returns width of drawn object. Color of drawn objects should be taken from lineFont, lineColor" |
|
2064 |
||
2065 |
|lineString y0 textW requiredW oldFont newFont oldColor newColor| |
|
2066 |
||
2067 |
lineString := self displayedString:line. |
|
2068 |
textW := (lineString widthOn:self). |
|
2069 |
requiredW := textW + self padding. |
|
2070 |
||
2071 |
oldFont := self font. |
|
2072 |
oldColor := self paint. |
|
2073 |
newFont := self lineFont:line. |
|
2074 |
newFont |
|
2075 |
ifNotNil:[ self font:newFont. ] |
|
2076 |
ifNil:[ |
|
2077 |
newColor := self lineColor:line. |
|
2078 |
newColor ifNotNil:[ self paint:newColor ]. |
|
2079 |
]. |
|
2080 |
||
2081 |
y0 := (self yOfTextViewLine:line) + ((self font) ascentOn:device). |
|
2082 |
||
2083 |
cleared ifFalse:[ |
|
2084 |
self clearRectangleX:0 y:y0 - font height width: self width - 2 height: font height + font descent. |
|
2085 |
]. |
|
2086 |
||
2087 |
"Let the services to draw annotations and other stuff" |
|
2088 |
codeView |
|
2089 |
drawLine:line in: self |
|
2090 |
atX: self paddingLeft y:y0 width: widthAnnotations height: font height |
|
2091 |
from:nil to:nil with:self paint and: self backgroundColor. |
|
2092 |
||
2093 |
self |
|
2094 |
displayString:lineString |
|
2095 |
x:(self width - textW - self paddingRight - widthDiffInfo) |
|
2096 |
y:y0. |
|
2097 |
newFont |
|
2098 |
ifNotNil:[ |
|
2099 |
self font:oldFont. |
|
2100 |
self paint:oldColor |
|
2101 |
] |
|
2102 |
ifNil:[ newColor ifNotNil:[ self paint:oldColor ]. ]. |
|
2103 |
^ requiredW. |
|
2104 |
||
2105 |
"Modified: / 14-12-2009 / 15:30:44 / Jindra <a>" |
|
2106 |
"Created: / 17-06-2011 / 14:11:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2107 |
! |
|
2108 |
||
10224 | 2109 |
redrawLinesFrom:start |
2110 |
||
10312 | 2111 |
start to: (textView lastLineShown - 1 min: textView list size) do:[:line| |
10224 | 2112 |
self redrawLine:line cleared: false. |
2113 |
] |
|
2114 |
||
2115 |
"Created: / 06-07-2011 / 17:25:36 / jv" |
|
10312 | 2116 |
"Modified: / 12-07-2011 / 17:14:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 2117 |
! |
2118 |
||
9985 | 2119 |
redrawX:x y:y width:w height:h |
10312 | 2120 |
| requiredW currentW | |
9985 | 2121 |
|
2122 |
self redrawBackgroundX:x y:y width:w height:h. |
|
2123 |
||
10312 | 2124 |
firstLineShown := textView firstLineShown. |
2125 |
lastLineShown := textView lastLineShown - 1 min: textView list size. |
|
9985 | 2126 |
|
2127 |
currentW := requiredW := self width. |
|
10312 | 2128 |
firstLineShown to:lastLineShown do: |
9985 | 2129 |
[:line | |
2130 |
requiredW := requiredW max: (self redrawLine:line cleared: true)]. |
|
2131 |
||
2132 |
(requiredW > self width) ifTrue:[ |
|
2133 |
self corner:(requiredW @ 1.0). |
|
2134 |
textViewScroller origin:(requiredW @ 0.0) corner:(1.0 @ 1.0). |
|
2135 |
self invalidate. |
|
2136 |
]. |
|
2137 |
||
2138 |
"Created: / 03-09-2009 / 08:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2139 |
"Modified: / 14-12-2009 / 14:13:14 / Jindra <a>" |
|
10312 | 2140 |
"Modified (format): / 12-07-2011 / 17:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2141 |
! ! |
2142 |
||
2143 |
!CodeView2::TextView methodsFor:'accessing'! |
|
2144 |
||
2145 |
changedDiffText |
|
2146 |
^ changedDiffText |
|
2147 |
! |
|
2148 |
||
2149 |
changedDiffText:something |
|
2150 |
changedDiffText := something. |
|
2151 |
! |
|
2152 |
||
2153 |
changedLines |
|
2154 |
^ changedLines |
|
2155 |
||
2156 |
"Created: / 26-04-2010 / 20:30:32 / Jakub <zelenja7@fel.cvut.cz>" |
|
2157 |
"Modified: / 26-04-2010 / 21:48:13 / Jakub <zelenja7@fel.cvut.cz>" |
|
2158 |
! |
|
2159 |
||
2160 |
changedLines:something |
|
2161 |
changedLines := something. |
|
2162 |
||
2163 |
"Created: / 26-04-2010 / 20:30:19 / Jakub <zelenja7@fel.cvut.cz>" |
|
2164 |
"Modified: / 02-05-2010 / 19:13:32 / Jakub <zelenja7@fel.cvut.cz>" |
|
2165 |
! |
|
2166 |
||
2167 |
deletedLines |
|
2168 |
^ deletedLines |
|
2169 |
||
2170 |
"Modified: / 26-04-2010 / 21:48:23 / Jakub <zelenja7@fel.cvut.cz>" |
|
2171 |
! |
|
2172 |
||
2173 |
deletedLines:something |
|
2174 |
deletedLines:=something. |
|
2175 |
||
2176 |
"Modified: / 26-04-2010 / 21:48:54 / Jakub <zelenja7@fel.cvut.cz>" |
|
2177 |
! |
|
2178 |
||
2179 |
diffMode |
|
2180 |
^ diffMode |
|
2181 |
! |
|
2182 |
||
2183 |
diffMode:something |
|
2184 |
diffMode := something. |
|
2185 |
! |
|
2186 |
||
2187 |
emptyLines |
|
2188 |
^ emptyLines |
|
2189 |
! |
|
2190 |
||
2191 |
emptyLines:something |
|
2192 |
emptyLines := something. |
|
2193 |
! |
|
2194 |
||
2195 |
insertedLines |
|
2196 |
^ insertedLines |
|
2197 |
||
2198 |
"Modified: / 26-04-2010 / 21:48:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
2199 |
! |
|
2200 |
||
2201 |
insertedLines:something |
|
2202 |
insertedLines:=something. |
|
2203 |
||
2204 |
"Modified: / 26-04-2010 / 21:48:59 / Jakub <zelenja7@fel.cvut.cz>" |
|
2205 |
! |
|
2206 |
||
10245 | 2207 |
modifiedChannel: aValueHolder |
2208 |
||
2209 |
super modifiedChannel: aValueHolder |
|
2210 |
||
2211 |
"Created: / 07-07-2011 / 12:27:11 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
2212 |
! |
|
2213 |
||
9985 | 2214 |
originDiffText |
2215 |
^ originDiffText |
|
2216 |
! |
|
2217 |
||
2218 |
originDiffText:something |
|
2219 |
originDiffText := something. |
|
2220 |
! ! |
|
2221 |
||
2222 |
!CodeView2::TextView methodsFor:'accessing - colors'! |
|
2223 |
||
2224 |
colorChanged |
|
2225 |
^ Color redByte:240 greenByte: 192 blueByte: 192 |
|
2226 |
||
2227 |
"Modified: / 24-06-2010 / 14:05:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2228 |
! |
|
2229 |
||
2230 |
colorDeleted |
|
2231 |
||
2232 |
^ self colorInserted. |
|
2233 |
||
2234 |
"/^ Color pink |
|
2235 |
||
2236 |
"Modified: / 24-06-2010 / 14:16:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2237 |
! |
|
2238 |
||
2239 |
colorInserted |
|
2240 |
^ Color redByte: 239 greenByte: 225 blueByte: 152 |
|
2241 |
||
2242 |
"Modified: / 24-06-2010 / 14:13:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2243 |
! ! |
|
2244 |
||
2245 |
!CodeView2::TextView methodsFor:'actions'! |
|
2246 |
||
2247 |
cancel |
|
2248 |
||
2249 |
self halt. |
|
2250 |
||
2251 |
"Created: / 08-02-2010 / 09:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2252 |
! ! |
|
2253 |
||
2254 |
!CodeView2::TextView methodsFor:'drawing'! |
|
2255 |
||
2256 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
|
2257 |
||
2258 |
super |
|
2259 |
drawFromVisibleLine:startVisLineNr |
|
2260 |
to:endVisLineNr |
|
2261 |
with:fg |
|
2262 |
and:bg. |
|
2263 |
self redrawLines. |
|
2264 |
||
2265 |
"Created: / 05-04-2010 / 12:08:38 / Jakub <zelenja7@fel.cvut.cz>" |
|
2266 |
"Modified: / 02-05-2010 / 18:46:04 / Jakub <zelenja7@fel.cvut.cz>" |
|
2267 |
! |
|
2268 |
||
2269 |
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg |
|
2270 |
||
2271 |
super |
|
2272 |
drawLine:line |
|
2273 |
fromX:x |
|
2274 |
inVisible:visLineNr |
|
2275 |
with:fg |
|
2276 |
and:bg. |
|
2277 |
self redrawLines. |
|
2278 |
||
2279 |
"Created: / 05-04-2010 / 12:07:07 / Jakub <zelenja7@fel.cvut.cz>" |
|
2280 |
"Modified: / 02-05-2010 / 18:46:00 / Jakub <zelenja7@fel.cvut.cz>" |
|
2281 |
! |
|
2282 |
||
2283 |
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg |
|
2284 |
||
2285 |
super |
|
2286 |
drawLine:lineStringArg |
|
2287 |
inVisible:visLineNr |
|
2288 |
col:col |
|
2289 |
with:fg |
|
2290 |
and:bg. |
|
2291 |
self redrawLines. |
|
2292 |
||
2293 |
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>" |
|
2294 |
"Modified: / 02-05-2010 / 18:45:56 / Jakub <zelenja7@fel.cvut.cz>" |
|
2295 |
! |
|
2296 |
||
2297 |
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg |
|
2298 |
||
2299 |
super |
|
2300 |
drawLine:lineStringArg |
|
2301 |
inVisible:visLineNr |
|
2302 |
from:startCol |
|
2303 |
to:endColOrNil |
|
2304 |
with:fg |
|
2305 |
and:bg. |
|
2306 |
self redrawLines. |
|
2307 |
||
2308 |
"Created: / 05-04-2010 / 11:54:54 / Jakub <zelenja7@fel.cvut.cz>" |
|
2309 |
"Modified: / 02-05-2010 / 18:45:52 / Jakub <zelenja7@fel.cvut.cz>" |
|
2310 |
! |
|
2311 |
||
2312 |
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg |
|
2313 |
||
2314 |
super |
|
2315 |
drawLine:lineString |
|
2316 |
inVisible:visLineNr |
|
2317 |
from:startCol |
|
2318 |
with:fg |
|
2319 |
and:bg. |
|
2320 |
self redrawLines. |
|
2321 |
||
2322 |
"Created: / 05-04-2010 / 11:54:26 / Jakub <zelenja7@fel.cvut.cz>" |
|
2323 |
"Modified: / 02-05-2010 / 18:45:48 / Jakub <zelenja7@fel.cvut.cz>" |
|
2324 |
! |
|
2325 |
||
2326 |
drawVisibleLine:visLineNr with:fg and:bg |
|
2327 |
||
2328 |
super |
|
2329 |
drawVisibleLine:visLineNr |
|
2330 |
with:fg |
|
2331 |
and:bg. |
|
2332 |
self redrawLines. |
|
2333 |
||
2334 |
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>" |
|
2335 |
"Modified: / 02-05-2010 / 18:45:44 / Jakub <zelenja7@fel.cvut.cz>" |
|
2336 |
! |
|
2337 |
||
2338 |
redraw |
|
2339 |
"/ thisContext fullPrintAll. |
|
2340 |
super redraw. |
|
2341 |
||
2342 |
"Created: / 30-06-2011 / 11:04:32 / cg" |
|
2343 |
! |
|
2344 |
||
2345 |
redrawLines |
|
2346 |
|i pom| |
|
2347 |
||
2348 |
diffMode ifFalse:[^self]. |
|
2349 |
||
2350 |
pom := self hasSelection. |
|
2351 |
(pom) ifTrue:[ ^ self. ]. |
|
2352 |
i := 1. |
|
2353 |
[ |
|
2354 |
i <= (deletedLines size) |
|
2355 |
] whileTrue:[ |
|
2356 |
((deletedLines at:i) > 0) ifTrue:[ |
|
2357 |
super |
|
2358 |
drawVisibleLine:(deletedLines at:i) |
|
2359 |
with:fgColor |
|
2360 |
and:self colorDeleted. |
|
2361 |
]. |
|
2362 |
i := i + 1. |
|
2363 |
]. |
|
2364 |
i := 1. |
|
2365 |
[ |
|
2366 |
i <= (insertedLines size) |
|
2367 |
] whileTrue:[ |
|
2368 |
((insertedLines at:i) > 0) ifTrue:[ |
|
2369 |
super |
|
2370 |
drawVisibleLine:(insertedLines at:i) |
|
2371 |
with:fgColor |
|
2372 |
and:self colorInserted. |
|
2373 |
]. |
|
2374 |
i := i + 1. |
|
2375 |
]. |
|
2376 |
i := 1. |
|
2377 |
[ |
|
2378 |
i <= (changedLines size) |
|
2379 |
] whileTrue:[ |
|
2380 |
((changedLines at:i) > 0) ifTrue:[ |
|
2381 |
super |
|
2382 |
drawVisibleLine:(changedLines at:i) |
|
2383 |
with:fgColor |
|
2384 |
and:self colorChanged. |
|
2385 |
]. |
|
2386 |
i := i + 1. |
|
2387 |
]. |
|
2388 |
||
2389 |
"Created: / 26-04-2010 / 21:04:31 / Jakub <zelenja7@fel.cvut.cz>" |
|
2390 |
"Modified: / 22-06-2010 / 23:28:30 / Jakub <zelenja7@fel.cvut.cz>" |
|
2391 |
"Modified: / 08-04-2011 / 20:52:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2392 |
! ! |
|
2393 |
||
2394 |
!CodeView2::TextView methodsFor:'editing'! |
|
2395 |
||
2396 |
contentsChanged |
|
2397 |
super contentsChanged. |
|
2398 |
" |
|
2399 |
codeView diffMode ifTrue:[ |
|
2400 |
changedDiffText ifTrue:[ |
|
2401 |
codeView recomputeDiff:self. |
|
2402 |
] ifFalse:[ |
|
2403 |
changedDiffText := true. |
|
2404 |
]. |
|
2405 |
] |
|
2406 |
" |
|
2407 |
||
2408 |
"Created: / 22-06-2010 / 23:13:24 / Jakub <zelenja7@fel.cvut.cz>" |
|
2409 |
"Modified: / 01-08-2010 / 20:33:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2410 |
! |
|
2411 |
||
2412 |
getNewOriginText |
|
2413 |
|i size pole pom text helperText| |
|
2414 |
||
2415 |
i := 1. |
|
2416 |
pole := list. |
|
2417 |
size := list size. |
|
2418 |
text:=''. |
|
2419 |
emptyLines ifNil:[emptyLines := #()]. |
|
2420 |
[ i <= size ] whileTrue:[ |
|
2421 |
pom := emptyLines indexOf:i. |
|
2422 |
(pom = 0) ifFalse:[ |
|
2423 |
helperText := pole at:i. |
|
2424 |
(helperText = '') ifFalse:[ |
|
2425 |
(helperText isNil)ifTrue:[helperText:='']. |
|
2426 |
helperText:=helperText,Character cr. |
|
2427 |
text := text asString , helperText asString. |
|
2428 |
]. |
|
2429 |
] ifTrue:[ |
|
2430 |
helperText := pole at:i. |
|
2431 |
(helperText isNil)ifTrue:[helperText:='']. |
|
2432 |
helperText:=helperText,Character cr. |
|
2433 |
text := text asString , helperText asString. |
|
2434 |
]. |
|
2435 |
i:=i+1. |
|
2436 |
]. |
|
2437 |
^text |
|
2438 |
||
2439 |
"Created: / 22-06-2010 / 22:33:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
2440 |
"Modified: / 24-06-2010 / 14:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2441 |
! ! |
|
2442 |
||
2443 |
!CodeView2::TextView methodsFor:'editing-basic'! |
|
2444 |
||
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2445 |
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2446 |
"delete characters from startCol to endCol in line lineNr" |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2447 |
|
10731 | 2448 |
super basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol. |
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2449 |
self notifyLinesModifiedFrom: lineNr to: lineNr. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2450 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2451 |
"Created: / 16-09-2011 / 15:13:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2452 |
! |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2453 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2454 |
basicDeleteFromLine:startLineNr toLine:endLineNr |
10728 | 2455 |
|
2456 |
super basicDeleteFromLine:startLineNr toLine:endLineNr. |
|
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2457 |
self notifyLinesDeletedFrom:startLineNr to:endLineNr. |
9985 | 2458 |
|
2459 |
"Created: / 28-06-2011 / 09:09:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2460 |
! |
|
2461 |
||
2462 |
basicDeleteLineWithoutRedraw:lineNr |
|
2463 |
||
10728 | 2464 |
super basicDeleteLineWithoutRedraw:lineNr. |
2465 |
self notifyLinesDeletedFrom: lineNr to: lineNr. |
|
9985 | 2466 |
|
2467 |
"Created: / 28-06-2011 / 09:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2468 |
! |
|
2469 |
||
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2470 |
basicInsert:aCharacter atLine:lineNr col:colNr |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2471 |
"insert a single character at lineNr/colNr; |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2472 |
set emphasis to character at current position" |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2473 |
|
10728 | 2474 |
super basicInsert:aCharacter atLine:lineNr col:colNr. |
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2475 |
self notifyLinesModifiedFrom: lineNr to: lineNr. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2476 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2477 |
"Created: / 16-09-2011 / 15:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2478 |
! |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2479 |
|
9985 | 2480 |
basicMergeLine:lineNr removeBlanks:removeBlanks |
2481 |
||
10728 | 2482 |
super basicMergeLine:lineNr removeBlanks:removeBlanks. |
9985 | 2483 |
self notifyLinesDeletedFrom: lineNr + 1 to: lineNr + 1. |
2484 |
||
2485 |
"Created: / 28-06-2011 / 09:13:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2486 |
! |
|
2487 |
||
2488 |
basicSplitLine:lineNr before:colNr |
|
2489 |
||
10728 | 2490 |
super basicSplitLine:lineNr before:colNr. |
2491 |
self notifyLinesInsertedFrom: lineNr +1 to: lineNr + 1. |
|
9985 | 2492 |
|
2493 |
"Created: / 28-06-2011 / 09:14:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2494 |
! ! |
|
2495 |
||
2496 |
!CodeView2::TextView methodsFor:'event handling'! |
|
2497 |
||
2498 |
buttonMotion:button x:x y:y |
|
2499 |
||
2500 |
(codeView buttonMotion:button x:x y:y in: self) |
|
2501 |
ifFalse:[super buttonMotion:button x:x y:y]. |
|
2502 |
||
2503 |
"Created: / 14-02-2010 / 16:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2504 |
"Modified: / 06-03-2010 / 20:10:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2505 |
! |
|
2506 |
||
2507 |
buttonPress: button x: x y: y |
|
2508 |
| ctrlDown | |
|
2509 |
||
2510 |
(codeView buttonPress:button x:x y:y in: self) |
|
2511 |
ifFalse:[super buttonPress:button x:x y:y]. |
|
2512 |
" |
|
2513 |
((ctrlDown := self sensor ctrlDown) and: [ codeView syntaxElementSelection notNil]) |
|
2514 |
ifTrue: [codeView buttonPressInTextView: button x:x y:y ctrlDown: ctrlDown]. |
|
2515 |
super |
|
2516 |
buttonPress: button |
|
2517 |
x: x |
|
2518 |
y: y |
|
2519 |
" |
|
2520 |
||
2521 |
"Created: / 14-02-2010 / 18:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2522 |
"Modified: / 06-03-2010 / 20:37:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2523 |
! |
|
2524 |
||
2525 |
exposeX:x y:y width:w height:h |
|
2526 |
super |
|
2527 |
exposeX:x |
|
2528 |
y:y |
|
2529 |
width:w |
|
2530 |
height:h. |
|
2531 |
self redrawLines. |
|
2532 |
||
2533 |
"Created: / 05-04-2010 / 10:07:50 / Jakub <zelenja7@fel.cvut.cz>" |
|
2534 |
"Modified: / 02-05-2010 / 18:41:07 / Jakub <zelenja7@fel.cvut.cz>" |
|
2535 |
! |
|
2536 |
||
2537 |
keyPress:key x:x y:y |
|
2538 |
(codeView keyPress:key x:x y:y in: self) |
|
2539 |
ifFalse:[super keyPress:key x:x y:y]. |
|
2540 |
||
2541 |
"Modified: / 06-03-2010 / 20:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2542 |
"Modified: / 05-04-2010 / 09:55:52 / Jakub <zelenja7@fel.cvut.cz>" |
|
2543 |
! |
|
2544 |
||
2545 |
keyRelease: key x: x y: y |
|
2546 |
||
2547 |
(codeView keyRelease:key x:x y:y in: self) |
|
2548 |
ifFalse:[super keyRelease:key x:x y:y]. |
|
2549 |
" |
|
2550 |
(key = #Control_L) ifTrue: |
|
2551 |
[ codeView highlightClear. self redraw ]. |
|
2552 |
||
2553 |
^ super |
|
2554 |
keyRelease: key |
|
2555 |
x: x |
|
2556 |
y: y |
|
2557 |
" |
|
2558 |
||
2559 |
"Created: / 14-02-2010 / 16:38:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2560 |
"Modified: / 06-03-2010 / 21:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2561 |
! ! |
|
2562 |
||
2563 |
!CodeView2::TextView methodsFor:'initialization'! |
|
2564 |
||
2565 |
initialize |
|
2566 |
||
2567 |
super initialize. |
|
2568 |
||
2569 |
changedDiffText := true. |
|
2570 |
diffMode := false. |
|
10224 | 2571 |
suppressNotifications := false. |
10523 | 2572 |
autoIndent := UserPreferences current codeView2AutoIndent. |
9985 | 2573 |
|
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
2574 |
self enableMotionEvents. |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
2575 |
|
9985 | 2576 |
"Created: / 23-06-2010 / 17:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 2577 |
"Modified: / 06-07-2011 / 17:46:31 / jv" |
10523 | 2578 |
"Modified: / 07-08-2011 / 12:58:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
2579 |
"Modified: / 21-08-2011 / 10:09:29 / cg" |
9985 | 2580 |
! |
2581 |
||
2582 |
setCodeView: aCodeView2 |
|
2583 |
||
2584 |
codeView := aCodeView2. |
|
2585 |
codeView addDependent: self. |
|
2586 |
gutterView := aCodeView2 gutterView. |
|
2587 |
||
2588 |
"Created: / 14-02-2010 / 15:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2589 |
"Modified: / 17-06-2011 / 12:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2590 |
! |
|
2591 |
||
2592 |
setGutterView: aGutterView |
|
2593 |
||
2594 |
self assert: gutterView isNil message:'Attempting to set gutterView twice'. |
|
2595 |
gutterView := aGutterView. |
|
2596 |
gutterView setTextView: self. |
|
2597 |
||
2598 |
"Created: / 02-09-2009 / 21:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2599 |
! ! |
|
2600 |
||
2601 |
!CodeView2::TextView methodsFor:'menu & menu actions'! |
|
2602 |
||
2603 |
editMenu |
|
2604 |
||
2605 |
^codeView editMenu |
|
2606 |
||
2607 |
"Created: / 14-02-2010 / 15:49:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2608 |
! ! |
|
2609 |
||
2610 |
!CodeView2::TextView methodsFor:'notification'! |
|
2611 |
||
2612 |
notifyLinesDeletedFrom: startLine to: endLine |
|
2613 |
||
10224 | 2614 |
suppressNotifications ifTrue:[^self]. |
2615 |
codeView linesDeletedFrom: startLine to: endLine. |
|
2616 |
suppressNotifications := true. |
|
2617 |
||
9985 | 2618 |
"Created: / 28-06-2011 / 09:12:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 2619 |
"Modified: / 06-07-2011 / 17:47:05 / jv" |
9985 | 2620 |
! |
2621 |
||
2622 |
notifyLinesInsertedFrom: startLine to: endLine |
|
2623 |
||
10224 | 2624 |
suppressNotifications ifTrue:[^self]. |
2625 |
codeView linesInsertedFrom: startLine to: endLine. |
|
2626 |
suppressNotifications := true. |
|
2627 |
||
9985 | 2628 |
"Created: / 28-06-2011 / 09:12:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 2629 |
"Modified: / 06-07-2011 / 17:47:20 / jv" |
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2630 |
! |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2631 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2632 |
notifyLinesModifiedFrom: startLine to: endLine |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2633 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2634 |
suppressNotifications ifTrue:[^self]. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2635 |
codeView linesModifiedFrom: startLine to: endLine. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2636 |
suppressNotifications := true. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2637 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2638 |
"Modified: / 06-07-2011 / 17:47:20 / jv" |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
2639 |
"Created: / 16-09-2011 / 15:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2640 |
! ! |
2641 |
||
2642 |
!CodeView2::TextView methodsFor:'private'! |
|
2643 |
||
2644 |
superEditMenu |
|
2645 |
||
2646 |
^super editMenu |
|
2647 |
||
2648 |
"Created: / 14-02-2010 / 15:48:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2649 |
! ! |
|
2650 |
||
2651 |
!CodeView2::TextView methodsFor:'scrolling'! |
|
2652 |
||
2653 |
basicScrollDown:nLines |
|
2654 |
|i| |
|
2655 |
||
2656 |
(lastFirstLine isNil) ifTrue:[ |
|
2657 |
lastFirstLine := firstLineShown. |
|
2658 |
]. |
|
2659 |
super scrollDown:nLines. |
|
2660 |
(lastFirstLine = firstLineShown) ifFalse:[ |
|
2661 |
i := 1. |
|
2662 |
[ |
|
2663 |
i <= changedLines size |
|
2664 |
] whileTrue:[ |
|
2665 |
super |
|
2666 |
drawVisibleLine:(changedLines at:i) |
|
2667 |
with:fgColor |
|
2668 |
and:Color white. |
|
2669 |
changedLines at:i put:(changedLines at:i) - nLines. |
|
2670 |
i := i + 1. |
|
2671 |
]. |
|
2672 |
i := 1. |
|
2673 |
[ |
|
2674 |
i <= insertedLines size |
|
2675 |
] whileTrue:[ |
|
2676 |
super |
|
2677 |
drawVisibleLine:(insertedLines at:i) |
|
2678 |
with:fgColor |
|
2679 |
and:Color white. |
|
2680 |
insertedLines at:i put:(insertedLines at:i) - nLines. |
|
2681 |
i := i + 1. |
|
2682 |
]. |
|
2683 |
i := 1. |
|
2684 |
[ |
|
2685 |
i <= deletedLines size |
|
2686 |
] whileTrue:[ |
|
2687 |
super |
|
2688 |
drawVisibleLine:(deletedLines at:i) |
|
2689 |
with:fgColor |
|
2690 |
and:Color white. |
|
2691 |
deletedLines at:i put:(deletedLines at:i) - nLines. |
|
2692 |
i := i + 1. |
|
2693 |
]. |
|
2694 |
lastFirstLine := firstLineShown. |
|
2695 |
self redrawLines. |
|
2696 |
]. |
|
2697 |
||
2698 |
"Created: / 06-04-2010 / 14:03:28 / Jakub <zelenja7@fel.cvut.cz>" |
|
2699 |
"Modified: / 02-05-2010 / 19:29:23 / Jakub <zelenja7@fel.cvut.cz>" |
|
2700 |
! |
|
2701 |
||
2702 |
basicScrollUp:nLines |
|
2703 |
|i| |
|
2704 |
||
2705 |
(scrolled isNil) ifTrue:[ |
|
2706 |
scrolled := false. |
|
2707 |
]. |
|
2708 |
(lastFirstLine isNil) ifTrue:[ |
|
2709 |
lastFirstLine := firstLineShown. |
|
2710 |
]. |
|
2711 |
super scrollUp:nLines. |
|
2712 |
(lastFirstLine = firstLineShown) ifFalse:[ |
|
2713 |
i := 1. |
|
2714 |
[ |
|
2715 |
i <= insertedLines size |
|
2716 |
] whileTrue:[ |
|
2717 |
super |
|
2718 |
drawVisibleLine:(insertedLines at:i) |
|
2719 |
with:fgColor |
|
2720 |
and:Color white. |
|
2721 |
insertedLines at:i put:(insertedLines at:i) + nLines. |
|
2722 |
i := i + 1. |
|
2723 |
]. |
|
2724 |
i := 1. |
|
2725 |
[ |
|
2726 |
i <= deletedLines size |
|
2727 |
] whileTrue:[ |
|
2728 |
super |
|
2729 |
drawVisibleLine:(deletedLines at:i) |
|
2730 |
with:fgColor |
|
2731 |
and:Color white. |
|
2732 |
deletedLines at:i put:(deletedLines at:i) + nLines. |
|
2733 |
i := i + 1. |
|
2734 |
]. |
|
2735 |
i := 1. |
|
2736 |
[ |
|
2737 |
i <= changedLines size |
|
2738 |
] whileTrue:[ |
|
2739 |
super |
|
2740 |
drawVisibleLine:(changedLines at:i) |
|
2741 |
with:fgColor |
|
2742 |
and:Color white. |
|
2743 |
changedLines at:i put:(changedLines at:i) + nLines. |
|
2744 |
i := i + 1. |
|
2745 |
]. |
|
2746 |
lastFirstLine := firstLineShown. |
|
2747 |
self redrawLines. |
|
2748 |
]. |
|
2749 |
||
2750 |
"Created: / 06-04-2010 / 14:03:46 / Jakub <zelenja7@fel.cvut.cz>" |
|
2751 |
"Modified: / 02-05-2010 / 19:19:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
2752 |
! |
|
2753 |
||
2754 |
originChanged:delta |
|
2755 |
||
2756 |
super originChanged:delta. |
|
2757 |
||
2758 |
gutterView invalidate. |
|
2759 |
||
2760 |
"Created: / 07-12-2009 / 21:50:49 / Jindra <a>" |
|
2761 |
! |
|
2762 |
||
2763 |
scrollDown:nLines |
|
2764 |
||
2765 |
codeView scrollDown: nLines in: self. |
|
2766 |
self basicScrollDown: nLines. |
|
2767 |
||
2768 |
"Modified: / 06-04-2010 / 14:04:28 / Jakub <zelenja7@fel.cvut.cz>" |
|
2769 |
! |
|
2770 |
||
2771 |
scrollUp:nLines |
|
2772 |
||
2773 |
codeView scrollUp: nLines in: self. |
|
2774 |
self basicScrollUp: nLines. |
|
2775 |
||
2776 |
"Modified: / 06-04-2010 / 14:05:40 / Jakub <zelenja7@fel.cvut.cz>" |
|
2777 |
! ! |
|
2778 |
||
10224 | 2779 |
!CodeView2::TextView methodsFor:'undo & again'! |
2780 |
||
2781 |
nonUndoableDo: aBlock |
|
2782 |
||
2783 |
super nonUndoableDo: aBlock. |
|
2784 |
suppressNotifications := false. |
|
2785 |
||
2786 |
"Created: / 06-07-2011 / 17:48:27 / jv" |
|
2787 |
! |
|
2788 |
||
2789 |
undoableDo: aBlock info: into |
|
2790 |
||
2791 |
super undoableDo: aBlock info: into. |
|
2792 |
suppressNotifications := false. |
|
2793 |
||
2794 |
"Created: / 06-07-2011 / 17:48:49 / jv" |
|
2795 |
! ! |
|
2796 |
||
9985 | 2797 |
!CodeView2 class methodsFor:'documentation'! |
2798 |
||
10293 | 2799 |
version |
10780 | 2800 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.29 2011-10-07 17:02:04 vrany Exp $' |
10293 | 2801 |
! |
2802 |
||
9985 | 2803 |
version_CVS |
10780 | 2804 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.29 2011-10-07 17:02:04 vrany Exp $' |
9985 | 2805 |
! |
2806 |
||
2807 |
version_SVN |
|
2808 |
^ '§Id: Tools__CodeView2.st 7797 2011-06-28 07:45:06Z vranyj1 §' |
|
2809 |
! ! |
|
2810 |
||
2811 |
CodeView2 initialize! |