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