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