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