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