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