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