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