author | Claus Gittinger <cg@exept.de> |
Thu, 12 May 2016 02:30:11 +0200 | |
changeset 16557 | 4039e1ff5147 |
parent 16243 | d10057b93404 |
child 16572 | ab23beb4bba6 |
child 16577 | 57afbd99e827 |
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 |
|
15130 | 31 |
instanceVariableNames:'gutterView textView textViewScroller methodHolder languageHolder |
32 |
classHolder browserHolder codeAspect modifiedChannel |
|
33 |
showGutterChannel showAcceptCancelBarChannel modeHolder services |
|
34 |
servicesFromClient syntaxElements currentParseNodeHolder |
|
35 |
currentBlockNodeHolder syntaxElementSelection highlightEmphasis |
|
36 |
diffMode synchronizedCodeViews' |
|
37 |
classVariableNames:'TraceSelectors' |
|
38 |
poolDictionaries:'' |
|
39 |
category:'Interface-CodeView' |
|
9985 | 40 |
! |
41 |
||
14986 | 42 |
AbstractBackground subclass:#AnnotationShowingScrollerBackground |
15130 | 43 |
instanceVariableNames:'annotations textView' |
44 |
classVariableNames:'' |
|
45 |
poolDictionaries:'' |
|
46 |
privateIn:CodeView2 |
|
14986 | 47 |
! |
48 |
||
9985 | 49 |
SimpleView subclass:#GutterView |
15130 | 50 |
instanceVariableNames:'codeView textView textViewScroller widthAcceptCancel |
51 |
widthAnnotations widthDiffInfo numberOfLines acceptColor |
|
52 |
cancelColor diffColor menuHolder currentBlockNodeHolder |
|
53 |
showLineNumbers blockWaitingForPossibleDoubleClick' |
|
54 |
classVariableNames:'' |
|
55 |
poolDictionaries:'' |
|
56 |
privateIn:CodeView2 |
|
9985 | 57 |
! |
58 |
||
59 |
CodeView subclass:#TextView |
|
15130 | 60 |
instanceVariableNames:'listOriginal codeView gutterView diffMode deletedLines |
61 |
insertedLines lastFirstLine changedLines scrollInProgress |
|
62 |
originDiffText emptyLines changedDiffText suppressNotifications |
|
63 |
reallyModifiedChannel' |
|
64 |
classVariableNames:'' |
|
65 |
poolDictionaries:'' |
|
66 |
privateIn:CodeView2 |
|
9985 | 67 |
! |
68 |
||
69 |
!CodeView2 class methodsFor:'documentation'! |
|
70 |
||
71 |
copyright |
|
72 |
" |
|
10072 | 73 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
74 |
All Rights Reserved |
|
75 |
||
76 |
Permission is hereby granted, free of charge, to any person |
|
77 |
obtaining a copy of this software and associated documentation |
|
78 |
files (the 'Software'), to deal in the Software without |
|
79 |
restriction, including without limitation the rights to use, |
|
80 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
81 |
copies of the Software, and to permit persons to whom the |
|
82 |
Software is furnished to do so, subject to the following |
|
83 |
conditions: |
|
84 |
||
85 |
The above copyright notice and this permission notice shall be |
|
86 |
included in all copies or substantial portions of the Software. |
|
87 |
||
88 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
89 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
90 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
91 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
92 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
93 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
94 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
95 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9985 | 96 |
" |
97 |
! ! |
|
98 |
||
99 |
!CodeView2 class methodsFor:'initialization'! |
|
100 |
||
101 |
initialize |
|
102 |
"Invoked at system start or when the class is dynamically loaded." |
|
103 |
||
104 |
"/ please change as required (and remove this comment) |
|
105 |
||
106 |
TraceSelectors := IdentitySet new. |
|
107 |
||
108 |
"Modified: / 14-02-2010 / 15:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
109 |
! ! |
|
110 |
||
111 |
!CodeView2 class methodsFor:'debugging'! |
|
112 |
||
113 |
trace: aSelector |
|
114 |
||
115 |
TraceSelectors add: aSelector |
|
116 |
||
117 |
"Created: / 14-02-2010 / 09:26:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
118 |
! |
|
119 |
||
120 |
untrace: aSelector |
|
121 |
||
122 |
TraceSelectors remove: aSelector ifAbsent:[] |
|
123 |
||
124 |
"Created: / 14-02-2010 / 09:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
125 |
! |
|
126 |
||
127 |
untraceAll |
|
128 |
||
129 |
TraceSelectors := IdentitySet new |
|
130 |
||
131 |
"Created: / 14-02-2010 / 09:53:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
132 |
! ! |
|
133 |
||
134 |
!CodeView2 class methodsFor:'examples'! |
|
135 |
||
136 |
example1 |
|
137 |
||
138 |
| window codeView | |
|
139 |
||
140 |
||
141 |
window := StandardSystemView new. |
|
142 |
window extent: 300 @ 300. |
|
143 |
window label: 'CodeView2 example1'. |
|
144 |
||
145 |
codeView := Tools::CodeView2 in: window. |
|
146 |
codeView |
|
147 |
origin: 0.1 @ 0.1 |
|
148 |
corner: 0.9 @ 0.9. |
|
149 |
||
150 |
||
151 |
window open. |
|
152 |
||
153 |
"Created: / 02-09-2009 / 21:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
154 |
! ! |
|
155 |
||
156 |
!CodeView2 class methodsFor:'menu specs'! |
|
157 |
||
10293 | 158 |
debugMenu |
159 |
"This resource specification was automatically generated |
|
160 |
by the MenuEditor of ST/X." |
|
161 |
||
162 |
"Do not manually edit this!! If it is corrupted, |
|
163 |
the MenuEditor may not be able to read the specification." |
|
164 |
||
165 |
" |
|
166 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_stxStyle |
|
167 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_stxStyle)) startUp |
|
168 |
" |
|
169 |
||
170 |
<resource: #menu> |
|
171 |
||
172 |
^ |
|
173 |
#(Menu |
|
174 |
( |
|
175 |
(MenuItem |
|
176 |
label: 'Inspect ' |
|
177 |
itemValue: inspectView |
|
178 |
translateLabel: true |
|
179 |
) |
|
180 |
(MenuItem |
|
181 |
label: 'Inspect Syntax Elements' |
|
182 |
itemValue: inspectSyntaxElements |
|
183 |
translateLabel: true |
|
184 |
) |
|
185 |
(MenuItem |
|
11398
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
186 |
label: 'Inspect Selected Selector' |
10293 | 187 |
itemValue: inspectSelectedSelector |
188 |
translateLabel: true |
|
189 |
) |
|
190 |
) |
|
191 |
nil |
|
192 |
nil |
|
193 |
) |
|
194 |
||
195 |
"Created: / 08-07-2011 / 13:36:02 / cg" |
|
196 |
! |
|
197 |
||
9985 | 198 |
editMenu |
199 |
"This resource specification was automatically generated |
|
200 |
by the MenuEditor of ST/X." |
|
201 |
||
202 |
"Do not manually edit this!! If it is corrupted, |
|
203 |
the MenuEditor may not be able to read the specification." |
|
204 |
||
205 |
" |
|
206 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu |
|
207 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu)) startUp |
|
208 |
" |
|
209 |
||
10290 | 210 |
UserPreferences current eclipseStyleMenus ifTrue:[ |
211 |
^ self editMenu_eclipseStyle |
|
212 |
]. |
|
213 |
^ self editMenu_stxStyle |
|
214 |
||
215 |
"Modified: / 08-07-2011 / 13:23:35 / cg" |
|
216 |
! |
|
217 |
||
218 |
editMenu_eclipseStyle |
|
219 |
"This resource specification was automatically generated |
|
220 |
by the MenuEditor of ST/X." |
|
221 |
||
222 |
"Do not manually edit this!! If it is corrupted, |
|
223 |
the MenuEditor may not be able to read the specification." |
|
224 |
||
11311 | 225 |
|
10290 | 226 |
" |
11311 | 227 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_eclipseStyle |
228 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_eclipseStyle)) startUp |
|
10290 | 229 |
" |
230 |
||
9985 | 231 |
<resource: #menu> |
232 |
||
13813 | 233 |
^ |
9985 | 234 |
#(Menu |
13942 | 235 |
( |
236 |
(MenuItem |
|
237 |
label: 'Implementors...' |
|
238 |
itemValue: browseImplementorsOfIt |
|
239 |
submenuChannel: implementorsMenu |
|
240 |
shortcutKey: ImplementorsOfIt |
|
241 |
) |
|
242 |
(MenuItem |
|
243 |
label: 'Senders...' |
|
244 |
itemValue: browseSendersOfIt |
|
245 |
submenuChannel: sendersMenu |
|
246 |
shortcutKey: SendersOfIt |
|
247 |
) |
|
248 |
(MenuItem |
|
249 |
label: 'Refactor' |
|
250 |
nameKey: refactor |
|
251 |
isVisible: false |
|
252 |
shortcutKey: Shift |
|
253 |
) |
|
254 |
(MenuItem |
|
255 |
label: '-' |
|
256 |
) |
|
257 |
(MenuItem |
|
258 |
label: 'Accept' |
|
259 |
itemValue: accept |
|
260 |
shortcutKey: Accept |
|
14997 | 261 |
enabled: canAccept |
13942 | 262 |
) |
263 |
(MenuItem |
|
264 |
label: '-' |
|
265 |
) |
|
266 |
(MenuItem |
|
267 |
label: 'Cut' |
|
268 |
itemValue: cut |
|
269 |
shortcutKey: Cut |
|
14997 | 270 |
enabled: canCut |
13942 | 271 |
) |
272 |
(MenuItem |
|
273 |
label: 'Copy' |
|
274 |
itemValue: copySelection |
|
275 |
shortcutKey: Copy |
|
14997 | 276 |
enabled: hasSelectionForCopy |
13942 | 277 |
) |
278 |
(MenuItem |
|
279 |
label: 'Paste' |
|
280 |
itemValue: pasteOrReplace |
|
281 |
shortcutKey: Paste |
|
14997 | 282 |
enabled: isNotReadOnly |
13942 | 283 |
) |
284 |
(MenuItem |
|
285 |
label: '-' |
|
286 |
) |
|
287 |
(MenuItem |
|
288 |
label: 'Undo' |
|
289 |
itemValue: undo |
|
290 |
shortcutKey: Undo |
|
14997 | 291 |
enabled: hasUndoAction |
13942 | 292 |
) |
293 |
(MenuItem |
|
294 |
label: 'Redo' |
|
295 |
itemValue: redo |
|
296 |
shortcutKey: Redo |
|
14997 | 297 |
enabled: hasRedoAction |
13942 | 298 |
) |
299 |
(MenuItem |
|
300 |
label: '-' |
|
301 |
) |
|
302 |
(MenuItem |
|
303 |
label: 'Do it' |
|
304 |
itemValue: doIt |
|
305 |
shortcutKey: DoIt |
|
306 |
) |
|
307 |
(MenuItem |
|
308 |
label: 'Print it' |
|
309 |
itemValue: printIt |
|
310 |
shortcutKey: PrintIt |
|
311 |
) |
|
312 |
(MenuItem |
|
313 |
label: 'Inspect it' |
|
314 |
itemValue: inspectIt |
|
315 |
shortcutKey: InspectIt |
|
316 |
) |
|
317 |
(MenuItem |
|
318 |
label: 'Profile it' |
|
319 |
itemValue: profileIt |
|
320 |
shortcutKey: InspectIt |
|
321 |
) |
|
322 |
(MenuItem |
|
323 |
label: '-' |
|
324 |
) |
|
325 |
(MenuItem |
|
326 |
label: 'Show Gutter' |
|
327 |
nameKey: ShowGutter |
|
328 |
indication: showGutterChannel |
|
329 |
) |
|
330 |
(MenuItem |
|
331 |
label: 'More' |
|
332 |
nameKey: More |
|
333 |
) |
|
334 |
(MenuItem |
|
335 |
label: 'Services' |
|
336 |
submenuChannel: servicesMenu |
|
337 |
) |
|
338 |
(MenuItem |
|
339 |
label: 'Debug' |
|
340 |
submenuChannel: debugMenu |
|
341 |
) |
|
342 |
) |
|
343 |
nil |
|
344 |
nil |
|
9985 | 345 |
) |
10290 | 346 |
! |
347 |
||
348 |
editMenu_stxStyle |
|
349 |
"This resource specification was automatically generated |
|
350 |
by the MenuEditor of ST/X." |
|
351 |
||
352 |
"Do not manually edit this!! If it is corrupted, |
|
353 |
the MenuEditor may not be able to read the specification." |
|
354 |
||
11241
e3d6bdc7a790
changed: #editMenu_stxStyle
Claus Gittinger <cg@exept.de>
parents:
11220
diff
changeset
|
355 |
|
10290 | 356 |
" |
357 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_stxStyle |
|
358 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_stxStyle)) startUp |
|
359 |
" |
|
360 |
||
361 |
<resource: #menu> |
|
362 |
||
363 |
^ |
|
364 |
#(Menu |
|
365 |
( |
|
366 |
(MenuItem |
|
367 |
label: 'Undo' |
|
368 |
itemValue: undo |
|
369 |
translateLabel: true |
|
370 |
shortcutKey: Undo |
|
14997 | 371 |
enabled: hasUndoAction |
10290 | 372 |
) |
373 |
(MenuItem |
|
374 |
label: 'Again' |
|
375 |
itemValue: again |
|
376 |
translateLabel: true |
|
377 |
shortcutKey: Again |
|
14997 | 378 |
enabled: canDoAgain |
10290 | 379 |
) |
380 |
(MenuItem |
|
381 |
label: '-' |
|
382 |
) |
|
383 |
(MenuItem |
|
384 |
label: 'Cut' |
|
385 |
itemValue: cut |
|
386 |
translateLabel: true |
|
387 |
shortcutKey: Cut |
|
14997 | 388 |
enabled: canCut |
10290 | 389 |
) |
390 |
(MenuItem |
|
391 |
label: 'Copy' |
|
392 |
itemValue: copySelection |
|
393 |
translateLabel: true |
|
394 |
shortcutKey: Copy |
|
14997 | 395 |
enabled: hasSelectionForCopy |
10290 | 396 |
) |
397 |
(MenuItem |
|
398 |
label: 'Paste' |
|
399 |
itemValue: pasteOrReplace |
|
400 |
translateLabel: true |
|
401 |
shortcutKey: Paste |
|
14997 | 402 |
enabled: isNotReadOnly |
10290 | 403 |
) |
404 |
(MenuItem |
|
405 |
label: '-' |
|
406 |
) |
|
407 |
(MenuItem |
|
408 |
label: 'DoIt' |
|
409 |
itemValue: doIt |
|
410 |
translateLabel: true |
|
411 |
shortcutKey: DoIt |
|
412 |
) |
|
413 |
(MenuItem |
|
414 |
label: 'PrintIt' |
|
415 |
itemValue: printIt |
|
416 |
translateLabel: true |
|
417 |
shortcutKey: PrintIt |
|
418 |
) |
|
419 |
(MenuItem |
|
420 |
label: 'InspectIt' |
|
421 |
itemValue: inspectIt |
|
422 |
translateLabel: true |
|
423 |
shortcutKey: InspectIt |
|
424 |
) |
|
425 |
(MenuItem |
|
426 |
label: '-' |
|
427 |
) |
|
428 |
(MenuItem |
|
429 |
label: 'Accept' |
|
430 |
itemValue: accept |
|
431 |
translateLabel: true |
|
432 |
shortcutKey: Accept |
|
14997 | 433 |
enabled: canAccept |
10290 | 434 |
) |
435 |
(MenuItem |
|
436 |
label: '-' |
|
11353
5cb468550ad2
changed: #editMenu_stxStyle
Claus Gittinger <cg@exept.de>
parents:
11311
diff
changeset
|
437 |
isVisible: false |
10290 | 438 |
) |
439 |
(MenuItem |
|
440 |
label: 'Refactor' |
|
11311 | 441 |
nameKey: refactor |
10290 | 442 |
translateLabel: true |
443 |
isVisible: false |
|
444 |
shortcutKey: Shift |
|
445 |
) |
|
446 |
(MenuItem |
|
447 |
label: 'Services' |
|
448 |
translateLabel: true |
|
11241
e3d6bdc7a790
changed: #editMenu_stxStyle
Claus Gittinger <cg@exept.de>
parents:
11220
diff
changeset
|
449 |
isVisible: false |
10290 | 450 |
submenuChannel: servicesMenu |
451 |
) |
|
452 |
(MenuItem |
|
11353
5cb468550ad2
changed: #editMenu_stxStyle
Claus Gittinger <cg@exept.de>
parents:
11311
diff
changeset
|
453 |
label: '=' |
10290 | 454 |
) |
455 |
(MenuItem |
|
456 |
label: 'More' |
|
457 |
nameKey: More |
|
458 |
translateLabel: true |
|
459 |
shortcutKey: Ctrl |
|
460 |
) |
|
461 |
) |
|
462 |
nil |
|
463 |
nil |
|
464 |
) |
|
11353
5cb468550ad2
changed: #editMenu_stxStyle
Claus Gittinger <cg@exept.de>
parents:
11311
diff
changeset
|
465 |
|
5cb468550ad2
changed: #editMenu_stxStyle
Claus Gittinger <cg@exept.de>
parents:
11311
diff
changeset
|
466 |
"Modified: / 02-03-2012 / 19:53:19 / cg" |
9985 | 467 |
! ! |
468 |
||
469 |
!CodeView2 methodsFor:'accessing'! |
|
470 |
||
471 |
acceptAction:aBlock |
|
472 |
||
473 |
textView acceptAction: aBlock |
|
474 |
||
475 |
"Modified: / 01-08-2010 / 20:40:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
476 |
! |
|
477 |
||
10224 | 478 |
breakpoints |
13097 | 479 |
|s| |
480 |
||
481 |
(s := self breakpointService) notNil ifTrue:[ |
|
482 |
^ s breakpoints |
|
10224 | 483 |
]. |
10767 | 484 |
^ nil |
10224 | 485 |
|
486 |
"Created: / 06-07-2011 / 18:05:35 / jv" |
|
10767 | 487 |
"Modified: / 06-10-2011 / 14:13:53 / cg" |
10224 | 488 |
! |
489 |
||
10245 | 490 |
browser |
491 |
||
492 |
^self browserHolder value |
|
493 |
||
494 |
"Created: / 07-07-2011 / 12:25:59 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
495 |
! |
|
496 |
||
9985 | 497 |
codeAspect |
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
498 |
^ textView codeAspect |
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
499 |
|
11706 | 500 |
"Modified: / 27-07-2012 / 22:22:27 / cg" |
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
501 |
"Modified: / 27-09-2013 / 10:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 502 |
! |
503 |
||
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
504 |
codeAspect: aSymbol |
14638 | 505 |
"tell the textView what is shown, so it can adjust the |
506 |
syntaxhighlighter. |
|
507 |
See SyntaxHighlighter codeAspectXXX for possible aspects." |
|
508 |
||
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
509 |
^ textView codeAspect: aSymbol |
11706 | 510 |
|
511 |
"Modified: / 27-07-2012 / 22:32:19 / cg" |
|
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
512 |
"Modified: / 27-09-2013 / 10:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 513 |
! |
514 |
||
13813 | 515 |
compilerClass |
516 |
^textView compilerClass |
|
517 |
||
518 |
"Created: / 10-05-2012 / 23:47:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
519 |
! |
|
520 |
||
521 |
compilerClass: aClass |
|
522 |
textView compilerClass: aClass |
|
523 |
||
524 |
"Created: / 10-05-2012 / 23:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
525 |
! |
|
526 |
||
9985 | 527 |
contents |
528 |
||
529 |
^textView contents |
|
530 |
||
531 |
"Created: / 14-02-2010 / 22:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
532 |
! |
|
533 |
||
534 |
contents: aStringOrStringCollection |
|
535 |
||
536 |
textView contents: aStringOrStringCollection. |
|
537 |
"/self update:#value with: aStringOrStringCollection from: textView model |
|
538 |
||
10330 | 539 |
"Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 540 |
! |
541 |
||
13813 | 542 |
contents: aStringOrStringCollection clear: clearPrevious |
543 |
"Set the contents. If clearPrevous is true, then |
|
544 |
previous original text is cleared and set to given one. |
|
545 |
(so the text is considered not modified)" |
|
546 |
||
547 |
textView contents: aStringOrStringCollection clear: clearPrevious |
|
548 |
||
549 |
"Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
550 |
"Created: / 17-02-2012 / 00:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
551 |
! |
|
552 |
||
553 |
currentParseNode |
|
14101 | 554 |
|sel| |
555 |
||
556 |
sel := self syntaxElementSelection. |
|
557 |
sel isNil ifTrue:[^ nil]. |
|
558 |
^ sel node |
|
13813 | 559 |
|
560 |
"Created: / 21-02-2012 / 14:20:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14057
94bd4556cf5d
Fixes in CodeNavigationService - semi-modal navigation should work again.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14050
diff
changeset
|
561 |
"Modified: / 25-02-2014 / 22:06:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13813 | 562 |
! |
563 |
||
564 |
delegate: anObject |
|
565 |
||
566 |
super delegate: anObject. |
|
567 |
self textView delegate: anObject. |
|
568 |
self gutterView delegate: anObject. |
|
569 |
||
570 |
"Created: / 11-05-2012 / 10:29:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
571 |
! |
|
572 |
||
9985 | 573 |
diffMode |
574 |
^ diffMode |
|
575 |
! |
|
576 |
||
577 |
diffMode:aBoolean |
|
578 |
diffMode := aBoolean. |
|
579 |
textView diffMode: aBoolean |
|
580 |
||
581 |
"Modified: / 08-04-2011 / 20:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
582 |
! |
|
583 |
||
14194
efb533b63fee
Tools::CodeView2>>#editedLanguage:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14145
diff
changeset
|
584 |
editedLanguage: aProgrammingLanguage |
efb533b63fee
Tools::CodeView2>>#editedLanguage:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14145
diff
changeset
|
585 |
self languageHolder value: aProgrammingLanguage |
efb533b63fee
Tools::CodeView2>>#editedLanguage:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14145
diff
changeset
|
586 |
|
efb533b63fee
Tools::CodeView2>>#editedLanguage:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14145
diff
changeset
|
587 |
"Created: / 09-04-2014 / 14:49:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
efb533b63fee
Tools::CodeView2>>#editedLanguage:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14145
diff
changeset
|
588 |
! |
efb533b63fee
Tools::CodeView2>>#editedLanguage:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14145
diff
changeset
|
589 |
|
12914 | 590 |
editedMethodOrClass:aMethodOrClass |
12950 | 591 |
textView editedMethodOrClass:aMethodOrClass. |
592 |
aMethodOrClass isBehavior ifFalse:[ |
|
593 |
self methodHolder value:aMethodOrClass |
|
594 |
]. |
|
12914 | 595 |
! |
596 |
||
9985 | 597 |
font |
598 |
||
599 |
^textView font |
|
600 |
||
601 |
"Created: / 16-02-2010 / 10:26:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
602 |
! |
|
603 |
||
604 |
font: aFont |
|
605 |
||
606 |
^textView font: aFont |
|
607 |
||
608 |
"Created: / 16-02-2010 / 10:26:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
609 |
! |
|
610 |
||
611 |
mode |
|
612 |
||
613 |
^self modeHolder value |
|
614 |
||
615 |
"Created: / 13-06-2011 / 10:49:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
616 |
! |
|
617 |
||
618 |
mode: aSymbol |
|
11706 | 619 |
"is this the same as codeAspect ?" |
9985 | 620 |
|
621 |
self assert: (#(expression method) includes: aSymbol). |
|
622 |
||
623 |
^self modeHolder value: aSymbol |
|
624 |
||
625 |
"Created: / 13-06-2011 / 10:50:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
626 |
"Modified: / 15-06-2011 / 16:37:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11706 | 627 |
"Modified (comment): / 27-07-2012 / 22:19:49 / cg" |
9985 | 628 |
! |
629 |
||
10409 | 630 |
model |
631 |
||
632 |
^textView model. |
|
633 |
||
634 |
"Created: / 27-07-2011 / 12:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
635 |
! |
|
636 |
||
637 |
model: aValueModel |
|
638 |
||
639 |
|oldValue newValue| |
|
640 |
||
641 |
textView model notNil ifTrue:[ |
|
13942 | 642 |
oldValue := textView model value. |
643 |
textView model removeDependent:self. |
|
10409 | 644 |
]. |
645 |
textView model: aValueModel. |
|
646 |
textView model notNil ifTrue:[ |
|
13942 | 647 |
textView model addDependent:self. |
10409 | 648 |
]. |
649 |
newValue := textView model value. |
|
650 |
oldValue ~~ newValue ifTrue:[ |
|
13942 | 651 |
self update:#value with:newValue from:textView model. |
10409 | 652 |
]. |
653 |
||
13813 | 654 |
"Modified: / 17-03-2012 / 16:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10409 | 655 |
! |
656 |
||
9985 | 657 |
modified |
658 |
"return true if text was modified" |
|
659 |
||
10245 | 660 |
^ self modifiedChannel value |
661 |
||
662 |
"Modified: / 07-07-2011 / 12:15:43 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 663 |
! |
664 |
||
665 |
modified:aBoolean |
|
666 |
"set/clear the modified flag" |
|
667 |
||
10245 | 668 |
self modifiedChannel value:aBoolean |
669 |
||
670 |
"Modified: / 14-02-1997 / 16:44:05 / cg" |
|
671 |
"Modified: / 07-07-2011 / 12:15:39 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 672 |
! |
673 |
||
10487 | 674 |
services |
10767 | 675 |
^ services ? #() |
10487 | 676 |
|
677 |
"Created: / 05-08-2011 / 10:14:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 678 |
"Modified (format): / 06-10-2011 / 14:11:11 / cg" |
10487 | 679 |
! |
680 |
||
10755 | 681 |
services:aCollectionOfServices |
682 |
"allow setting of the services (instances); |
|
683 |
this is needed for FileBrowser, to setup a codeView2 without Smalltalk-specific |
|
684 |
services" |
|
685 |
||
14495
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
686 |
services notEmptyOrNil ifTrue:[ |
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
687 |
services do:[:service | service unregister ]. |
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
688 |
services := #(). |
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
689 |
]. |
10767 | 690 |
servicesFromClient := true. |
691 |
services := aCollectionOfServices. |
|
14495
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
692 |
services notEmptyOrNil ifTrue:[ |
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
693 |
services do:[:service | service registerIn: self ]. |
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
694 |
]. |
10767 | 695 |
|
696 |
"Created: / 06-10-2011 / 14:15:36 / cg" |
|
14495
2507816f2ee1
Fix in Tools::CodeView2>>#services: - when setting services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14492
diff
changeset
|
697 |
"Modified: / 13-06-2014 / 14:12:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10755 | 698 |
! |
699 |
||
14519
47d5751883ab
Added Tools::CodeView2>>#servicesFromClient
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14511
diff
changeset
|
700 |
servicesFromClient |
47d5751883ab
Added Tools::CodeView2>>#servicesFromClient
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14511
diff
changeset
|
701 |
^ servicesFromClient ? false |
47d5751883ab
Added Tools::CodeView2>>#servicesFromClient
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14511
diff
changeset
|
702 |
|
47d5751883ab
Added Tools::CodeView2>>#servicesFromClient
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14511
diff
changeset
|
703 |
"Modified: / 17-06-2014 / 10:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
47d5751883ab
Added Tools::CodeView2>>#servicesFromClient
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14511
diff
changeset
|
704 |
! |
47d5751883ab
Added Tools::CodeView2>>#servicesFromClient
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14511
diff
changeset
|
705 |
|
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
706 |
showAcceptCancelBar |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
707 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
708 |
^showAcceptCancelBarChannel value |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
709 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
710 |
"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
|
711 |
! |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
712 |
|
9985 | 713 |
showGutter |
714 |
||
715 |
^showGutterChannel value |
|
716 |
||
717 |
"Created: / 23-06-2010 / 19:37:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
718 |
! |
|
719 |
||
720 |
synchronizeWith: aCodeView |
|
721 |
||
722 |
self assert: aCodeView ~= self. |
|
723 |
(synchronizedCodeViews includes: aCodeView) ifTrue:[^self]. |
|
724 |
synchronizedCodeViews := synchronizedCodeViews copyWith: aCodeView. |
|
725 |
||
726 |
"Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>" |
|
727 |
"Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 728 |
! |
729 |
||
730 |
unsynchronizeWith: aCodeView |
|
731 |
||
732 |
self assert: aCodeView ~= self. |
|
733 |
(synchronizedCodeViews includes: aCodeView) ifFalse:[^self]. |
|
734 |
synchronizedCodeViews := synchronizedCodeViews copyWithout: aCodeView. |
|
735 |
||
736 |
"Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>" |
|
737 |
"Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
738 |
"Created: / 19-03-2012 / 14:25:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 739 |
! ! |
740 |
||
14050
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
741 |
!CodeView2 methodsFor:'accessing-behavior'! |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
742 |
|
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
743 |
readOnly:aBoolean |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
744 |
"ignored here; present for compatibility with some textView subclasses, |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
745 |
so that UIPainter can handle it in its TextView spec (which contains a |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
746 |
readOnly field)" |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
747 |
|
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
748 |
super readOnly:aBoolean. |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
749 |
textView readOnly: aBoolean. |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
750 |
gutterView readOnly: aBoolean. |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
751 |
|
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
752 |
"Created: / 21-02-2014 / 11:45:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
753 |
! ! |
39037498b7e1
class: Tools::CodeView2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14005
diff
changeset
|
754 |
|
14005 | 755 |
!CodeView2 methodsFor:'accessing-code component'! |
10409 | 756 |
|
757 |
klass |
|
15377 | 758 |
"the class or the class of the method being shown." |
759 |
||
10409 | 760 |
| v | |
761 |
||
762 |
(v := self classHolder value) notNil ifTrue:[^v]. |
|
13199 | 763 |
(v := self method) notNil ifTrue:[^v mclass]. |
10409 | 764 |
|
13813 | 765 |
^nil |
10409 | 766 |
|
767 |
"Created: / 27-07-2011 / 13:14:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13199 | 768 |
"Modified: / 22-07-2013 / 13:34:05 / cg" |
14005 | 769 |
! |
10409 | 770 |
|
771 |
klass: aClass |
|
15377 | 772 |
"the class or the class of the method being shown" |
10409 | 773 |
|
774 |
"Created: / 27-07-2011 / 13:13:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
775 |
! |
|
776 |
||
777 |
language |
|
15377 | 778 |
"return the value in 'languageHolder', the programmingLanguage of the class |
779 |
or method being shown. |
|
780 |
BAD name: confusion with the national language. |
|
781 |
why not call this 'programmingLanguage' ?" |
|
10409 | 782 |
|
15826 | 783 |
| v m c | |
10409 | 784 |
|
785 |
(v := self languageHolder value) notNil ifTrue:[^v]. |
|
15826 | 786 |
(m := self method) notNil ifTrue:[^m programmingLanguage]. |
787 |
(c := self classHolder value) notNil ifTrue:[^c programmingLanguage]. |
|
788 |
||
789 |
"/No, no default language, please (for workspaces, etc.). |
|
10967
8c142eff5641
No highlighting by default (either method or language must be set)
vrany
parents:
10877
diff
changeset
|
790 |
"/^SmalltalkLanguage instance |
8c142eff5641
No highlighting by default (either method or language must be set)
vrany
parents:
10877
diff
changeset
|
791 |
^nil |
8c142eff5641
No highlighting by default (either method or language must be set)
vrany
parents:
10877
diff
changeset
|
792 |
|
8c142eff5641
No highlighting by default (either method or language must be set)
vrany
parents:
10877
diff
changeset
|
793 |
"Modified: / 07-12-2011 / 16:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13199 | 794 |
"Modified: / 22-07-2013 / 13:34:17 / cg" |
10409 | 795 |
! |
796 |
||
797 |
language: newValue |
|
15377 | 798 |
"set the value in 'languageHolder', the programmingLanguage of the class |
799 |
or method being shown. |
|
800 |
BAD name: confusion with the national language. |
|
801 |
why not call this 'programmingLanguage' ?" |
|
10409 | 802 |
|
803 |
self languageHolder value: newValue |
|
804 |
! |
|
805 |
||
806 |
method |
|
15377 | 807 |
"the method being shown, or nil" |
10409 | 808 |
|
809 |
^self methodHolder value |
|
810 |
||
811 |
"Created: / 27-07-2011 / 13:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
812 |
! |
|
813 |
||
814 |
method: aMethod |
|
15377 | 815 |
"the method being shown, or nil" |
10409 | 816 |
|
817 |
^self methodHolder value: aMethod |
|
818 |
||
819 |
"Created: / 27-07-2011 / 13:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
820 |
! ! |
|
821 |
||
15875 | 822 |
!CodeView2 methodsFor:'accessing-look'! |
823 |
||
824 |
backgroundColor:aColor |
|
825 |
textView backgroundColor:aColor |
|
826 |
! |
|
827 |
||
828 |
viewBackground:newViewBackground |
|
829 |
textView viewBackground:newViewBackground |
|
830 |
! ! |
|
831 |
||
9985 | 832 |
!CodeView2 methodsFor:'aspects'! |
833 |
||
834 |
browserHolder |
|
10877 | 835 |
browserHolder isNil ifTrue:[ |
9985 | 836 |
browserHolder := ValueHolder new |
837 |
]. |
|
838 |
^browserHolder |
|
839 |
||
840 |
"Modified: / 14-02-2010 / 19:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10877 | 841 |
"Modified: / 18-11-2011 / 14:58:15 / cg" |
9985 | 842 |
! |
843 |
||
844 |
browserHolder:aValueModel |
|
845 |
browserHolder := aValueModel. |
|
846 |
! |
|
847 |
||
848 |
classHolder |
|
849 |
"return/create the 'classHolder' value holder (automatically generated)" |
|
850 |
||
851 |
classHolder isNil ifTrue:[ |
|
10409 | 852 |
classHolder := ValueHolder with: nil. |
9985 | 853 |
classHolder addDependent:self. |
854 |
]. |
|
855 |
^ classHolder |
|
856 |
||
10409 | 857 |
"Modified: / 27-07-2011 / 13:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 858 |
! |
859 |
||
860 |
classHolder:aValueModel |
|
861 |
"set the 'classHolder' value holder (automatically generated)" |
|
862 |
||
863 |
|old oldValue newValue| |
|
864 |
||
865 |
classHolder notNil ifTrue:[ |
|
866 |
oldValue := classHolder value. |
|
867 |
classHolder removeDependent:self. |
|
868 |
]. |
|
14521
6625c6f46bf3
Fixed stupid bug in CodeVIew2>>classHolder: - send correct old classHolder with change.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14520
diff
changeset
|
869 |
old := classHolder. |
9985 | 870 |
classHolder := aValueModel. |
871 |
classHolder notNil ifTrue:[ |
|
872 |
classHolder addDependent:self. |
|
873 |
]. |
|
874 |
newValue := classHolder value. |
|
875 |
oldValue ~~ newValue ifTrue:[ |
|
876 |
self update:#value with:newValue from:classHolder. |
|
877 |
]. |
|
878 |
||
879 |
self changed: #classHolder with: old -> classHolder |
|
880 |
||
14521
6625c6f46bf3
Fixed stupid bug in CodeVIew2>>classHolder: - send correct old classHolder with change.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14520
diff
changeset
|
881 |
"Modified: / 17-06-2014 / 13:10:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 882 |
! |
883 |
||
13813 | 884 |
currentBlockNodeHolder |
885 |
"return/create the 'currentBlockNodeHolder' value holder (automatically generated)" |
|
886 |
||
887 |
currentBlockNodeHolder isNil ifTrue:[ |
|
13942 | 888 |
currentBlockNodeHolder := ValueHolder new. |
13813 | 889 |
]. |
890 |
^ currentBlockNodeHolder |
|
891 |
! |
|
892 |
||
893 |
currentBlockNodeHolder:something |
|
894 |
"set the 'currentBlockNodeHolder' value holder (automatically generated)" |
|
895 |
||
896 |
currentBlockNodeHolder := something. |
|
897 |
! |
|
898 |
||
899 |
currentParseNodeHolder |
|
900 |
"return/create the 'currentParseNodeHolder' value holder (automatically generated)" |
|
901 |
||
902 |
currentParseNodeHolder isNil ifTrue:[ |
|
13942 | 903 |
currentParseNodeHolder := ValueHolder new. |
13813 | 904 |
]. |
905 |
^ currentParseNodeHolder |
|
906 |
! |
|
907 |
||
908 |
currentParseNodeHolder:something |
|
909 |
"set the 'currentParseNodeHolder' value holder (automatically generated)" |
|
910 |
||
911 |
currentParseNodeHolder := something. |
|
912 |
gutterView notNil ifTrue:[ gutterView currentBlockNodeHolder: currentBlockNodeHolder ]. |
|
913 |
||
914 |
"Modified: / 16-02-2012 / 23:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
915 |
! |
|
916 |
||
9985 | 917 |
languageHolder |
918 |
languageHolder isNil ifTrue:[ |
|
11616 | 919 |
"/ cg: I dont like the smalltalk default here, because everyone who is not showing ST-code (expecco, filebrowser etc.) |
10723 | 920 |
"/ has to explicitely clear the valueholder. I guess, it is better for the few |
921 |
"/ others to explicitely set it, if they do not provide syntaxHighlighter per method |
|
922 |
"/ or class. |
|
923 |
languageHolder := ValueHolder with: nil "SmalltalkLanguage instance". |
|
9985 | 924 |
languageHolder addDependent:self. |
925 |
]. |
|
926 |
^ languageHolder |
|
10723 | 927 |
|
11616 | 928 |
"Modified: / 19-07-2012 / 16:51:04 / cg" |
9985 | 929 |
! |
930 |
||
931 |
languageHolder:aValueModel |
|
932 |
"set the 'languageHolder' value holder (automatically generated)" |
|
933 |
||
934 |
|old oldValue newValue| |
|
935 |
||
936 |
languageHolder notNil ifTrue:[ |
|
937 |
oldValue := languageHolder value. |
|
938 |
languageHolder removeDependent:self. |
|
939 |
]. |
|
940 |
languageHolder := aValueModel. |
|
941 |
languageHolder notNil ifTrue:[ |
|
942 |
languageHolder addDependent:self. |
|
943 |
]. |
|
944 |
old := languageHolder. |
|
945 |
newValue := languageHolder value. |
|
946 |
oldValue ~~ newValue ifTrue:[ |
|
947 |
self update:#value with:newValue from:languageHolder. |
|
948 |
]. |
|
949 |
||
950 |
self changed: #languageHolder with: old -> languageHolder |
|
951 |
||
952 |
"Modified: / 17-06-2011 / 12:56:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11616 | 953 |
"Modified: / 19-07-2012 / 16:51:08 / cg" |
9985 | 954 |
! |
955 |
||
956 |
methodHolder |
|
957 |
"return/create the 'methodHolder' value holder (automatically generated)" |
|
958 |
||
959 |
methodHolder isNil ifTrue:[ |
|
960 |
methodHolder := ValueHolder new. |
|
961 |
methodHolder addDependent:self. |
|
962 |
]. |
|
963 |
^ methodHolder |
|
964 |
! |
|
965 |
||
966 |
methodHolder:aValueModel |
|
967 |
"set the 'methodHolder' value holder (automatically generated)" |
|
968 |
||
969 |
|old oldValue newValue| |
|
970 |
||
971 |
methodHolder notNil ifTrue:[ |
|
972 |
oldValue := methodHolder value. |
|
973 |
methodHolder removeDependent:self. |
|
974 |
]. |
|
975 |
old := methodHolder. |
|
976 |
methodHolder := aValueModel. |
|
977 |
methodHolder notNil ifTrue:[ |
|
978 |
methodHolder addDependent:self. |
|
979 |
]. |
|
980 |
newValue := methodHolder value. |
|
981 |
oldValue ~~ newValue ifTrue:[ |
|
982 |
self update:#value with:newValue from:methodHolder. |
|
983 |
]. |
|
984 |
||
985 |
self changed: #methodHolder with: old -> methodHolder |
|
986 |
||
987 |
"Modified: / 17-06-2011 / 12:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
988 |
! |
|
989 |
||
990 |
modeHolder |
|
991 |
"return/create the 'modeHolder' value holder (automatically generated)" |
|
992 |
||
11706 | 993 |
"is this the codeAspect?" |
9985 | 994 |
modeHolder isNil ifTrue:[ |
995 |
modeHolder := #expression asValue. |
|
996 |
modeHolder addDependent:self. |
|
997 |
]. |
|
998 |
^ modeHolder |
|
999 |
||
1000 |
"Modified: / 13-06-2011 / 10:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11706 | 1001 |
"Modified (comment): / 27-07-2012 / 22:22:19 / cg" |
9985 | 1002 |
! |
1003 |
||
1004 |
modeHolder:something |
|
1005 |
"set the 'modeHolder' value holder (automatically generated)" |
|
1006 |
||
1007 |
|oldValue newValue| |
|
1008 |
||
1009 |
modeHolder notNil ifTrue:[ |
|
1010 |
oldValue := modeHolder value. |
|
1011 |
modeHolder removeDependent:self. |
|
1012 |
]. |
|
1013 |
modeHolder := something. |
|
1014 |
modeHolder notNil ifTrue:[ |
|
1015 |
modeHolder addDependent:self. |
|
1016 |
]. |
|
1017 |
newValue := modeHolder value. |
|
1018 |
oldValue ~~ newValue ifTrue:[ |
|
1019 |
self update:#value with:newValue from:modeHolder. |
|
1020 |
]. |
|
1021 |
||
1022 |
self changed: #modeHolder with: modeHolder |
|
1023 |
||
1024 |
"Modified: / 17-06-2011 / 12:55:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1025 |
! ! |
|
1026 |
||
1027 |
!CodeView2 methodsFor:'change & update'! |
|
1028 |
||
1029 |
update:aspect with:param from:sender |
|
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1030 |
|
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1031 |
|
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1032 |
sender == methodHolder ifTrue:[ |
13942 | 1033 |
textView editedMethodOrClass: methodHolder value. |
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1034 |
]. |
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1035 |
|
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1036 |
sender == classHolder ifTrue:[ |
13942 | 1037 |
methodHolder value isNil ifTrue:[ |
1038 |
textView editedMethodOrClass: classHolder value. |
|
1039 |
]. |
|
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1040 |
]. |
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1041 |
|
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1042 |
sender == languageHolder ifTrue:[ |
15826 | 1043 |
"/ languageHolder value class == Workflow::ExecutionEditorShellScript::Shell_Language ifTrue:[self halt]. |
1044 |
"/ languageHolder value == Workflow::ExecutionEditorShellScript::Shell_Language ifTrue:[self halt]. |
|
13942 | 1045 |
textView editedLanguage: languageHolder value. |
13813 | 1046 |
]. |
1047 |
||
1048 |
sender == modeHolder ifTrue:[ |
|
13942 | 1049 |
codeAspect := modeHolder value |
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1050 |
]. |
9985 | 1051 |
|
10245 | 1052 |
sender == showGutterChannel ifTrue: [ |
13942 | 1053 |
self updateGutterVisibility. |
1054 |
^self. |
|
10245 | 1055 |
]. |
9985 | 1056 |
|
13813 | 1057 |
services do:[:each | |
13942 | 1058 |
each isEnabled ifTrue:[ |
1059 |
each update:aspect with:param from:sender |
|
1060 |
] |
|
10662
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
1061 |
]. |
9985 | 1062 |
|
1063 |
super update:aspect with:param from:sender |
|
1064 |
||
10245 | 1065 |
"Modified: / 07-07-2011 / 12:07:04 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
10767 | 1066 |
"Modified: / 06-10-2011 / 14:14:36 / cg" |
13587
0f06b4a66ae7
Refactoring after moving codeAspect to EditTextView.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13584
diff
changeset
|
1067 |
"Modified: / 27-09-2013 / 10:16:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1068 |
! |
1069 |
||
12950 | 1070 |
updateGutter |
1071 |
||
1072 |
self showGutterChannel value ifTrue:[ |
|
1073 |
gutterView invalidate. |
|
1074 |
] |
|
1075 |
||
1076 |
"Created: / 23-06-2010 / 19:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1077 |
! |
|
1078 |
||
9985 | 1079 |
updateGutterVisibility |
1080 |
||
1081 |
self showGutterChannel value ifTrue:[ |
|
1082 |
textViewScroller origin:(gutterView width @ 0.0) corner:(1.0 @ 1.0). |
|
1083 |
gutterView beVisible. |
|
1084 |
] ifFalse:[ |
|
1085 |
textViewScroller origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
1086 |
gutterView beInvisible. |
|
1087 |
] |
|
1088 |
||
1089 |
"Created: / 23-06-2010 / 19:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14986 | 1090 |
! |
1091 |
||
1092 |
updateScrollersViewBackground |
|
1093 |
|allAnnotations scroller| |
|
1094 |
||
1095 |
allAnnotations := OrderedCollection new. |
|
1096 |
services do:[:eachService | |
|
1097 |
allAnnotations addAll:(eachService annotations ? #()) |
|
1098 |
]. |
|
1099 |
||
1100 |
scroller := textViewScroller verticalScrollBar thumb. |
|
1101 |
allAnnotations isEmptyOrNil ifTrue:[ |
|
1102 |
scroller viewBackground:(scroller backgroundColor) |
|
1103 |
] ifFalse:[ |
|
1104 |
scroller viewBackground:(AnnotationShowingScrollerBackground new annotations:allAnnotations; textView:textView; yourself ) |
|
1105 |
] |
|
9985 | 1106 |
! ! |
1107 |
||
1108 |
!CodeView2 methodsFor:'channels'! |
|
1109 |
||
1110 |
modifiedChannel |
|
1111 |
"return the valueHolder holding true if text was modified" |
|
1112 |
||
10245 | 1113 |
^ textView modifiedChannel |
1114 |
"/ ^ modifiedChannel |
|
1115 |
||
1116 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 1117 |
! |
1118 |
||
1119 |
modifiedChannel:aValueHolder |
|
1120 |
"set the valueHolder holding true if text was modified" |
|
1121 |
||
10662
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
1122 |
textView modifiedChannel removeDependent:self. |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
1123 |
textView modifiedChannel:aValueHolder. |
4d67f850e4f7
comment/format in: #update:with:from:
Claus Gittinger <cg@exept.de>
parents:
10630
diff
changeset
|
1124 |
textView modifiedChannel addDependent:self. |
10245 | 1125 |
|
1126 |
"/ |prev| |
|
1127 |
"/ |
|
1128 |
"/ prev := modifiedChannel. |
|
1129 |
"/ modifiedChannel := aValueHolder. |
|
1130 |
"/ self setupChannel:aValueHolder for:nil withOld:prev |
|
1131 |
||
1132 |
"Created: / 30-01-1998 / 14:51:32 / cg" |
|
1133 |
"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
|
1134 |
"Modified: / 05-09-2011 / 05:13:27 / cg" |
9985 | 1135 |
! |
1136 |
||
10785 | 1137 |
reallyModifiedChannel |
1138 |
"return the valueHolder holding true if text was modified" |
|
1139 |
||
1140 |
^ textView reallyModifiedChannel |
|
1141 |
||
1142 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
1143 |
"Created: / 08-10-2011 / 12:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1144 |
! |
|
1145 |
||
1146 |
reallyModifiedChannel: aValueModel |
|
1147 |
||
1148 |
^ textView reallyModifiedChannel: aValueModel |
|
1149 |
||
1150 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
1151 |
"Created: / 08-10-2011 / 12:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1152 |
! |
|
1153 |
||
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1154 |
showAcceptCancelBarChannel |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1155 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1156 |
^showAcceptCancelBarChannel |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1157 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1158 |
"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
|
1159 |
! |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1160 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1161 |
showAcceptCancelBarChannel:aValueHolder |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1162 |
"set the valueHolder holding true if text was modified" |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1163 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1164 |
|prev| |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1165 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1166 |
prev := showAcceptCancelBarChannel. |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1167 |
showAcceptCancelBarChannel := aValueHolder. |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1168 |
self setupChannel:aValueHolder for:nil withOld:prev. |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1169 |
|
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1170 |
"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
|
1171 |
! |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1172 |
|
9985 | 1173 |
showGutterChannel |
1174 |
||
1175 |
^showGutterChannel |
|
1176 |
||
1177 |
"Created: / 23-06-2010 / 19:02:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1178 |
! |
|
1179 |
||
1180 |
showGutterChannel:aValueHolder |
|
1181 |
"set the valueHolder holding true if text was modified" |
|
1182 |
||
1183 |
|prev| |
|
1184 |
||
1185 |
prev := showGutterChannel. |
|
1186 |
showGutterChannel := aValueHolder. |
|
1187 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
1188 |
||
1189 |
"Created: / 23-06-2010 / 19:03:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1190 |
! ! |
|
1191 |
||
10262 | 1192 |
!CodeView2 methodsFor:'code services'! |
1193 |
||
1194 |
browseMethod: method |
|
1195 |
||
1196 |
self browseMethod: method label: nil. |
|
1197 |
||
1198 |
"Created: / 14-02-2010 / 19:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1199 |
! |
|
1200 |
||
1201 |
browseMethod: method label: label |
|
1202 |
||
10877 | 1203 |
self browser isNil ifTrue: [^NewSystemBrowser openInMethod:method]. |
10262 | 1204 |
(UserPreferences current alwaysOpenNewTabWhenCtrlClick |
1205 |
or:[self browser navigationState modified]) |
|
1206 |
ifTrue: |
|
1207 |
[self browser |
|
1208 |
spawnFullBrowserInClass: method mclass |
|
1209 |
selector:method selector |
|
1210 |
in:#newBuffer] |
|
1211 |
ifFalse: |
|
1212 |
[self browser |
|
1213 |
switchToClass: method containingClass |
|
1214 |
selector: method selector]. |
|
1215 |
||
1216 |
"Modified: / 19-02-2008 / 10:15:17 / janfrog" |
|
1217 |
"Created: / 19-10-2008 / 08:16:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1218 |
"Modified: / 25-07-2010 / 13:34:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10877 | 1219 |
"Modified: / 18-11-2011 / 14:58:12 / cg" |
10262 | 1220 |
! |
1221 |
||
1222 |
browseMethods: methods label: label |
|
1223 |
||
1224 |
methods size = 1 ifTrue: |
|
1225 |
[^self browseMethod: methods anyOne label: label]. |
|
1226 |
||
1227 |
self browser |
|
1228 |
ifNil: [NewSystemBrowser browseMethods: methods title: label] |
|
1229 |
ifNotNil:[self browser spawnMethodBrowserFor:methods in:#newBuffer label:label] |
|
1230 |
||
1231 |
"Created: / 26-12-2007 / 11:32:04 / janfrog" |
|
1232 |
"Modified: / 19-10-2008 / 08:17:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1233 |
! |
|
1234 |
||
1235 |
extractSelectorAndSelectedTextFrom: givenSelectedText |
|
1236 |
| selector selectedText compilerClass na | |
|
11359 | 1237 |
|
10262 | 1238 |
selectedText := givenSelectedText. |
1239 |
compilerClass := self language compilerClass. |
|
1240 |
selectedText size > 0 ifTrue:[ |
|
11359 | 1241 |
"/ self windowGroup withWaitCursorDo:[ |
10262 | 1242 |
"/ hack, for now and expecco; must ask the Parser eventually... |
1243 |
(compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser]) ifTrue:[ |
|
1244 |
"/ selector is in one piece anyway |
|
1245 |
(selectedText includes:$_) ifFalse:[ |
|
1246 |
"/ zero or one args - sigh (need to parse more to figure this out) |
|
1247 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:1. |
|
1248 |
selectedText := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:0. |
|
1249 |
] ifTrue:[ |
|
1250 |
"/ count _#s plus one arg - sigh |
|
1251 |
na := (selectedText occurrencesOf:$_) + 1. |
|
1252 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:na |
|
1253 |
]. |
|
1254 |
] ifFalse:[ |
|
1255 |
selector := SystemBrowser extractSelectorFrom:selectedText. |
|
1256 |
]. |
|
11359 | 1257 |
"/ ] |
10262 | 1258 |
]. |
1259 |
^Array with: selector with: selectedText |
|
1260 |
||
1261 |
"Created: / 30-06-2011 / 19:49:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11359 | 1262 |
"Modified: / 05-03-2012 / 09:04:12 / cg" |
10262 | 1263 |
! |
1264 |
||
1265 |
implementorsOf: selector |
|
1266 |
||
10877 | 1267 |
selector isNil ifTrue:[^#()]. |
10262 | 1268 |
^SystemBrowser |
1269 |
findImplementorsOf: selector |
|
1270 |
in: Smalltalk allClasses |
|
1271 |
ignoreCase: false |
|
1272 |
||
1273 |
"Created: / 26-12-2007 / 11:37:11 / janfrog" |
|
10877 | 1274 |
"Modified: / 18-11-2011 / 14:58:17 / cg" |
10262 | 1275 |
! |
1276 |
||
1277 |
sendersOf: selector |
|
12868 | 1278 |
|senderBlock| |
10262 | 1279 |
|
10877 | 1280 |
selector isNil ifTrue:[^#()]. |
14447
10f98c40548b
fixed ALT-right click (senders of selector under cursor)
az
parents:
14439
diff
changeset
|
1281 |
selector knownAsSymbol ifFalse:[^#()]. |
12868 | 1282 |
|
1283 |
"/ not exact, but much faster (looks for symbol only, does not parse code for real send) |
|
14447
10f98c40548b
fixed ALT-right click (senders of selector under cursor)
az
parents:
14439
diff
changeset
|
1284 |
senderBlock := SystemBrowser searchBlockForSymbol:selector asSymbol. |
12868 | 1285 |
senderBlock == false ifTrue:[ ^ #() ]. |
1286 |
||
1287 |
^ SystemBrowser |
|
13942 | 1288 |
allMethodsIn:Smalltalk allClasses |
1289 |
where:senderBlock. |
|
13813 | 1290 |
|
1291 |
"/ exact, but much slower |
|
12868 | 1292 |
"/ ^SystemBrowser |
1293 |
"/ findSendersOf: selector |
|
1294 |
"/ in: Smalltalk allClasses |
|
1295 |
"/ ignoreCase: false |
|
10262 | 1296 |
|
1297 |
"Created: / 26-12-2007 / 11:37:22 / janfrog" |
|
1298 |
"Modified: / 30-06-2011 / 19:32:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10877 | 1299 |
"Modified: / 18-11-2011 / 14:58:19 / cg" |
14447
10f98c40548b
fixed ALT-right click (senders of selector under cursor)
az
parents:
14439
diff
changeset
|
1300 |
"Modified: / 04-06-2014 / 11:10:47 / az" |
10262 | 1301 |
! ! |
1302 |
||
9985 | 1303 |
!CodeView2 methodsFor:'delegation'! |
1304 |
||
1305 |
doesNotUnderstand: aMessage |
|
1306 |
||
1307 |
((textView respondsTo: aMessage selector) |
|
1308 |
and:[(TraceSelectors includes:aMessage selector) not]) |
|
1309 |
ifTrue:[^aMessage sendTo: textView]. |
|
1310 |
^super doesNotUnderstand: aMessage |
|
1311 |
||
1312 |
"Created: / 13-02-2010 / 23:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1313 |
"Modified: / 14-02-2010 / 09:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1314 |
! |
|
1315 |
||
1316 |
hasSelection |
|
1317 |
||
1318 |
^textView hasSelection |
|
1319 |
||
1320 |
"Created: / 14-02-2010 / 09:53:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1321 |
! ! |
|
1322 |
||
11393 | 1323 |
!CodeView2 methodsFor:'delegation-drawing'! |
9985 | 1324 |
|
1325 |
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
|
1326 |
"See the comment in |
|
1327 |
CodeViewService>>drawLine:in:atX..." |
|
1328 |
||
14927
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
1329 |
self servicesDo:[:each| |
9985 | 1330 |
each drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
1331 |
] |
|
1332 |
||
1333 |
"Created: / 17-06-2011 / 13:50:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1334 |
"Modified: / 06-10-2011 / 14:14:04 / cg" |
14927
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
1335 |
"Modified: / 27-11-2014 / 15:37:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1336 |
! |
1337 |
||
1338 |
redrawVisibleLine: visLineNr |
|
1339 |
||
1340 |
"Created: / 07-03-2010 / 14:44:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1341 |
! |
|
1342 |
||
1343 |
redrawVisibleLine:visLine col:colNr |
|
1344 |
||
1345 |
"Modified: / 05-11-2007 / 17:35:53 / cg" |
|
1346 |
"Modified: / 07-03-2010 / 14:45:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1347 |
! |
|
1348 |
||
1349 |
redrawVisibleLine:visLine from:startCol |
|
1350 |
||
1351 |
"Modified: / 07-03-2010 / 14:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1352 |
! |
|
1353 |
||
1354 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
1355 |
||
1356 |
"Modified: / 07-03-2010 / 14:46:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1357 |
! ! |
|
1358 |
||
11393 | 1359 |
!CodeView2 methodsFor:'delegation-events'! |
9985 | 1360 |
|
1361 |
buttonMotion: button x:x y:y in: view |
|
1362 |
"Delegates events to services. Answers true iff at least |
|
1363 |
one service handler method returns true. In that case, |
|
1364 |
the event is is NOT processes by the view." |
|
1365 |
||
12868 | 1366 |
^ services |
1367 |
contains:[:service | |
|
1368 |
service isEnabled and:[ ((service buttonMotion: button x:x y:y in: view) == true) ] |
|
1369 |
]. |
|
9985 | 1370 |
|
1371 |
"Modified: / 07-03-2010 / 13:53:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1372 |
"Modified: / 06-10-2011 / 14:13:57 / cg" |
9985 | 1373 |
! |
1374 |
||
14843 | 1375 |
buttonMultiPress: button x:x y:y in: view |
1376 |
"Delegates events to services. Answers true iff at least |
|
1377 |
one service handler method returns true. In that case, |
|
1378 |
the event is is NOT processes by the view." |
|
1379 |
||
1380 |
^ services |
|
1381 |
contains:[:service | |
|
1382 |
service isEnabled and:[ ((service buttonMultiPress: button x:x y:y in: view) == true) ] |
|
1383 |
]. |
|
1384 |
||
1385 |
"Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1386 |
"Modified: / 06-10-2011 / 14:14:00 / cg" |
|
1387 |
"Modified (format): / 05-03-2012 / 08:56:02 / cg" |
|
1388 |
! |
|
1389 |
||
14005 | 1390 |
buttonPress: button x:x y:y in: view |
1391 |
"Delegates events to services. Answers true iff at least |
|
1392 |
one service handler method returns true. In that case, |
|
1393 |
the event is is NOT processes by the view." |
|
1394 |
||
1395 |
^ services |
|
1396 |
contains:[:service | |
|
1397 |
service isEnabled and:[ ((service buttonPress: button x:x y:y in: view) == true) ] |
|
1398 |
]. |
|
1399 |
||
1400 |
"Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1401 |
"Modified: / 06-10-2011 / 14:14:00 / cg" |
|
1402 |
"Modified (format): / 05-03-2012 / 08:56:02 / cg" |
|
1403 |
! |
|
1404 |
||
12868 | 1405 |
buttonRelease: button x:x y:y in: view |
9985 | 1406 |
"Delegates events to services. Answers true iff at least |
1407 |
one service handler method returns true. In that case, |
|
1408 |
the event is is NOT processes by the view." |
|
1409 |
||
12868 | 1410 |
^ services |
1411 |
contains:[:service | |
|
1412 |
service isEnabled and:[ ((service buttonRelease: button x:x y:y in: view) == true) ] |
|
1413 |
]. |
|
1414 |
! |
|
1415 |
||
15170 | 1416 |
highlightClassVariable:name |
1417 |
"interface from browser (when a class var is selected)" |
|
1418 |
||
1419 |
services do:[:each| |
|
1420 |
each highlightClassVariable:name |
|
1421 |
]. |
|
1422 |
! |
|
1423 |
||
12992 | 1424 |
highlightInstanceVariable:name |
15170 | 1425 |
"interface from browser (when an inst var is selected)" |
1426 |
||
12992 | 1427 |
services do:[:each| |
1428 |
each highlightInstanceVariable:name |
|
1429 |
]. |
|
1430 |
! |
|
1431 |
||
12868 | 1432 |
keyPress: key x:x y:y in: view |
1433 |
"Delegates events to services. Answers true iff at least |
|
1434 |
one service handler method returns true. In that case, |
|
1435 |
the event is is NOT processes by the view." |
|
1436 |
||
1437 |
^ services |
|
1438 |
contains:[:service | |
|
13582 | 1439 |
|handledByService| |
1440 |
||
1441 |
handledByService := service isEnabled |
|
1442 |
and:[ ((service keyPress: key x:x y:y in: view) == true)]. |
|
1443 |
"/ handledByService ifTrue:[ Transcript showCR:'handled by ',service printString ]. |
|
1444 |
handledByService |
|
12868 | 1445 |
]. |
9985 | 1446 |
|
1447 |
"Modified: / 07-03-2010 / 13:54:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1448 |
"Modified: / 06-10-2011 / 14:14:11 / cg" |
9985 | 1449 |
! |
1450 |
||
1451 |
keyRelease: key x:x y:y in: view |
|
1452 |
"Delegates events to services. Answers true iff at least |
|
1453 |
one service handler method returns true. In that case, |
|
1454 |
the event is is NOT processes by the view." |
|
1455 |
||
12868 | 1456 |
^ services |
1457 |
contains:[:service | |
|
1458 |
service isEnabled and:[ ((service keyRelease: key x:x y:y in: view) == true) ] |
|
1459 |
]. |
|
9985 | 1460 |
|
1461 |
"Modified: / 07-03-2010 / 13:54:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 1462 |
"Modified: / 06-10-2011 / 14:14:13 / cg" |
9985 | 1463 |
! |
1464 |
||
10224 | 1465 |
linesDeletedFrom: start to: end |
1466 |
||
1467 |
services do: [:each | |
|
1468 |
each isEnabled ifTrue: [ |
|
1469 |
each linesDeletedFrom: start to: end |
|
1470 |
] |
|
1471 |
]. |
|
1472 |
||
1473 |
"Created: / 06-07-2011 / 17:12:54 / jv" |
|
10767 | 1474 |
"Modified: / 06-10-2011 / 14:14:16 / cg" |
10781 | 1475 |
"Modified: / 07-10-2011 / 19:14:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 1476 |
! |
1477 |
||
1478 |
linesInsertedFrom: start to: end |
|
1479 |
||
1480 |
services do: [:each | |
|
1481 |
each isEnabled ifTrue: [ |
|
1482 |
each linesInsertedFrom: start to: end |
|
1483 |
] |
|
1484 |
]. |
|
1485 |
||
1486 |
"Created: / 06-07-2011 / 17:12:48 / jv" |
|
10767 | 1487 |
"Modified: / 06-10-2011 / 14:14:20 / cg" |
10224 | 1488 |
! |
1489 |
||
1490 |
linesModifiedFrom: start to: end |
|
1491 |
||
1492 |
services do: [:each | |
|
1493 |
each isEnabled ifTrue: [ |
|
1494 |
each linesModifiedFrom: start to: end |
|
1495 |
] |
|
1496 |
]. |
|
1497 |
||
1498 |
"Created: / 06-07-2011 / 17:12:58 / jv" |
|
10767 | 1499 |
"Modified: / 06-10-2011 / 14:13:44 / cg" |
10224 | 1500 |
! |
1501 |
||
9985 | 1502 |
scrollDown: nLines in: view |
1503 |
||
1504 |
view == textView |
|
1505 |
ifTrue: |
|
1506 |
["/my text view scrolled... |
|
1507 |
synchronizedCodeViews do:[:codeView|codeView scrollDown: nLines in: view]] |
|
1508 |
ifFalse: |
|
1509 |
["/other code view scrolls and I'm notified about that |
|
1510 |
textView basicScrollDown: nLines] |
|
1511 |
||
1512 |
"Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>" |
|
1513 |
! |
|
1514 |
||
14005 | 1515 |
scrollTo:origin redraw:doRedraw in: view |
1516 |
view == textView ifTrue: [ |
|
1517 |
"/my text view scrolled... |
|
1518 |
synchronizedCodeViews do:[:codeView| |
|
1519 |
codeView scrollTo:origin redraw:doRedraw in: view. |
|
1520 |
] |
|
1521 |
] ifFalse: [ |
|
1522 |
"/other code view scrolls and I'm notified about that |
|
1523 |
textView basicScrollTo:origin redraw:doRedraw. |
|
1524 |
] |
|
1525 |
||
1526 |
"Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>" |
|
1527 |
"Created: / 19-03-2012 / 17:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1528 |
! |
|
1529 |
||
9985 | 1530 |
scrollUp: nLines in: view |
1531 |
||
1532 |
view == textView |
|
1533 |
ifTrue: |
|
1534 |
["/my text view scrolled... |
|
1535 |
synchronizedCodeViews do:[:codeView|codeView scrollUp: nLines in: view]] |
|
1536 |
ifFalse: |
|
1537 |
["/other code view scrolls and I'm notified about that |
|
1538 |
textView basicScrollUp: nLines] |
|
1539 |
||
1540 |
"Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>" |
|
1541 |
! ! |
|
1542 |
||
1543 |
!CodeView2 methodsFor:'diff mode'! |
|
1544 |
||
1545 |
recomputeDiff:view |
|
1546 |
|t1 t2 pom diffHelper view2| |
|
1547 |
||
1548 |
t1 := view getNewOriginText. |
|
1549 |
synchronizedCodeViews do:[:codeView | |
|
1550 |
view2 := codeView |
|
1551 |
]. |
|
1552 |
view changedDiffText:false. |
|
1553 |
view2 changedDiffText:false. |
|
1554 |
t2 := view2 getNewOriginText. |
|
1555 |
pom := DiffCodeView2 new. |
|
1556 |
(view == textView) ifTrue:[ |
|
1557 |
diffHelper := pom computeDiffDataForText1:t1 text2:t2. |
|
1558 |
(view) contents:(diffHelper text1). |
|
1559 |
(view) deletedLines:(diffHelper deleted). |
|
1560 |
(view) changedLines:(diffHelper changed). |
|
1561 |
(view) originDiffText:t1. |
|
1562 |
(view) emptyLines:(diffHelper inserted). |
|
1563 |
(view) changedLines:(diffHelper changed). |
|
1564 |
(view2) contents:(diffHelper text2). |
|
1565 |
(view2) insertedLines:(diffHelper inserted). |
|
1566 |
(view2) changedLines:(diffHelper changed). |
|
1567 |
(view2) originDiffText:t2. |
|
1568 |
(view2) emptyLines:(diffHelper deleted). |
|
1569 |
]. |
|
1570 |
||
1571 |
"Modified: / 22-06-2010 / 23:35:41 / Jakub <zelenja7@fel.cvut.cz>" |
|
1572 |
"Modified: / 23-06-2010 / 17:25:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1573 |
! ! |
|
1574 |
||
14545
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1575 |
!CodeView2 methodsFor:'initialize & release'! |
9985 | 1576 |
|
13208 | 1577 |
defaultServices |
1578 |
"/ used to call "CodeViewService availableServices", |
|
1579 |
"/ which enumerated all subclasses. |
|
1580 |
"/ this is BAD BAD BAD, because it does not allow for additional service |
|
1581 |
"/ subclasses to be built for special applications. For example, |
|
1582 |
"/ a debugging breakpoint service for a GDB application, a breakpoint service for |
|
1583 |
"/ expecco's codeview. |
|
1584 |
||
1585 |
"/ therefore, the list of services to use in codeView2 is now filtered |
|
1586 |
||
1587 |
^ CodeViewService availableServices |
|
1588 |
select:[:service | service isUsefulFor:self] |
|
1589 |
||
1590 |
"Created: / 22-07-2013 / 13:57:40 / cg" |
|
1591 |
! |
|
1592 |
||
9985 | 1593 |
initialize |
1594 |
"Invoked when a new instance is created." |
|
1595 |
"Call super initialize" |
|
13813 | 1596 |
|
9985 | 1597 |
super initialize. |
1598 |
"Now set up some visual properties" |
|
15893 | 1599 |
self level:(styleSheet at:#'codeView2.level' default:-1). |
9985 | 1600 |
"Now initialize sub-views" |
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1601 |
showGutterChannel := ValueHolder with: true. |
13813 | 1602 |
showGutterChannel addDependent: self. |
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1603 |
"/ toDo: I don't like two options in the settings; |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1604 |
"/ showAcceptCancelBarChannel := (ValueHolder with: (UserPreferences current showAcceptCancelBarInBrowser)). |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1605 |
showAcceptCancelBarChannel := ValueHolder with: (UserPreferences current codeView2ShowAcceptCancel). |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1606 |
|
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1607 |
"/ these views must be created first, as they refer to each other's channels in their |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1608 |
"/ initialize methods |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1609 |
gutterView := CodeView2::GutterView new. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1610 |
textViewScroller := HVScrollableView for: CodeView2::TextView in: self. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1611 |
textView := textViewScroller scrolledView. |
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1612 |
|
9985 | 1613 |
self initializeGutterView. |
1614 |
self initializeTextView. |
|
1615 |
textView setCodeView:self. |
|
13813 | 1616 |
modifiedChannel := ValueHolder with:false. |
9985 | 1617 |
diffMode := false. |
1618 |
synchronizedCodeViews := #(). |
|
13813 | 1619 |
currentParseNodeHolder := ValueHolder new. |
1620 |
currentBlockNodeHolder := ValueHolder new. |
|
10767 | 1621 |
|
1622 |
servicesFromClient := false. |
|
9985 | 1623 |
services := OrderedCollection new. |
10834 | 1624 |
self initializeServices. |
9985 | 1625 |
|
1626 |
"Modified: / 14-12-2009 / 13:59:53 / Jindra <a>" |
|
1627 |
"Modified: / 06-04-2010 / 13:56:35 / Jakub <zelenja7@fel.cvut.cz>" |
|
10767 | 1628 |
"Modified: / 06-10-2011 / 14:15:48 / cg" |
13813 | 1629 |
"Modified: / 16-02-2012 / 23:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1630 |
! |
1631 |
||
1632 |
initializeGutterView |
|
1633 |
||
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1634 |
gutterView setCodeView:self. |
13993 | 1635 |
gutterView currentBlockNodeHolder: self currentBlockNodeHolder. |
13316 | 1636 |
gutterView origin:(0.0 @ 0.0) corner:(gutterView preferredWidth+1 @ 1.0). |
9985 | 1637 |
showGutterChannel value ifTrue:[self addSubView: gutterView]. |
1638 |
||
1639 |
"Created: / 02-09-2009 / 21:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1640 |
"Modified: / 23-06-2010 / 19:14:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1641 |
! |
|
1642 |
||
1643 |
initializeServices |
|
1644 |
| serviceClasses | |
|
10409 | 1645 |
|
10755 | 1646 |
"/ only do it, if the services have not yet been defined by the user of this view |
1647 |
"/ (FileBrowser does not want Smalltalk-specific services) |
|
10767 | 1648 |
servicesFromClient ifFalse:[ |
13942 | 1649 |
serviceClasses := self defaultServices sort:[:a :b|a priority = b priority ifTrue:[a name < b name] ifFalse:[a priority > b priority]]. |
1650 |
serviceClasses do:[:cls| |
|
1651 |
self registerService: cls new |
|
1652 |
]. |
|
10755 | 1653 |
]. |
9985 | 1654 |
|
13208 | 1655 |
"Modified: / 22-07-2013 / 14:02:59 / cg" |
13813 | 1656 |
"Modified: / 24-07-2013 / 11:56:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1657 |
! |
1658 |
||
1659 |
initializeTextView |
|
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1660 |
"Initialize textView. gutterView has to be already initialized!!" |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
1661 |
|
9985 | 1662 |
textViewScroller |
1663 |
origin: ((self showGutter ifTrue:[gutterView width] ifFalse:[0.0]) @ 0.0) |
|
1664 |
corner: 1.0@1.0; |
|
1665 |
level: 0. |
|
1666 |
textView level: 0. |
|
1667 |
||
1668 |
textView modifiedChannel addDependent: self. |
|
1669 |
||
1670 |
"Created: / 02-09-2009 / 21:36:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1671 |
"Modified: / 23-06-2010 / 19:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14545
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1672 |
! |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1673 |
|
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1674 |
release |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1675 |
services do:[:service | service unregister ]. |
14549
077001d56ef7
Oops, fix in Tools::CodeView2>>release - release could be (and sometimes is) called twice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14545
diff
changeset
|
1676 |
services := #(). |
14545
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1677 |
|
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1678 |
textView model notNil ifTrue:[ |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1679 |
textView model removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1680 |
]. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1681 |
textView modifiedChannel notNil ifTrue:[ |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1682 |
textView modifiedChannel removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1683 |
]. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1684 |
showGutterChannel removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1685 |
languageHolder notNil ifTrue:[ |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1686 |
languageHolder removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1687 |
]. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1688 |
classHolder notNil ifTrue:[ |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1689 |
classHolder removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1690 |
]. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1691 |
methodHolder notNil ifTrue:[ |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1692 |
methodHolder removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1693 |
]. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1694 |
super release. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1695 |
|
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
1696 |
"Created: / 23-06-2014 / 20:16:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14549
077001d56ef7
Oops, fix in Tools::CodeView2>>release - release could be (and sometimes is) called twice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14545
diff
changeset
|
1697 |
"Modified: / 23-06-2014 / 22:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1698 |
! ! |
1699 |
||
1700 |
!CodeView2 methodsFor:'menu actions'! |
|
1701 |
||
10689 | 1702 |
accept |
1703 |
textView accept |
|
1704 |
||
1705 |
"Created: / 07-09-2011 / 21:29:07 / cg" |
|
1706 |
! |
|
1707 |
||
10375 | 1708 |
again |
1709 |
textView again |
|
1710 |
||
1711 |
"Created: / 16-02-2010 / 19:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1712 |
"Created: / 22-07-2011 / 17:44:31 / cg" |
|
1713 |
! |
|
1714 |
||
9985 | 1715 |
browseImplementorsOfIt |
10262 | 1716 |
|
1717 |
textView browseImplementorsOfIt |
|
1718 |
||
1719 |
"Modified: / 30-06-2011 / 19:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1720 |
! |
1721 |
||
1722 |
browseSendersOfIt |
|
10262 | 1723 |
|
1724 |
textView browseSendersOfIt |
|
1725 |
||
1726 |
"Modified: / 30-06-2011 / 19:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1727 |
! |
1728 |
||
1729 |
copySelection |
|
1730 |
||
1731 |
textView copySelection |
|
1732 |
||
1733 |
"Created: / 16-02-2010 / 19:36:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1734 |
! |
|
1735 |
||
1736 |
cut |
|
1737 |
||
1738 |
textView cut |
|
1739 |
||
1740 |
"Created: / 16-02-2010 / 19:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1741 |
! |
|
1742 |
||
1743 |
doIt |
|
1744 |
||
1745 |
textView doIt |
|
1746 |
||
1747 |
"Modified: / 16-02-2010 / 19:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1748 |
! |
|
1749 |
||
1750 |
inspectIt |
|
1751 |
||
1752 |
textView inspectIt |
|
1753 |
||
1754 |
"Modified: / 16-02-2010 / 19:38:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1755 |
! |
|
1756 |
||
1757 |
inspectSelectedSelector |
|
1758 |
||
1759 |
self error: 'Not yet implemented' |
|
1760 |
||
1761 |
"Modified: / 14-02-2010 / 15:58:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1762 |
! |
|
1763 |
||
1764 |
inspectSyntaxElements |
|
1765 |
||
1766 |
syntaxElements inspect |
|
1767 |
||
1768 |
"Modified: / 14-02-2010 / 15:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1769 |
! |
|
1770 |
||
1771 |
inspectView |
|
1772 |
||
1773 |
self inspect |
|
1774 |
||
1775 |
"Modified: / 25-03-2010 / 17:58:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1776 |
! |
|
1777 |
||
1778 |
pasteOrReplace |
|
1779 |
||
1780 |
textView pasteOrReplace |
|
1781 |
||
1782 |
"Created: / 16-02-2010 / 19:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1783 |
! |
|
1784 |
||
1785 |
printIt |
|
1786 |
||
1787 |
textView printIt |
|
1788 |
||
1789 |
"Modified: / 16-02-2010 / 19:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1790 |
! |
|
1791 |
||
1792 |
profileIt |
|
1793 |
||
1794 |
textView profileIt |
|
1795 |
||
1796 |
"Created: / 27-08-2010 / 22:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1797 |
! |
|
1798 |
||
1799 |
undo |
|
1800 |
||
1801 |
textView undo |
|
1802 |
||
1803 |
"Created: / 16-02-2010 / 19:35:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1804 |
! ! |
|
1805 |
||
1806 |
!CodeView2 methodsFor:'menus-dynamic'! |
|
1807 |
||
13108 | 1808 |
debugMenu |
1809 |
^ self class debugMenu decodeAsLiteralArray |
|
1810 |
receiver:self. |
|
1811 |
! |
|
1812 |
||
9985 | 1813 |
editMenu |
10780 | 1814 |
| editMenu superEditMenu moreMenu moreMenuItem | |
1815 |
||
1816 |
superEditMenu := textView superEditMenu. |
|
1817 |
||
1818 |
textView sensor ctrlDown ifTrue:[ |
|
1819 |
^superEditMenu |
|
1820 |
]. |
|
10293 | 1821 |
|
13072 | 1822 |
"/ install the standard 'more' menu into my own menu |
1823 |
moreMenu := superEditMenu subMenuAt: superEditMenu numberOfItems. |
|
1824 |
||
9985 | 1825 |
editMenu := self class editMenu decodeAsLiteralArray. |
1826 |
moreMenuItem := editMenu menuItemLabeled: 'More'. |
|
1827 |
moreMenuItem submenu: moreMenu asMenu. |
|
1828 |
editMenu findGuiResourcesIn: self. |
|
1829 |
^editMenu |
|
1830 |
||
1831 |
"Created: / 25-12-2007 / 10:10:01 / janfrog" |
|
1832 |
"Modified: / 25-12-2007 / 19:50:53 / janfrog" |
|
1833 |
"Modified: / 18-10-2008 / 20:31:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10293 | 1834 |
"Modified: / 08-07-2011 / 13:35:31 / cg" |
10780 | 1835 |
"Modified: / 07-10-2011 / 17:58:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1836 |
! |
1837 |
||
10262 | 1838 |
implementorsMenu |
1839 |
||
1840 |
| selectorAndSelectedText selector selectedText implementors | |
|
1841 |
||
1842 |
selectedText := textView selectionAsString. |
|
1843 |
selectedText size > 0 ifTrue:[ |
|
11359 | 1844 |
"/ self windowGroup withWaitCursorDo:[ |
10262 | 1845 |
selectorAndSelectedText := self extractSelectorAndSelectedTextFrom: selectedText. |
1846 |
selector := selectorAndSelectedText first. |
|
1847 |
selectedText := selectorAndSelectedText second. |
|
1848 |
||
1849 |
(selector notNil and:[selector = selectedText]) ifTrue:[ |
|
1850 |
implementors := (SystemBrowser |
|
11359 | 1851 |
findImplementorsOf:selectedText "Any: (Array with:selectedText)" |
1852 |
in:(Smalltalk allClasses) |
|
1853 |
ignoreCase:false) |
|
1854 |
||
1855 |
] ifFalse:[ |
|
10262 | 1856 |
implementors := (SystemBrowser |
11359 | 1857 |
findImplementorsOfAny:(Array with:selectedText with: selector) |
1858 |
in:(Smalltalk allClasses) |
|
1859 |
ignoreCase:false) |
|
1860 |
]. |
|
1861 |
"/ ] |
|
10262 | 1862 |
] ifFalse:[ |
1863 |
implementors := #(). |
|
1864 |
]. |
|
1865 |
||
1866 |
^self implementorsMenu: implementors selector: (selector ? selectedText) |
|
1867 |
||
1868 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1869 |
"Created: / 30-06-2011 / 19:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11359 | 1870 |
"Modified: / 05-03-2012 / 09:02:43 / cg" |
10262 | 1871 |
! |
1872 |
||
13813 | 1873 |
implementorsMenu: implementors selector: selector |
9985 | 1874 |
| menu| |
1875 |
||
1876 |
menu := Menu new. |
|
10465 | 1877 |
implementors isEmptyOrNil ifTrue:[ |
13942 | 1878 |
menu addItem:(MenuItem label:'No implementors found') disable |
9985 | 1879 |
] ifFalse:[ |
13942 | 1880 |
menu addItem:(MenuItem |
1881 |
label:(selector storeString , (' (all implementors) ') asText allItalic) |
|
1882 |
itemValue:[ |
|
1883 |
self browseMethods:implementors |
|
1884 |
label:'Implementors of ' , selector storeString |
|
1885 |
]). |
|
1886 |
||
1887 |
menu addSeparator. |
|
1888 |
(implementors asOrderedCollection sort:[:a :b | a mclass name < b mclass name]) |
|
1889 |
"implementors" do:[:mth | |
|
1890 |
menu |
|
1891 |
addItem:(MenuItem label:(selector storeString |
|
1892 |
, (' in ' , mth containingClass nameInBrowser asText allBold)) |
|
1893 |
itemValue:[ self browseMethod:mth label: 'Implementor of ' , selector storeString ]) |
|
1894 |
] |
|
9985 | 1895 |
]. |
1896 |
^ menu |
|
1897 |
||
1898 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1899 |
"Created: / 14-02-2010 / 19:39:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 1900 |
"Modified: / 07-03-2012 / 12:56:56 / cg" |
1901 |
"Modified: / 14-10-2013 / 10:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1902 |
! |
1903 |
||
10262 | 1904 |
sendersMenu |
1905 |
||
1906 |
| selectorAndSelectedText selector selectedText senders | |
|
1907 |
||
1908 |
selectedText := textView selectionAsString. |
|
1909 |
selectedText size > 0 ifTrue:[ |
|
11359 | 1910 |
"/ self windowGroup withWaitCursorDo:[ |
10262 | 1911 |
selectorAndSelectedText := self extractSelectorAndSelectedTextFrom: selectedText. |
1912 |
selector := selectorAndSelectedText first. |
|
1913 |
selectedText := selectorAndSelectedText second. |
|
1914 |
||
1915 |
(selector notNil and:[selector = selectedText]) ifTrue:[ |
|
1916 |
senders := (SystemBrowser |
|
11359 | 1917 |
findSendersOf:selectedText "Any:(Array with:selectedText)" |
10262 | 1918 |
in:(Smalltalk allClasses) |
1919 |
ignoreCase:false) |
|
1920 |
||
11359 | 1921 |
] ifFalse:[ |
10262 | 1922 |
senders := (SystemBrowser |
1923 |
findSendersOfAny:(Array with:selectedText with: selector) |
|
1924 |
in:(Smalltalk allClasses) |
|
1925 |
ignoreCase:false) |
|
11359 | 1926 |
]. |
1927 |
"/ ] |
|
10262 | 1928 |
] ifFalse:[ |
1929 |
senders := #(). |
|
1930 |
]. |
|
1931 |
||
1932 |
^self sendersMenu: senders selector: (selector ? selectedText) |
|
1933 |
||
1934 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1935 |
"Created: / 30-06-2011 / 19:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11359 | 1936 |
"Modified: / 05-03-2012 / 09:02:56 / cg" |
10262 | 1937 |
! |
1938 |
||
13813 | 1939 |
sendersMenu: senders selector: selector |
11377 | 1940 |
| menu shownSenderItems numCut sendersSorted| |
9985 | 1941 |
|
10262 | 1942 |
menu := Menu new. |
10465 | 1943 |
senders isEmptyOrNil ifTrue:[ |
13942 | 1944 |
menu addItem:(MenuItem label:'No senders found') disable |
9985 | 1945 |
] ifFalse:[ |
13942 | 1946 |
menu addItem:(MenuItem |
1947 |
label:(selector storeString , (' (all senders)') asText allItalic) |
|
1948 |
itemValue:[ |
|
1949 |
self browseMethods:senders |
|
1950 |
label:'Senders of ' , selector storeString |
|
1951 |
]). |
|
1952 |
menu addSeparator. |
|
1953 |
sendersSorted := senders asOrderedCollection |
|
1954 |
sort:[:a :b | a whoString < b whoString]. |
|
1955 |
shownSenderItems := (senders size > 20) ifTrue:[sendersSorted copyTo:20] ifFalse:[sendersSorted]. |
|
1956 |
numCut := senders size - 20. |
|
1957 |
shownSenderItems do:[:mth | |
|
1958 |
menu |
|
1959 |
addItem:(MenuItem label:(mth selector storeString |
|
1960 |
, (' in ' , mth containingClass nameInBrowser asText allBold)) |
|
1961 |
itemValue:[ self browseMethod:mth label: 'Sender of ' , selector storeString ]) |
|
1962 |
]. |
|
1963 |
numCut > 0 ifTrue:[ |
|
1964 |
menu addSeparator. |
|
1965 |
menu addItem:(MenuItem label:('... %1 more senders not shown here' bindWith:numCut)) disable |
|
1966 |
]. |
|
9985 | 1967 |
]. |
1968 |
^ menu |
|
1969 |
||
1970 |
"Modified: / 19-10-2008 / 08:17:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1971 |
"Created: / 14-02-2010 / 19:40:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10262 | 1972 |
"Modified: / 07-07-2011 / 14:51:54 / jv" |
13813 | 1973 |
"Modified: / 07-03-2012 / 12:58:31 / cg" |
1974 |
"Modified: / 14-10-2013 / 10:47:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1975 |
! |
1976 |
||
1977 |
servicesMenu |
|
10293 | 1978 |
|menu item anyService| |
1979 |
||
9985 | 1980 |
menu := Menu new. |
13110 | 1981 |
item := (MenuItem label:(resources string:'Services (experimental)')) enabled:false. |
1982 |
menu addItem:item. |
|
1983 |
menu addSeparator. |
|
10293 | 1984 |
|
13097 | 1985 |
"/ disabled, because this menu is now on the gutter, |
1986 |
"/ and it makes it hard to show it again, once hidden |
|
1987 |
||
1988 |
"/ item := MenuItem label:(resources string:'Show Gutter'). |
|
1989 |
"/ item indication:(self showGutterChannel). |
|
1990 |
"/ menu addItem:item. |
|
1991 |
"/ menu addSeparator. |
|
10293 | 1992 |
|
1993 |
anyService := false. |
|
1994 |
services do:[:service | |
|
1995 |
|item| |
|
1996 |
||
1997 |
item := MenuItem label:(resources string:service label). |
|
1998 |
item indication:((AspectAdaptor forAspect:#enabled) subject:service). |
|
13108 | 1999 |
item hideMenuOnActivated:false. |
10293 | 2000 |
menu addItem:item. |
2001 |
anyService := true. |
|
2002 |
]. |
|
2003 |
||
2004 |
anyService ifTrue:[ |
|
2005 |
menu addSeparator. |
|
2006 |
]. |
|
2007 |
||
2008 |
item := MenuItem label:(resources string:'Debug'). |
|
13108 | 2009 |
item submenuChannel:[ self debugMenu ]. |
10293 | 2010 |
menu addItem:item. |
2011 |
||
2012 |
^ menu |
|
9985 | 2013 |
|
2014 |
"Created: / 07-03-2010 / 14:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10767 | 2015 |
"Modified: / 06-10-2011 / 14:14:30 / cg" |
9985 | 2016 |
! ! |
2017 |
||
2018 |
!CodeView2 methodsFor:'private'! |
|
2019 |
||
2020 |
codeCompletion |
|
14110 | 2021 |
"/ I found this code 3 times (CodeView2, NewSystemBrowser and DebugView) - smell? |
2022 |
"/ (can we move that to a utility - probably DoWhatIMeanSupport) |
|
2023 |
||
2024 |
|cls language| |
|
9985 | 2025 |
|
2026 |
cls := self classHolder value. |
|
14110 | 2027 |
cls notNil ifTrue:[ |
2028 |
language := cls programmingLanguage |
|
9985 | 2029 |
]. |
2030 |
UserInformation handle:[:ex | |
|
2031 |
self showInfo:(ex messageText). |
|
2032 |
ex proceed. |
|
2033 |
] do:[ |
|
2034 |
self withWaitCursorDo:[ |
|
14110 | 2035 |
DoWhatIMeanSupport codeCompletionForLanguage:language class:cls context:nil codeView:self. |
9985 | 2036 |
] |
2037 |
]. |
|
2038 |
^ self. |
|
2039 |
||
2040 |
"Modified: / 04-07-2006 / 18:48:26 / fm" |
|
2041 |
"Modified: / 20-11-2006 / 12:30:59 / cg" |
|
13559
5215c061491c
Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13517
diff
changeset
|
2042 |
"Modified: / 18-09-2013 / 14:18:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2043 |
! |
2044 |
||
2045 |
reallyModified |
|
2046 |
"check for modified code by comparing the source against |
|
14439 | 2047 |
the codeView's contents. |
14503 | 2048 |
That's the true modified value |
2049 |
(in case user undid his changes, and the displayed text is actually original)" |
|
2050 |
||
2051 |
|modified| |
|
2052 |
||
2053 |
"/ cg: why this? It does not make sense to me. |
|
2054 |
"/ either we can depend on what the textView tells me here |
|
2055 |
"/ in which case we don't need the code below, |
|
2056 |
"/ or we cannot, in which the textView modified query should be removed. |
|
2057 |
"/ from tracing, it looks as if the textView modified query is correct all the time. |
|
2058 |
"/ Can someone validate/verify this, please? |
|
2059 |
textView modified ifTrue:[^true]. |
|
2060 |
||
2061 |
"/ higher prio to prevent it from being changed while we convert it (by editing) |
|
9985 | 2062 |
Processor activeProcess |
2063 |
withHigherPriorityDo:[ |
|
14503 | 2064 |
modified := textView isTextDifferentFromOriginalSource. |
9985 | 2065 |
]. |
2066 |
||
2067 |
^ modified |
|
2068 |
||
2069 |
"Created: / 06-02-2010 / 19:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11559 | 2070 |
"Modified (format): / 05-06-2012 / 23:55:02 / cg" |
9985 | 2071 |
! |
2072 |
||
2073 |
showInfo: message |
|
2074 |
||
2075 |
| app | |
|
2076 |
(app := self topView application) ifNotNil: |
|
2077 |
[(app respondsTo: #showInfo:) ifTrue: |
|
2078 |
[app showInfo: message]]. |
|
2079 |
||
2080 |
"Modified: / 13-02-2010 / 23:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2081 |
! ! |
|
2082 |
||
2083 |
!CodeView2 methodsFor:'private-accessing'! |
|
2084 |
||
2085 |
gutterView |
|
2086 |
||
2087 |
^gutterView |
|
2088 |
||
2089 |
"Created: / 14-02-2010 / 15:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2090 |
! |
|
2091 |
||
2092 |
syntaxElementSelection |
|
2093 |
^ syntaxElementSelection |
|
2094 |
! |
|
2095 |
||
13813 | 2096 |
syntaxElementSelection:anElement |
2097 |
syntaxElementSelection := anElement. |
|
2098 |
"/ anElement isNil ifTrue:[ |
|
2099 |
"/ currentParseNodeHolder value: nil. |
|
2100 |
"/"/ currentBlockNodeHolder value: nil. |
|
2101 |
"/ ] ifFalse:[ |
|
2102 |
"/ currentParseNodeHolder value: anElement node. |
|
2103 |
"/"/ currentBlockNodeHolder value: anElement node enclosingBlock. |
|
2104 |
"/ ] |
|
2105 |
||
2106 |
"Modified: / 24-09-2013 / 00:14:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 2107 |
! |
2108 |
||
2109 |
syntaxElements |
|
2110 |
^ syntaxElements |
|
2111 |
! |
|
2112 |
||
14705
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2113 |
syntaxElements:aCollection |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2114 |
aCollection notNil ifTrue:[ |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2115 |
aCollection isSortedCollection ifFalse:[ |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2116 |
aCollection sort. |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2117 |
]. |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2118 |
]. |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2119 |
syntaxElements := aCollection. |
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2120 |
|
4750b6f40d9a
Temporary hack - sort syntaxElements if not already/
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14674
diff
changeset
|
2121 |
"Modified: / 08-08-2014 / 13:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2122 |
! |
2123 |
||
2124 |
textView |
|
2125 |
||
2126 |
^textView |
|
2127 |
||
2128 |
"Created: / 14-02-2010 / 15:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2129 |
! |
|
2130 |
||
2131 |
textViewScroller |
|
2132 |
||
2133 |
^textViewScroller |
|
2134 |
||
2135 |
"Created: / 14-02-2010 / 15:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2136 |
! ! |
|
2137 |
||
11179 | 2138 |
!CodeView2 methodsFor:'realization'! |
2139 |
||
13062 | 2140 |
disableAllServices |
2141 |
||
2142 |
services do:[:service| |
|
2143 |
service enabled:false. |
|
2144 |
] |
|
2145 |
! |
|
2146 |
||
2147 |
enableAllServices |
|
2148 |
||
2149 |
services do:[:service| |
|
2150 |
service enabled:true. |
|
2151 |
] |
|
2152 |
! |
|
2153 |
||
11179 | 2154 |
postRealize |
2155 |
||
2156 |
services do:[:service| |
|
2157 |
service viewRealized. |
|
2158 |
] |
|
2159 |
||
2160 |
"Created: / 23-01-2012 / 10:35:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2161 |
! ! |
|
2162 |
||
13975
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2163 |
!CodeView2 methodsFor:'redrawing'! |
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2164 |
|
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2165 |
flash |
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2166 |
textView flash. |
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2167 |
|
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2168 |
"Created: / 21-02-2014 / 16:57:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14988 | 2169 |
! |
2170 |
||
2171 |
flash: aString |
|
15826 | 2172 |
"delegated to my textview" |
2173 |
||
2174 |
textView flash:aString. |
|
2175 |
! |
|
2176 |
||
2177 |
flash: aString withColor:flashColor |
|
2178 |
"delegated to my textview" |
|
2179 |
||
14988 | 2180 |
textView flash:aString. |
13975
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2181 |
! ! |
21b5fc56a638
Added Tools::CodeView2>>#flash
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13962
diff
changeset
|
2182 |
|
9985 | 2183 |
!CodeView2 methodsFor:'services'! |
2184 |
||
13108 | 2185 |
breakpointService |
2186 |
"that one or nil" |
|
14844 | 2187 |
|
13108 | 2188 |
^ services detect:[:any| (any isKindOf: BreakpointService)] ifNone:nil |
2189 |
! |
|
2190 |
||
9985 | 2191 |
registerService: aCodeViewService |
2192 |
||
2193 |
services add: aCodeViewService. |
|
2194 |
aCodeViewService registerIn: self |
|
2195 |
||
2196 |
"Created: / 06-03-2010 / 19:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2197 |
! |
|
2198 |
||
14843 | 2199 |
servicesDo:aBlock |
14927
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
2200 |
services notNil ifTrue:[ |
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
2201 |
services do:[ :service | service isEnabled ifTrue:[ aBlock value: service ] ] |
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
2202 |
] |
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
2203 |
|
b109a354435c
Fixes for enabling / disabling individual CodeView2 services.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14915
diff
changeset
|
2204 |
"Modified: / 27-11-2014 / 15:38:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14843 | 2205 |
! |
2206 |
||
13108 | 2207 |
syntaxHighlightingService |
2208 |
"that one or nil" |
|
2209 |
||
2210 |
^ services detect:[:any| (any isKindOf: CodeHighlightingService)] ifNone:nil |
|
2211 |
! |
|
2212 |
||
13125 | 2213 |
unregisterAllServices |
2214 |
||
2215 |
services copy do:[:eachService | self unregisterService:eachService ]. |
|
2216 |
! |
|
2217 |
||
11616 | 2218 |
unregisterService: aCodeViewService |
9985 | 2219 |
|
2220 |
services remove: aCodeViewService ifAbsent:[^self]. |
|
2221 |
aCodeViewService unregister. |
|
2222 |
||
2223 |
"Created: / 06-03-2010 / 19:21:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11616 | 2224 |
"Created: / 19-07-2012 / 16:34:18 / cg" |
9985 | 2225 |
! ! |
2226 |
||
2227 |
!CodeView2 methodsFor:'testing'! |
|
2228 |
||
14915 | 2229 |
hasOwnScrollbars |
2230 |
"a hack for codeView2, which behaves like a TextView, but has its own |
|
2231 |
scrollbars embedded - sigh (an extra load one). |
|
2232 |
This allows for the UIBuilder to avoid creating an extra set around such |
|
2233 |
a view (as is the case with TextSpec with scrollbars when using CodeView2)" |
|
2234 |
||
2235 |
^ true |
|
2236 |
! |
|
2237 |
||
10722 | 2238 |
isCodeView2 |
2239 |
||
2240 |
^true |
|
2241 |
||
2242 |
"Created: / 20-07-2010 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2243 |
! |
|
2244 |
||
9985 | 2245 |
isTextView |
2246 |
||
2247 |
^true |
|
2248 |
||
2249 |
"Created: / 14-02-2010 / 22:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2250 |
! ! |
|
2251 |
||
14986 | 2252 |
!CodeView2::AnnotationShowingScrollerBackground class methodsFor:'documentation'! |
2253 |
||
2254 |
documentation |
|
2255 |
" |
|
2256 |
I am a scroller background used to show annotation positions |
|
2257 |
(very similar to the DiffTextScrollerBackground). |
|
2258 |
I draw little markers at positions where annotations are. |
|
2259 |
||
2260 |
I need a reference to the textView and the list of annotations. |
|
2261 |
" |
|
2262 |
! ! |
|
2263 |
||
2264 |
!CodeView2::AnnotationShowingScrollerBackground methodsFor:'accessing'! |
|
2265 |
||
2266 |
annotations:something |
|
2267 |
annotations := something. |
|
2268 |
! |
|
2269 |
||
2270 |
textView:something |
|
2271 |
textView := something. |
|
2272 |
! ! |
|
2273 |
||
2274 |
!CodeView2::AnnotationShowingScrollerBackground methodsFor:'drawing'! |
|
2275 |
||
2276 |
fillRectangleX:x y:y width:w height:h in:aScroller |
|
2277 |
|overAllHeight| |
|
2278 |
||
2279 |
annotations isEmptyOrNil ifTrue:[^ self ]. |
|
2280 |
||
2281 |
overAllHeight := textView numberOfLines. |
|
14992 | 2282 |
overAllHeight = 0 ifTrue:[ ^ self ]. |
2283 |
||
14986 | 2284 |
annotations do:[:eachAnnotation | |
2285 |
|lineNr yThumb clr1 clr2| |
|
2286 |
||
2287 |
(lineNr := eachAnnotation line) notNil ifTrue:[ |
|
2288 |
yThumb := (aScroller height * (lineNr / overAllHeight)) rounded. |
|
2289 |
(yThumb between:y-5 and:(y + h + 5)) ifTrue:[ |
|
2290 |
clr1 := Color yellow lightened lightened. |
|
2291 |
clr2 := clr1 darkened. |
|
2292 |
aScroller paint:clr1. |
|
2293 |
aScroller fillRectangleX:3 y:(yThumb-5 max:0) width:aScroller width-5 height:8. |
|
2294 |
aScroller paint:clr2. |
|
2295 |
aScroller displayRectangleX:3 y:(yThumb-5 max:0) width:aScroller width-5 height:10. |
|
2296 |
]. |
|
2297 |
]. |
|
2298 |
] |
|
2299 |
! ! |
|
2300 |
||
2301 |
!CodeView2::AnnotationShowingScrollerBackground methodsFor:'ignored conversion'! |
|
2302 |
||
2303 |
asFormOn:aDevice |
|
2304 |
"superclass AbstractBackground says that I am responsible to implement this method" |
|
2305 |
||
2306 |
^ self |
|
2307 |
! |
|
2308 |
||
2309 |
onDevice:aDevice |
|
2310 |
"superclass AbstractBackground says that I am responsible to implement this method" |
|
2311 |
||
2312 |
^ self |
|
2313 |
! ! |
|
2314 |
||
9985 | 2315 |
!CodeView2::GutterView methodsFor:'accessing'! |
2316 |
||
13098 | 2317 |
menuHolder:aValueThing |
2318 |
menuHolder := aValueThing |
|
2319 |
! |
|
2320 |
||
9985 | 2321 |
setTextView: aTextView |
2322 |
||
2323 |
self assert: textView isNil message:'Attempting to set textView twice'. |
|
2324 |
textView := aTextView. |
|
2325 |
||
13057 | 2326 |
textView addDependent:self. |
2327 |
||
10577 | 2328 |
"/ self backgroundPaint: textView backgroundPaint darkened lighter. |
2329 |
self viewBackground: (View defaultBackgroundColor). "/ textView backgroundPaint darkened lighter. |
|
9985 | 2330 |
self paint: textView paint. |
2331 |
self font: textView font. |
|
2332 |
||
2333 |
"Created: / 02-09-2009 / 21:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2334 |
"Modified: / 14-12-2009 / 15:09:29 / Jindra <a>" |
|
2335 |
"Modified: / 09-02-2010 / 20:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10577 | 2336 |
"Modified: / 17-08-2011 / 15:15:09 / cg" |
9985 | 2337 |
! |
2338 |
||
2339 |
setTextViewScroller:aScr |
|
2340 |
textViewScroller := aScr. |
|
2341 |
||
2342 |
"Created: / 07-12-2009 / 22:36:31 / Jindra <a>" |
|
13567 | 2343 |
! |
2344 |
||
2345 |
showLineNumbers:aBoolean |
|
2346 |
"can be used to turn off linenumber drawing, |
|
2347 |
in case the gutter is used with another view anf only the other features (breakpoints) are needed" |
|
2348 |
||
2349 |
showLineNumbers := aBoolean. |
|
9985 | 2350 |
! ! |
2351 |
||
2352 |
!CodeView2::GutterView methodsFor:'accessing-dimensions'! |
|
2353 |
||
10781 | 2354 |
acceptButtonBottom |
2355 |
||
10791 | 2356 |
^(self height * 0.6) ceiling. |
10781 | 2357 |
|
2358 |
"Created: / 07-10-2011 / 19:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2359 |
! |
|
2360 |
||
13813 | 2361 |
acceptCancelRight |
13942 | 2362 |
^((self paddingLeft) + self usedWidthForAcceptCancel) |
13813 | 2363 |
|
2364 |
"Created: / 10-09-2013 / 03:00:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13942 | 2365 |
"Modified: / 14-02-2014 / 12:06:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13813 | 2366 |
! |
2367 |
||
10781 | 2368 |
cancelButtonBottom |
2369 |
||
10791 | 2370 |
^(self height * 0.8) ceiling. |
10781 | 2371 |
|
2372 |
"Created: / 07-10-2011 / 19:54:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2373 |
! |
|
2374 |
||
9985 | 2375 |
padding |
2376 |
||
2377 |
^self paddingLeft + self paddingRight |
|
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2378 |
+ self usedWidthForAcceptCancel |
9985 | 2379 |
+ (widthAnnotations ? 0) |
2380 |
+ (widthDiffInfo ? 0) |
|
2381 |
||
2382 |
"Created: / 14-02-2010 / 22:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10781 | 2383 |
"Modified: / 07-10-2011 / 19:01:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2384 |
"Modified (format): / 07-10-2011 / 20:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 2385 |
! |
2386 |
||
2387 |
paddingLeft |
|
2388 |
||
2389 |
^0"px" |
|
2390 |
||
2391 |
"Created: / 14-02-2010 / 22:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2392 |
"Modified: / 16-06-2011 / 13:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2393 |
! |
|
2394 |
||
2395 |
paddingRight |
|
2396 |
||
13813 | 2397 |
^3"px" |
9985 | 2398 |
|
2399 |
"Created: / 14-02-2010 / 22:27:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 2400 |
"Modified: / 16-02-2012 / 22:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2401 |
! |
2402 |
||
2403 |
preferredExtent |
|
11467 | 2404 |
| font w h | |
9985 | 2405 |
|
14986 | 2406 |
explicitExtent notNil ifTrue:[ ^ explicitExtent ]. |
2407 |
preferredExtent notNil ifTrue:[ ^ preferredExtent ]. |
|
9985 | 2408 |
|
11467 | 2409 |
font := self font. |
2410 |
w := (font widthOf:'00') + self padding. |
|
2411 |
h := textView notNil |
|
2412 |
ifTrue:[textView height] |
|
2413 |
ifFalse:[font height * 12]. |
|
9985 | 2414 |
|
2415 |
^preferredExtent := w @ h |
|
2416 |
||
2417 |
"Modified: / 16-06-2011 / 14:03:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11467 | 2418 |
"Modified (format): / 26-03-2012 / 11:19:54 / cg" |
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2419 |
! |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2420 |
|
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2421 |
usedWidthForAcceptCancel |
13567 | 2422 |
^ (codeView notNil and:[codeView showAcceptCancelBar]) ifTrue:[widthAcceptCancel ? 0] ifFalse:[0] |
9985 | 2423 |
! ! |
2424 |
||
10781 | 2425 |
!CodeView2::GutterView methodsFor:'actions'! |
2426 |
||
2427 |
accept |
|
2428 |
||
2429 |
textView accept |
|
2430 |
||
2431 |
"Created: / 07-10-2011 / 20:23:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2432 |
! |
|
2433 |
||
2434 |
cancel |
|
2435 |
||
2436 |
textView cancel |
|
2437 |
||
2438 |
"Created: / 07-10-2011 / 20:23:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2439 |
! |
|
2440 |
||
2441 |
diff |
|
2442 |
||
2443 |
"Created: / 07-10-2011 / 20:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13097 | 2444 |
! |
2445 |
||
13108 | 2446 |
inspectView |
2447 |
self halt. |
|
2448 |
! |
|
2449 |
||
13098 | 2450 |
middleButtonMenu |
2451 |
menuHolder notNil ifTrue:[^ menuHolder value]. |
|
13567 | 2452 |
codeView isNil ifTrue:[^ nil]. |
13097 | 2453 |
^ codeView servicesMenu |
10781 | 2454 |
! ! |
2455 |
||
13813 | 2456 |
!CodeView2::GutterView methodsFor:'aspects'! |
2457 |
||
2458 |
currentBlockNodeHolder |
|
2459 |
"return/create the 'currentBlockNodeHolder' value holder (automatically generated)" |
|
2460 |
||
2461 |
currentBlockNodeHolder isNil ifTrue:[ |
|
13942 | 2462 |
currentBlockNodeHolder := ValueHolder new. |
2463 |
currentBlockNodeHolder addDependent:self. |
|
13813 | 2464 |
]. |
2465 |
^ currentBlockNodeHolder |
|
2466 |
! |
|
2467 |
||
2468 |
currentBlockNodeHolder:something |
|
2469 |
"set the 'currentBlockNodeHolder' value holder (automatically generated)" |
|
2470 |
||
2471 |
|oldValue newValue| |
|
2472 |
||
2473 |
currentBlockNodeHolder notNil ifTrue:[ |
|
13942 | 2474 |
oldValue := currentBlockNodeHolder value. |
2475 |
currentBlockNodeHolder removeDependent:self. |
|
13813 | 2476 |
]. |
2477 |
currentBlockNodeHolder := something. |
|
2478 |
currentBlockNodeHolder notNil ifTrue:[ |
|
13942 | 2479 |
currentBlockNodeHolder addDependent:self. |
13813 | 2480 |
]. |
2481 |
newValue := currentBlockNodeHolder value. |
|
2482 |
oldValue ~~ newValue ifTrue:[ |
|
13942 | 2483 |
self update:#value with:newValue from:currentBlockNodeHolder. |
13813 | 2484 |
]. |
2485 |
! ! |
|
2486 |
||
9985 | 2487 |
!CodeView2::GutterView methodsFor:'change & update'! |
2488 |
||
13057 | 2489 |
adjustSizeForLongestLine |
13098 | 2490 |
"recompute the required width (longest linenumber present, not shown)" |
2491 |
||
2492 |
|newNumberOfLines longestLineString textW requiredW newWidth| |
|
2493 |
||
13568 | 2494 |
showLineNumbers ifFalse:[^ self]. |
2495 |
||
13105 | 2496 |
newNumberOfLines := (textView list size max:textView cursorLine). |
13098 | 2497 |
|
2498 |
longestLineString := self displayedString:(newNumberOfLines max:99). |
|
13057 | 2499 |
textW := (longestLineString widthOn:self). |
2500 |
requiredW := textW + self padding. |
|
2501 |
||
2502 |
((requiredW > width) or:[requiredW < (width * 3 // 4)]) ifTrue:[ |
|
2503 |
"/ some hysteresis to avoid quick readjust again |
|
13316 | 2504 |
newWidth := (requiredW "* 1.1") rounded. |
13057 | 2505 |
self corner:(newWidth+1 @ 1.0). |
13316 | 2506 |
|
13085 | 2507 |
[ |
2508 |
textView removeDependent:self. |
|
13568 | 2509 |
textViewScroller notNil ifTrue:[ textViewScroller origin:(newWidth+1 @ 0.0) corner:(1.0 @ 1.0) ]. |
13085 | 2510 |
] ensure:[ |
2511 |
textView addDependent:self. |
|
2512 |
]. |
|
13057 | 2513 |
self invalidate. |
13098 | 2514 |
] ifFalse:[ |
2515 |
numberOfLines ~= newNumberOfLines ifTrue:[ |
|
2516 |
self invalidate |
|
2517 |
] |
|
13057 | 2518 |
]. |
2519 |
! |
|
2520 |
||
9985 | 2521 |
update:something with:aParameter from:changedObject |
14127 | 2522 |
|deltaY numPixels hScrollerHeight| |
9985 | 2523 |
|
10326 | 2524 |
(changedObject == textView) ifTrue:[ |
13942 | 2525 |
((something == #sizeOfContents) |
2526 |
or:[ "false "(something == #visibility)"" ]) ifTrue:[ |
|
2527 |
self adjustSizeForLongestLine. |
|
13057 | 2528 |
|
14127 | 2529 |
"/ (numberOfLines ~= (textView list size max:textView cursorLine)) ifTrue:[ |
2530 |
"/ self invalidate. |
|
2531 |
"/ ]. |
|
13942 | 2532 |
^ self. |
2533 |
]. |
|
2534 |
something == #originOfContents ifTrue:[ |
|
14127 | 2535 |
aParameter notNil ifTrue:[ |
2536 |
deltaY := aParameter y. |
|
2537 |
deltaY = 0 ifTrue:[^ self]. |
|
2538 |
||
2539 |
numPixels := deltaY abs. |
|
2540 |
numPixels < (height // 5) ifTrue:[ |
|
2541 |
deltaY < 0 ifTrue:[ |
|
2542 |
self invalidateX:0 y:0 width:width height:numPixels. |
|
2543 |
] ifFalse:[ |
|
2544 |
hScrollerHeight := 0. |
|
2545 |
(textViewScroller notNil |
|
2546 |
and:[textViewScroller horizontalScrollBar notNil]) ifTrue:[ |
|
2547 |
hScrollerHeight := textViewScroller horizontalScrollBar height. |
|
2548 |
]. |
|
2549 |
numPixels := numPixels + 4. |
|
2550 |
self invalidateX:0 y:height-numPixels-hScrollerHeight width:width height:numPixels+hScrollerHeight. |
|
2551 |
]. |
|
15520 | 2552 |
"/ self repairDamage. |
14127 | 2553 |
^ self. |
2554 |
]. |
|
2555 |
]. |
|
13942 | 2556 |
self invalidateLines. |
2557 |
^ self. |
|
2558 |
]. |
|
2559 |
"/ something printCR. |
|
10312 | 2560 |
]. |
13057 | 2561 |
|
10781 | 2562 |
(changedObject == textView reallyModifiedChannel) ifTrue:[ |
13942 | 2563 |
self invalidateAcceptCancelBar. |
2564 |
^self. |
|
10781 | 2565 |
]. |
9985 | 2566 |
|
2567 |
super update:something with:aParameter from:changedObject |
|
2568 |
||
10326 | 2569 |
"Modified (format): / 15-07-2011 / 20:14:04 / cg" |
13942 | 2570 |
"Modified: / 14-02-2014 / 12:08:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2571 |
! ! |
2572 |
||
2573 |
!CodeView2::GutterView methodsFor:'event handling'! |
|
2574 |
||
14843 | 2575 |
buttonMultiPress: btn x: x y: y |
2576 |
|extraSafeArea| |
|
2577 |
||
14963 | 2578 |
Processor removeTimedBlock:blockWaitingForPossibleDoubleClick. |
2579 |
blockWaitingForPossibleDoubleClick := nil. |
|
2580 |
||
14851 | 2581 |
"/ for the embedded accept-cancel bar, if enabled |
14843 | 2582 |
(x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[ |
2583 |
textView reallyModified ifTrue:[ |
|
2584 |
(y < self acceptButtonBottom) ifTrue:[ |
|
2585 |
^self. |
|
2586 |
]. |
|
2587 |
(y < self cancelButtonBottom) ifTrue:[ |
|
2588 |
^self. |
|
2589 |
]. |
|
2590 |
]. |
|
2591 |
^self. |
|
2592 |
]. |
|
2593 |
||
14851 | 2594 |
false ifTrue:[ |
2595 |
"Do not allow clicking on line numbers..." |
|
2596 |
extraSafeArea := "('999' widthOn:self)" 5. |
|
2597 |
x < (self width - self paddingRight - widthDiffInfo - extraSafeArea) ifFalse:[^ self]. |
|
2598 |
]. |
|
2599 |
||
14843 | 2600 |
codeView notNil ifTrue:[ |
2601 |
((x > (self paddingLeft + self usedWidthForAcceptCancel)) or: |
|
2602 |
[x < (self width - self paddingRight - widthDiffInfo)] |
|
2603 |
) ifTrue:[ |
|
2604 |
(codeView buttonMultiPress: btn x:x y:y in: self) ifTrue:[^ self]. "/ event eaten |
|
2605 |
]. |
|
2606 |
]. |
|
2607 |
super buttonMultiPress: btn x: x y: y |
|
2608 |
! |
|
2609 |
||
9985 | 2610 |
buttonPress: btn x: x y: y |
14963 | 2611 |
blockWaitingForPossibleDoubleClick := |
2612 |
[ |
|
2613 |
self nonMultiButtonPress: btn x: x y: y |
|
2614 |
]. |
|
15625 | 2615 |
Processor |
2616 |
addTimedBlock:blockWaitingForPossibleDoubleClick |
|
2617 |
for:Processor activeProcess |
|
2618 |
afterMilliseconds:200. |
|
14963 | 2619 |
! |
2620 |
||
2621 |
nonMultiButtonPress: btn x: x y: y |
|
2622 |
"this is now called delayed for a single button press |
|
2623 |
(i.e. if there is not other click within some time)" |
|
2624 |
||
11520
091c7e0e435a
added a save-area (line-number) into which a click does not toggle
Claus Gittinger <cg@exept.de>
parents:
11467
diff
changeset
|
2625 |
|extraSafeArea| |
091c7e0e435a
added a save-area (line-number) into which a click does not toggle
Claus Gittinger <cg@exept.de>
parents:
11467
diff
changeset
|
2626 |
|
14851 | 2627 |
"/ for the embedded accept-cancel bar, if enabled |
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2628 |
(x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[ |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2629 |
textView reallyModified ifTrue:[ |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2630 |
(y < self acceptButtonBottom) ifTrue:[ |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2631 |
self accept. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2632 |
^self. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2633 |
]. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2634 |
(y < self cancelButtonBottom) ifTrue:[ |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2635 |
self cancel. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2636 |
^self. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2637 |
]. |
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2638 |
self diff. |
10781 | 2639 |
]. |
2640 |
^self. |
|
2641 |
]. |
|
2642 |
||
13567 | 2643 |
false ifTrue:[ |
2644 |
"Do not allow clicking on line numbers..." |
|
2645 |
extraSafeArea := "('999' widthOn:self)" 5. |
|
2646 |
x < (self width - self paddingRight - widthDiffInfo - extraSafeArea) ifFalse:[^ self]. |
|
2647 |
]. |
|
2648 |
||
2649 |
codeView notNil ifTrue:[ |
|
2650 |
((x > (self paddingLeft + self usedWidthForAcceptCancel)) or: |
|
2651 |
[x < (self width - self paddingRight - widthDiffInfo)] |
|
2652 |
) ifTrue:[ |
|
2653 |
(codeView buttonPress: btn x:x y:y in: self) ifTrue:[^ self]. "/ event eaten |
|
2654 |
]. |
|
2655 |
]. |
|
9985 | 2656 |
|
2657 |
"Created: / 17-06-2011 / 13:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11520
091c7e0e435a
added a save-area (line-number) into which a click does not toggle
Claus Gittinger <cg@exept.de>
parents:
11467
diff
changeset
|
2658 |
"Modified (comment): / 18-05-2012 / 10:56:54 / cg" |
13813 | 2659 |
! |
2660 |
||
2661 |
sizeChanged:how |
|
2662 |
super sizeChanged:how. |
|
15520 | 2663 |
"/ self invalidateAcceptCancelBar. |
2664 |
self invalidate. |
|
13813 | 2665 |
"Created: / 10-09-2013 / 03:19:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2666 |
! ! |
2667 |
||
11220 | 2668 |
!CodeView2::GutterView methodsFor:'help'! |
2669 |
||
14843 | 2670 |
flyByHelpTextAt:aPointOrNil |
16557 | 2671 |
|lineNr textCollector services| |
14843 | 2672 |
|
2673 |
codeView isNil ifTrue:[^ nil]. |
|
16557 | 2674 |
aPointOrNil isNil ifTrue:[^ nil]. |
2675 |
||
2676 |
lineNr := codeView lineAtY:aPointOrNil y. |
|
2677 |
lineNr isNil ifTrue:[^ nil]. |
|
2678 |
||
2679 |
textCollector := TextStream new. |
|
2680 |
||
2681 |
"/ which service has an annotation for that line |
|
2682 |
services := codeView services. |
|
2683 |
"/ show lintservice-help first |
|
2684 |
services := (services select:[:s | s isLintService]) |
|
2685 |
,(services reject:[:s | s isLintService]). |
|
2686 |
||
2687 |
services do:[:eachService | |
|
2688 |
|tooltip| |
|
2689 |
||
2690 |
tooltip := eachService flyByHelpTextAtLine:lineNr. |
|
2691 |
tooltip notEmptyOrNil ifTrue:[ |
|
2692 |
textCollector notEmpty ifTrue:[ textCollector cr]. |
|
2693 |
textCollector nextPutAllText:tooltip. |
|
2694 |
tooltip last == Character cr ifFalse:[textCollector cr]. |
|
14843 | 2695 |
]. |
12903 | 2696 |
]. |
16557 | 2697 |
textCollector isEmpty ifTrue:[ ^ nil ]. |
2698 |
^ textCollector contents. |
|
11220 | 2699 |
! ! |
2700 |
||
14545
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2701 |
!CodeView2::GutterView methodsFor:'initialize & release'! |
9985 | 2702 |
|
2703 |
initialize |
|
2704 |
||
2705 |
super initialize. |
|
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2706 |
|
14963 | 2707 |
blockWaitingForPossibleDoubleClick := nil. |
2708 |
||
13567 | 2709 |
showLineNumbers := true. |
10781 | 2710 |
widthAcceptCancel := 16. |
13813 | 2711 |
widthAnnotations := "16"8. |
9985 | 2712 |
widthDiffInfo := 5. |
2713 |
||
15361 | 2714 |
UserPreferences current useColorsForColorBlindness ifTrue:[ |
2715 |
acceptColor := Color blue. |
|
2716 |
] ifFalse:[ |
|
2717 |
acceptColor := Color green. |
|
2718 |
]. |
|
2719 |
cancelColor := Color red. |
|
2720 |
diffColor := Color yellow. |
|
2721 |
||
16243 | 2722 |
acceptColor := acceptColor lighter onDevice:device. |
2723 |
cancelColor := cancelColor lighter lighter onDevice:device. |
|
2724 |
diffColor := diffColor lighter lighter onDevice:device. |
|
10781 | 2725 |
|
14983 | 2726 |
self enableMotionEvents. "/ for per-line tooltips |
2727 |
||
9985 | 2728 |
"Created: / 16-06-2011 / 13:47:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2729 |
! |
|
2730 |
||
14545
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2731 |
release |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2732 |
codeView removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2733 |
textView removeDependent: self. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2734 |
currentBlockNodeHolder notNil ifTrue:[ |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2735 |
currentBlockNodeHolder removeDependent: self |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2736 |
]. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2737 |
super release. |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2738 |
|
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2739 |
"Created: / 23-06-2014 / 20:47:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2740 |
! |
473b413f198b
Added CodeView2>>release, GutterView>>release to release views from dependencies.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14521
diff
changeset
|
2741 |
|
9985 | 2742 |
setCodeView: aCodeView2 |
2743 |
||
2744 |
codeView := aCodeView2. |
|
11988
b482d2c77040
changed to not take up screen space for the accept/cancel gutter,
Claus Gittinger <cg@exept.de>
parents:
11903
diff
changeset
|
2745 |
|
9985 | 2746 |
codeView addDependent: self. |
10784 | 2747 |
codeView reallyModifiedChannel addDependent: self. |
13993 | 2748 |
"/ codeView currentBlockNodeHolder addDependent: self. - not needed; currentBlockNodeHolder: does it |
13813 | 2749 |
|
2750 |
textView := aCodeView2 textView. |
|
9985 | 2751 |
textView addDependent: self. |
13993 | 2752 |
"/ do not fetch stuff from others - let others give me things (caller change to send currentBlockNodeHolder: explicitly) |
2753 |
"/ self currentBlockNodeHolder: codeView currentBlockNodeHolder. |
|
9985 | 2754 |
textViewScroller := aCodeView2 textViewScroller. |
10577 | 2755 |
"/ self backgroundPaint: (textView viewBackground "backgroundPaint" blendWith: (Color gray:80)). |
2756 |
self viewBackground: (View defaultBackgroundColor). |
|
9985 | 2757 |
|
2758 |
"Created: / 14-02-2010 / 15:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10577 | 2759 |
"Modified: / 17-08-2011 / 15:15:55 / cg" |
13813 | 2760 |
"Modified: / 05-04-2012 / 17:46:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2761 |
! ! |
2762 |
||
2763 |
!CodeView2::GutterView methodsFor:'queries'! |
|
2764 |
||
2765 |
displayedString: line |
|
2766 |
"get text to display in gutter for specified list line number" |
|
2767 |
||
2768 |
^(line asString). |
|
2769 |
||
2770 |
"Created: / 14-12-2009 / 13:37:47 / Jindra <a>" |
|
2771 |
! |
|
2772 |
||
13105 | 2773 |
lineColorForLine:line |
9985 | 2774 |
"return special color for given line if required, nil otherwise" |
13105 | 2775 |
"used only if lineFont returns nil" |
9985 | 2776 |
|
2777 |
^nil |
|
2778 |
||
2779 |
"Created: / 14-12-2009 / 15:01:31 / Jindra <a>" |
|
2780 |
! |
|
2781 |
||
2782 |
lineDisplayable:line |
|
2783 |
"true if this list line can be displayed" |
|
2784 |
^(textView listLineIsVisible:line) |
|
2785 |
||
2786 |
"Created: / 14-12-2009 / 13:38:23 / Jindra <a>" |
|
2787 |
! |
|
2788 |
||
13105 | 2789 |
lineFontForLine:line |
9985 | 2790 |
"return special font for given line if required, nil otherwise" |
2791 |
||
2792 |
^nil |
|
2793 |
||
2794 |
"Created: / 14-12-2009 / 14:40:17 / Jindra <a>" |
|
2795 |
! |
|
2796 |
||
13566 | 2797 |
wantsFocusWithButtonPress |
2798 |
^ false. |
|
2799 |
! |
|
2800 |
||
13213 | 2801 |
yOfTextViewLine:lineNr |
2802 |
"defined to allow computation of a line below what is visible in |
|
2803 |
the textView (because gutter may become higher than textView, iff |
|
2804 |
the textView has a horizontal scrollbar" |
|
2805 |
||
2806 |
|visibleLineNr "{ Class: SmallInteger }"| |
|
2807 |
||
13813 | 2808 |
"/JV: BAD, BAD BAD - check senders, they are not prepared |
2809 |
"/ to get nil!! |
|
13213 | 2810 |
shown ifFalse:[^ nil]. |
2811 |
lineNr isNil ifTrue:[^ nil]. |
|
2812 |
visibleLineNr := lineNr - textView firstLineShown + 1. |
|
2813 |
^ textView yOfVisibleLine:visibleLineNr |
|
13813 | 2814 |
|
2815 |
"Modified (format): / 28-08-2013 / 12:49:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 2816 |
! ! |
2817 |
||
2818 |
!CodeView2::GutterView methodsFor:'redrawing'! |
|
2819 |
||
13813 | 2820 |
invalidateAcceptCancelBar |
2821 |
| w | |
|
2822 |
||
15520 | 2823 |
self usedWidthForAcceptCancel == 0 ifTrue:[^ self]. |
13978
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2824 |
w := self acceptCancelRight. |
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2825 |
w == 0 ifTrue:[ ^ self ]. |
15520 | 2826 |
|
13813 | 2827 |
self |
13942 | 2828 |
invalidateX: 0 |
2829 |
y: 0 |
|
15520 | 2830 |
width: w-1 |
13942 | 2831 |
height: self height. |
13813 | 2832 |
|
2833 |
"Created: / 10-09-2013 / 03:07:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13978
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2834 |
"Modified: / 21-02-2014 / 21:50:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13813 | 2835 |
! |
2836 |
||
13097 | 2837 |
invalidateDeviceRectangle:aRectangle repairNow:doRepairNow |
2838 |
^ super invalidateDeviceRectangle:aRectangle repairNow:doRepairNow |
|
2839 |
! |
|
2840 |
||
13813 | 2841 |
invalidateLines |
2842 |
||
2843 |
| x0 | |
|
15520 | 2844 |
x0 := self acceptCancelRight "+ 1". |
13813 | 2845 |
self |
13942 | 2846 |
invalidateX: x0 |
2847 |
y: 0 |
|
2848 |
width: self width - x0 |
|
2849 |
height: self height. |
|
13813 | 2850 |
|
2851 |
"Created: / 10-09-2013 / 03:08:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13942 | 2852 |
"Modified: / 14-02-2014 / 12:19:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13813 | 2853 |
! |
2854 |
||
10781 | 2855 |
redrawAcceptCancelBarX: x y: y width:w height:h |
2856 |
||
13978
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2857 |
| rw acceptRight acceptBottom cancelBottom | |
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2858 |
|
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2859 |
acceptRight := self acceptCancelRight. |
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2860 |
x >= acceptRight ifTrue:[ |
13942 | 2861 |
^self. |
10781 | 2862 |
]. |
13978
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2863 |
rw := ((x + w) min: acceptRight) - x. |
13813 | 2864 |
|
10781 | 2865 |
|
2866 |
textView reallyModified ifFalse:[ |
|
13942 | 2867 |
self fillRectangleX:x y:y width:rw height:h color: self viewBackground |
10781 | 2868 |
] ifTrue:[ |
13942 | 2869 |
acceptBottom := self acceptButtonBottom. |
2870 |
cancelBottom := self cancelButtonBottom. |
|
2871 |
y < acceptBottom ifTrue:[ |
|
2872 |
self fillRectangleX:x y:y width:rw height: ((y + h) min: acceptBottom) color: acceptColor. |
|
2873 |
]. |
|
2874 |
(y < cancelBottom) ifTrue:[ |
|
2875 |
self fillRectangleX:x y: acceptBottom + 1width:rw height: ((y + h) min: cancelBottom) - acceptBottom - 1color: cancelColor. |
|
2876 |
]. |
|
2877 |
(y + h >= cancelBottom) ifTrue:[ |
|
2878 |
self fillRectangleX:x y: cancelBottom + 1 width:rw height: (y + h) - cancelBottom - 1 color: diffColor. |
|
2879 |
] |
|
13813 | 2880 |
|
10781 | 2881 |
] |
2882 |
||
2883 |
"Created: / 07-10-2011 / 19:44:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13978
f4adc42d7354
Fixed some redraw problems when internal accept-cancel is disabled.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13975
diff
changeset
|
2884 |
"Modified: / 21-02-2014 / 21:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10781 | 2885 |
! |
2886 |
||
9985 | 2887 |
redrawBackgroundX:x y:y width:w height:h |
2888 |
"redraws gutter background" |
|
2889 |
||
13091 | 2890 |
|savPaint| |
2891 |
||
9985 | 2892 |
"background is filled with background color" |
2893 |
self |
|
13057 | 2894 |
clearRectangleX:x |
9985 | 2895 |
y:y |
2896 |
width:w |
|
13057 | 2897 |
height:h. |
9985 | 2898 |
|
13091 | 2899 |
"separator line is drawn in grey" |
2900 |
savPaint := self paint. |
|
15521 | 2901 |
self paint:Color grey. |
13091 | 2902 |
|
9985 | 2903 |
self |
13057 | 2904 |
displayLineFromX:(width - 1) |
9985 | 2905 |
y:y |
13057 | 2906 |
toX:(width - 1) |
9985 | 2907 |
y:(y+h). |
2908 |
||
13091 | 2909 |
self paint:savPaint. |
15521 | 2910 |
|
9985 | 2911 |
"Created: / 14-12-2009 / 13:15:53 / Jindra <a>" |
2912 |
"Modified: / 14-12-2009 / 15:09:54 / Jindra <a>" |
|
10577 | 2913 |
"Modified: / 17-08-2011 / 15:12:47 / cg" |
10781 | 2914 |
"Modified (comment): / 07-10-2011 / 19:37:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2915 |
! |
2916 |
||
2917 |
redrawLine:line |
|
2918 |
||
2919 |
^self redrawLine:line cleared: false. |
|
2920 |
||
2921 |
"Modified: / 17-06-2011 / 14:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2922 |
! |
|
2923 |
||
2924 |
redrawLine:line cleared: cleared |
|
2925 |
"redraws specified line. Returns width of drawn object. Color of drawn objects should be taken from lineFont, lineColor" |
|
2926 |
||
13057 | 2927 |
^ self redrawLine:line cleared:cleared drawServices:true |
2928 |
! |
|
2929 |
||
2930 |
redrawLine:line cleared:cleared drawServices:drawServices |
|
13813 | 2931 |
"redraws specified line. Returns width of drawn object. |
13213 | 2932 |
Color of drawn objects should be taken from lineFont, lineColor" |
13813 | 2933 |
|
13213 | 2934 |
|lineString yTop yBaseline fontAscent fontDescent |
16243 | 2935 |
textW requiredW oldFont newFont oldColor newColor myFont textViewFont| |
9985 | 2936 |
|
13813 | 2937 |
shown ifFalse:[ ^ self ]. "/ Do not bother if the view is not shown. |
13574 | 2938 |
textView isNil ifTrue:[^ self]. "/ happens when shown in UIPainter |
16243 | 2939 |
|
13567 | 2940 |
requiredW := self width. |
14520 | 2941 |
myFont := gc font. |
16243 | 2942 |
textViewFont := textView font. |
2943 |
||
13567 | 2944 |
showLineNumbers ifTrue:[ |
13942 | 2945 |
lineString := self displayedString:line. |
2946 |
||
2947 |
textW := (lineString widthOn:self). |
|
2948 |
requiredW := textW + self padding. |
|
2949 |
||
14520 | 2950 |
oldFont := myFont. |
13942 | 2951 |
oldColor := self paint. |
2952 |
||
2953 |
newFont := self lineFontForLine:line. |
|
2954 |
newFont isNil ifTrue:[ |
|
2955 |
newFont := oldFont. |
|
2956 |
newColor := self lineColorForLine:line. |
|
13943
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
2957 |
newColor notNil ifTrue:[ self paint:newColor ]. |
13942 | 2958 |
]. |
2959 |
newFont ~~ oldFont ifTrue:[ |
|
2960 |
"/ ensure that the line number lines are not higher than the text lines |
|
16243 | 2961 |
(newFont heightOn:device) > (textViewFont heightOn:device) ifTrue:[ |
2962 |
newFont := textViewFont. |
|
13942 | 2963 |
]. |
2964 |
newFont ~~ oldFont ifTrue:[ |
|
14520 | 2965 |
self font:newFont. |
2966 |
myFont := gc font. |
|
13942 | 2967 |
]. |
2968 |
]. |
|
11424
69b3960c7757
care for small text-font in gutterview
Claus Gittinger <cg@exept.de>
parents:
11398
diff
changeset
|
2969 |
]. |
9985 | 2970 |
|
16243 | 2971 |
fontAscent := textViewFont ascentOn:device. |
2972 |
fontDescent := textViewFont descentOn:device. |
|
13943
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
2973 |
|
13584 | 2974 |
yTop := (self yOfTextViewLine:line) ? 0. |
13574 | 2975 |
yBaseline := yTop + fontAscent. |
2976 |
||
9985 | 2977 |
cleared ifFalse:[ |
14520 | 2978 |
self clearRectangleX:0 y:yBaseline - myFont ascent |
13962 | 2979 |
width:width - 2 |
14520 | 2980 |
height:myFont ascent + myFont descent. |
9985 | 2981 |
]. |
2982 |
||
13057 | 2983 |
"/ cg: this should be done differently: services know about the |
2984 |
"/ gutter, so they should respond to a special drawGutter message. |
|
13105 | 2985 |
"/ otherwise, some redraws become unusably slow (especially |
13057 | 2986 |
"/ with multiple fonts/colors/emphases)... |
2987 |
drawServices ifTrue:[ |
|
13942 | 2988 |
"Let services draw annotations and other stuff" |
2989 |
codeView notNil ifTrue:[ |
|
2990 |
codeView |
|
2991 |
drawLine:line in: self |
|
14520 | 2992 |
atX: self acceptCancelRight + 1 y:yBaseline width: widthAnnotations height:myFont height |
13942 | 2993 |
from:nil to:nil with:self paint and: self backgroundColor. |
2994 |
] |
|
13057 | 2995 |
]. |
9985 | 2996 |
|
13567 | 2997 |
showLineNumbers ifTrue:[ |
13942 | 2998 |
self |
2999 |
displayString:lineString |
|
13943
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3000 |
x:width - widthDiffInfo - textW |
13942 | 3001 |
y:yBaseline. |
13943
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3002 |
newFont notNil ifTrue:[ |
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3003 |
self font:oldFont. |
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3004 |
self paint:oldColor |
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3005 |
] ifFalse:[ |
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3006 |
newColor notNil ifTrue:[ self paint:oldColor ]. |
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3007 |
]. |
13567 | 3008 |
]. |
3009 |
||
13813 | 3010 |
"/ If the view has been cleared here, we have also to redraw corresponding portion |
3011 |
"/ of accept/cancel bar !! |
|
3012 |
cleared ifFalse:[ |
|
13942 | 3013 |
"/ In that case it was cleared above. |
13962 | 3014 |
self redrawAcceptCancelBarX:0 y:yBaseline - gc font ascent |
3015 |
width:width - 2 |
|
3016 |
height:gc font ascent + gc font descent. |
|
13813 | 3017 |
]. |
9985 | 3018 |
^ requiredW. |
3019 |
||
3020 |
"Modified: / 14-12-2009 / 15:30:44 / Jindra <a>" |
|
3021 |
"Created: / 17-06-2011 / 14:11:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11606 | 3022 |
"Modified: / 18-07-2012 / 19:05:24 / cg" |
13943
510f0343785e
Fixes off-by-one error when drawing annotations.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13942
diff
changeset
|
3023 |
"Modified: / 14-02-2014 / 17:58:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3024 |
! |
3025 |
||
10224 | 3026 |
redrawLinesFrom:start |
13057 | 3027 |
"/ cg: obsolete? |
10312 | 3028 |
start to: (textView lastLineShown - 1 min: textView list size) do:[:line| |
14520 | 3029 |
self redrawLine:line cleared:false drawServices:true. |
10224 | 3030 |
] |
3031 |
||
3032 |
"Created: / 06-07-2011 / 17:25:36 / jv" |
|
10312 | 3033 |
"Modified: / 12-07-2011 / 17:14:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3034 |
! |
3035 |
||
13374 | 3036 |
redrawVisibleLine:line |
3037 |
|absLine| |
|
3038 |
||
3039 |
(absLine := textView visibleLineToListLine:line) notNil ifTrue:[ |
|
3040 |
self redrawLine:absLine cleared: false. |
|
3041 |
]. |
|
3042 |
||
3043 |
"Modified: / 17-06-2011 / 14:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3044 |
! |
|
3045 |
||
13105 | 3046 |
redrawX:x y:y width:w height:h |
13213 | 3047 |
|firstLine lastLine yBot| |
3048 |
||
9985 | 3049 |
self redrawBackgroundX:x y:y width:w height:h. |
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
3050 |
|
13567 | 3051 |
(codeView notNil and:[codeView showAcceptCancelBar]) ifTrue:[ |
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
3052 |
self redrawAcceptCancelBarX:x y:y width:w height:h. |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
3053 |
]. |
9985 | 3054 |
|
13575 | 3055 |
"/ textview may be nil, if Gutter is shown in the UIPainter!! |
3056 |
textView notNil ifTrue:[ |
|
3057 |
numberOfLines := (textView list size max:textView cursorLine). |
|
3058 |
yBot := y + h. |
|
3059 |
firstLine := textView visibleLineToAbsoluteLine:(textView visibleLineOfY:y). |
|
3060 |
lastLine := textView visibleLineToAbsoluteLine:(textView visibleLineOfY:yBot-1). |
|
3061 |
lastLine := lastLine min:numberOfLines. |
|
3062 |
||
3063 |
firstLine to:lastLine do: [:line | |
|
3064 |
self redrawLine:line cleared:true drawServices:true. |
|
3065 |
]. |
|
13567 | 3066 |
] |
9985 | 3067 |
! ! |
3068 |
||
3069 |
!CodeView2::TextView methodsFor:'accessing'! |
|
3070 |
||
3071 |
changedDiffText |
|
3072 |
^ changedDiffText |
|
3073 |
! |
|
3074 |
||
3075 |
changedDiffText:something |
|
3076 |
changedDiffText := something. |
|
3077 |
! |
|
3078 |
||
3079 |
changedLines |
|
3080 |
^ changedLines |
|
3081 |
||
3082 |
"Created: / 26-04-2010 / 20:30:32 / Jakub <zelenja7@fel.cvut.cz>" |
|
3083 |
"Modified: / 26-04-2010 / 21:48:13 / Jakub <zelenja7@fel.cvut.cz>" |
|
3084 |
! |
|
3085 |
||
3086 |
changedLines:something |
|
3087 |
changedLines := something. |
|
3088 |
||
3089 |
"Created: / 26-04-2010 / 20:30:19 / Jakub <zelenja7@fel.cvut.cz>" |
|
3090 |
"Modified: / 02-05-2010 / 19:13:32 / Jakub <zelenja7@fel.cvut.cz>" |
|
3091 |
! |
|
3092 |
||
15130 | 3093 |
codeView |
3094 |
^ codeView |
|
3095 |
! |
|
3096 |
||
10781 | 3097 |
contents: text |
3098 |
||
3099 |
super contents: text. |
|
3100 |
reallyModifiedChannel value: false. |
|
3101 |
||
3102 |
"Created: / 07-10-2011 / 20:32:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3103 |
! |
|
3104 |
||
13813 | 3105 |
contents: text clear: clearPrevious |
3106 |
||
3107 |
| savedListOriginal | |
|
3108 |
savedListOriginal := listOriginal. |
|
3109 |
super contents: text. |
|
3110 |
listOriginal := savedListOriginal. |
|
3111 |
self updateReallyModified. |
|
3112 |
||
3113 |
"Created: / 17-02-2012 / 00:35:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3114 |
! |
|
3115 |
||
9985 | 3116 |
deletedLines |
3117 |
^ deletedLines |
|
3118 |
||
3119 |
"Modified: / 26-04-2010 / 21:48:23 / Jakub <zelenja7@fel.cvut.cz>" |
|
3120 |
! |
|
3121 |
||
11597 | 3122 |
deletedLines:something |
3123 |
deletedLines := something. |
|
9985 | 3124 |
|
3125 |
"Modified: / 26-04-2010 / 21:48:54 / Jakub <zelenja7@fel.cvut.cz>" |
|
11597 | 3126 |
"Modified (format): / 17-07-2012 / 18:56:44 / cg" |
9985 | 3127 |
! |
3128 |
||
3129 |
diffMode |
|
3130 |
^ diffMode |
|
3131 |
! |
|
3132 |
||
3133 |
diffMode:something |
|
3134 |
diffMode := something. |
|
3135 |
! |
|
3136 |
||
3137 |
emptyLines |
|
3138 |
^ emptyLines |
|
3139 |
! |
|
3140 |
||
3141 |
emptyLines:something |
|
3142 |
emptyLines := something. |
|
3143 |
! |
|
3144 |
||
13813 | 3145 |
fontAscent |
3146 |
^fontAscent notNil ifTrue:[fontAscent] ifFalse:[super fontAscent] |
|
3147 |
||
3148 |
"Created: / 19-05-2012 / 14:13:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3149 |
! |
|
3150 |
||
9985 | 3151 |
insertedLines |
3152 |
^ insertedLines |
|
3153 |
||
3154 |
"Modified: / 26-04-2010 / 21:48:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
3155 |
! |
|
3156 |
||
11597 | 3157 |
insertedLines:something |
3158 |
insertedLines := something. |
|
9985 | 3159 |
|
3160 |
"Modified: / 26-04-2010 / 21:48:59 / Jakub <zelenja7@fel.cvut.cz>" |
|
11597 | 3161 |
"Modified (format): / 17-07-2012 / 18:56:50 / cg" |
9985 | 3162 |
! |
3163 |
||
10245 | 3164 |
modifiedChannel: aValueHolder |
3165 |
||
3166 |
super modifiedChannel: aValueHolder |
|
3167 |
||
3168 |
"Created: / 07-07-2011 / 12:27:11 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
3169 |
! |
|
3170 |
||
9985 | 3171 |
originDiffText |
3172 |
^ originDiffText |
|
3173 |
! |
|
3174 |
||
3175 |
originDiffText:something |
|
3176 |
originDiffText := something. |
|
10781 | 3177 |
! |
3178 |
||
3179 |
reallyModified |
|
3180 |
||
3181 |
^self reallyModifiedChannel value |
|
3182 |
||
3183 |
"Created: / 07-10-2011 / 19:28:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3184 |
! ! |
3185 |
||
11393 | 3186 |
!CodeView2::TextView methodsFor:'accessing-colors'! |
9985 | 3187 |
|
3188 |
colorChanged |
|
3189 |
^ Color redByte:240 greenByte: 192 blueByte: 192 |
|
3190 |
||
3191 |
"Modified: / 24-06-2010 / 14:05:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3192 |
! |
|
3193 |
||
3194 |
colorDeleted |
|
3195 |
^ self colorInserted. |
|
3196 |
"/^ Color pink |
|
3197 |
||
3198 |
"Modified: / 24-06-2010 / 14:16:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10781 | 3199 |
"Modified (format): / 07-10-2011 / 20:26:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11597 | 3200 |
"Modified (format): / 17-07-2012 / 18:57:14 / cg" |
9985 | 3201 |
! |
3202 |
||
3203 |
colorInserted |
|
3204 |
^ Color redByte: 239 greenByte: 225 blueByte: 152 |
|
3205 |
||
3206 |
"Modified: / 24-06-2010 / 14:13:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3207 |
! ! |
|
3208 |
||
10781 | 3209 |
!CodeView2::TextView methodsFor:'accessing-contents'! |
3210 |
||
10784 | 3211 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings |
3212 |
||
3213 |
super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings. |
|
13517 | 3214 |
|
10784 | 3215 |
listOriginal := aCollection copy. |
10834 | 3216 |
reallyModifiedChannel value: false. |
13813 | 3217 |
|
3218 |
"/JV: used to be notifyLines... but that method |
|
3219 |
"/ leaves suppressNotifications to true, which is not what |
|
3220 |
"/ we want!! |
|
3221 |
self updateReallyModified. |
|
3222 |
codeView linesModifiedFrom: 1 to: list size. |
|
10784 | 3223 |
|
3224 |
"Created: / 08-10-2011 / 12:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 3225 |
"Modified (comment): / 03-08-2013 / 13:35:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10784 | 3226 |
! |
3227 |
||
10781 | 3228 |
setList:aCollection expandTabs:expandTabs redraw:doRedraw |
3229 |
||
3230 |
super setList:aCollection expandTabs:expandTabs redraw:doRedraw. |
|
3231 |
listOriginal := aCollection copy. |
|
10834 | 3232 |
reallyModifiedChannel value: false. |
13813 | 3233 |
|
3234 |
"/JV: used to be notifyLines... but that method |
|
3235 |
"/ leaves suppressNotifications to true, which is not what |
|
3236 |
"/ we want!! |
|
3237 |
self updateReallyModified. |
|
3238 |
codeView linesModifiedFrom: 1 to: list size. |
|
10781 | 3239 |
|
3240 |
"Created: / 07-10-2011 / 18:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 3241 |
"Modified (comment): / 03-08-2013 / 13:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3242 |
! ! |
|
3243 |
||
3244 |
!CodeView2::TextView methodsFor:'accessing-look'! |
|
3245 |
||
3246 |
lineSpacing |
|
3247 |
||
3248 |
^lineSpacing |
|
3249 |
||
3250 |
"Modified: / 22-05-1996 / 12:22:29 / cg" |
|
3251 |
"Created: / 19-03-2012 / 13:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10781 | 3252 |
! ! |
3253 |
||
10785 | 3254 |
!CodeView2::TextView methodsFor:'accessing-state'! |
3255 |
||
3256 |
beUnmodified |
|
3257 |
||
3258 |
self modifiedChannel value: false. |
|
3259 |
reallyModifiedChannel value: false. |
|
3260 |
listOriginal := list copy. |
|
3261 |
||
3262 |
"Created: / 08-10-2011 / 12:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3263 |
! |
|
3264 |
||
3265 |
isModified |
|
3266 |
||
3267 |
^self modified |
|
3268 |
||
3269 |
"Created: / 08-10-2011 / 12:52:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3270 |
! |
|
3271 |
||
3272 |
isReallyModified |
|
3273 |
||
3274 |
^self reallyModified |
|
3275 |
||
3276 |
"Created: / 08-10-2011 / 12:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3277 |
! ! |
|
3278 |
||
13813 | 3279 |
!CodeView2::TextView methodsFor:'bit blitting'! |
3280 |
||
3281 |
copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async |
|
13942 | 3282 |
|
3283 |
"/ If doing a vertical scroll, optimized Gutter redraw by |
|
3284 |
"/ copying gutter's image... |
|
3285 |
(scrollInProgress and:[aDrawable == self]) ifTrue:[ |
|
3286 |
"/ Vertical scroll? |
|
3287 |
((srcY ~= dstY) and:[srcX = dstX]) ifTrue:[ |
|
3288 |
"/ Do copy in gutter, but not accept-cancel bar!! |
|
3289 |
| x0 | |
|
3290 |
||
3291 |
x0 := gutterView acceptCancelRight. |
|
3292 |
gutterView |
|
3293 |
copyFrom:gutterView |
|
3294 |
x:x0 |
|
3295 |
y:srcY |
|
3296 |
toX:x0 |
|
3297 |
y:dstY |
|
3298 |
width:(gutterView width - x0) |
|
3299 |
height:h |
|
3300 |
async:false |
|
3301 |
] |
|
13813 | 3302 |
]. |
3303 |
^ super |
|
13942 | 3304 |
copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async |
3305 |
||
3306 |
"Modified: / 14-02-2014 / 10:15:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 3307 |
! ! |
3308 |
||
10781 | 3309 |
!CodeView2::TextView methodsFor:'channels'! |
3310 |
||
3311 |
reallyModifiedChannel |
|
13567 | 3312 |
"return the valueHolder holding true if text was really modified. |
3313 |
This is different from #modified, as the inherited modified flag is cleared |
|
3314 |
to trigger another change notification with every keystroke (for the syntaxHighighter). |
|
3315 |
This may be (now) considered a very bad hack" |
|
10781 | 3316 |
|
3317 |
^ reallyModifiedChannel |
|
3318 |
||
3319 |
"Created: / 07-10-2011 / 18:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3320 |
! |
|
3321 |
||
3322 |
reallyModifiedChannel: aValueModel |
|
3323 |
||
3324 |
|prev| |
|
3325 |
||
3326 |
prev := reallyModifiedChannel. |
|
3327 |
prev notNil ifTrue:[ |
|
3328 |
gutterView notNil ifTrue:[ |
|
3329 |
reallyModifiedChannel removeDependent: gutterView. |
|
3330 |
] |
|
3331 |
]. |
|
3332 |
reallyModifiedChannel := aValueModel. |
|
3333 |
self setupChannel:aValueModel for:nil withOld:prev. |
|
3334 |
gutterView notNil ifTrue:[ |
|
3335 |
reallyModifiedChannel addDependent: gutterView. |
|
3336 |
] |
|
3337 |
||
3338 |
"Created: / 07-10-2011 / 18:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3339 |
! ! |
|
3340 |
||
12354
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3341 |
!CodeView2::TextView methodsFor:'delegation-events'! |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3342 |
|
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3343 |
isQuickMenuModifierPressed |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3344 |
UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[ |
13942 | 3345 |
^ self sensor ctrlDown |
12354
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3346 |
]. |
13813 | 3347 |
^ self sensor metaDown |
12354
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3348 |
! |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3349 |
|
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3350 |
isQuickMenuModifierReleased |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3351 |
UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[ |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3352 |
^ self sensor ctrlDown not |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3353 |
]. |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3354 |
^ self sensor metaDown not |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3355 |
! ! |
8aac48d63ded
changed default for Jan's quick menus to use the ALT button isntead
Claus Gittinger <cg@exept.de>
parents:
12347
diff
changeset
|
3356 |
|
9985 | 3357 |
!CodeView2::TextView methodsFor:'drawing'! |
3358 |
||
13813 | 3359 |
backgroundForVisibleLine:visLineNr default:bg |
3360 |
| lineNr | |
|
3361 |
||
3362 |
||
3363 |
diffMode ifTrue:[ |
|
13942 | 3364 |
lineNr := self visibleLineToListLine:visLineNr. |
3365 |
(insertedLines notEmptyOrNil and:[insertedLines includes:lineNr]) ifTrue:[ |
|
3366 |
^self colorInserted |
|
3367 |
]. |
|
3368 |
(changedLines notEmptyOrNil and:[changedLines includes:lineNr]) ifTrue:[ |
|
3369 |
^self colorChanged |
|
3370 |
]. |
|
3371 |
(deletedLines notEmptyOrNil and:[deletedLines includes:lineNr]) ifTrue:[ |
|
3372 |
^self colorDeleted |
|
3373 |
]. |
|
13813 | 3374 |
]. |
3375 |
^ bg |
|
3376 |
||
3377 |
"Modified: / 17-03-2012 / 12:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3378 |
! |
3379 |
||
13813 | 3380 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
3381 |
"draw a visible line range in fg/bg" |
|
3382 |
||
3383 |
diffMode ifFalse:[ |
|
13942 | 3384 |
super drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg. |
3385 |
^self. |
|
13813 | 3386 |
]. |
3387 |
||
3388 |
startVisLineNr to: endVisLineNr do:[:visLineNr| |
|
13942 | 3389 |
self drawVisibleLine: visLineNr with:fg and:bg |
13813 | 3390 |
] |
3391 |
||
3392 |
"Modified: / 15-12-1999 / 23:19:39 / cg" |
|
3393 |
"Created: / 17-03-2012 / 09:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3394 |
! |
|
3395 |
||
3396 |
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg |
|
3397 |
super |
|
13942 | 3398 |
drawLine:line |
3399 |
fromX:x |
|
3400 |
inVisible:visLineNr |
|
3401 |
with:fg |
|
3402 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
|
9985 | 3403 |
|
3404 |
"Created: / 05-04-2010 / 12:07:07 / Jakub <zelenja7@fel.cvut.cz>" |
|
3405 |
"Modified: / 02-05-2010 / 18:46:00 / Jakub <zelenja7@fel.cvut.cz>" |
|
13813 | 3406 |
"Modified: / 17-03-2012 / 10:05:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3407 |
! |
3408 |
||
13813 | 3409 |
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg |
3410 |
super |
|
13942 | 3411 |
drawLine:lineStringArg |
3412 |
inVisible:visLineNr |
|
3413 |
col:col |
|
3414 |
with:fg |
|
3415 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
|
9985 | 3416 |
|
3417 |
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>" |
|
3418 |
"Modified: / 02-05-2010 / 18:45:56 / Jakub <zelenja7@fel.cvut.cz>" |
|
13813 | 3419 |
"Modified: / 17-03-2012 / 10:04:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3420 |
! |
3421 |
||
13813 | 3422 |
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg |
3423 |
super |
|
13942 | 3424 |
drawLine:lineStringArg |
3425 |
inVisible:visLineNr |
|
3426 |
from:startCol |
|
3427 |
to:endColOrNil |
|
3428 |
with:fg |
|
3429 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
|
9985 | 3430 |
|
3431 |
"Created: / 05-04-2010 / 11:54:54 / Jakub <zelenja7@fel.cvut.cz>" |
|
3432 |
"Modified: / 02-05-2010 / 18:45:52 / Jakub <zelenja7@fel.cvut.cz>" |
|
13813 | 3433 |
"Modified: / 17-03-2012 / 10:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3434 |
! |
3435 |
||
13813 | 3436 |
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg |
3437 |
super |
|
13942 | 3438 |
drawLine:lineString |
3439 |
inVisible:visLineNr |
|
3440 |
from:startCol |
|
3441 |
with:fg |
|
3442 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
|
9985 | 3443 |
|
3444 |
"Created: / 05-04-2010 / 11:54:26 / Jakub <zelenja7@fel.cvut.cz>" |
|
3445 |
"Modified: / 02-05-2010 / 18:45:48 / Jakub <zelenja7@fel.cvut.cz>" |
|
13813 | 3446 |
"Modified: / 17-03-2012 / 10:04:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3447 |
! |
3448 |
||
13813 | 3449 |
drawVisibleLine:visLineNr with:fg and:bg |
3450 |
super |
|
13942 | 3451 |
drawVisibleLine:visLineNr |
3452 |
with:fg |
|
3453 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
|
9985 | 3454 |
|
3455 |
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>" |
|
3456 |
"Modified: / 02-05-2010 / 18:45:44 / Jakub <zelenja7@fel.cvut.cz>" |
|
13813 | 3457 |
"Modified: / 17-03-2012 / 10:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3458 |
! |
3459 |
||
3460 |
redrawLines |
|
13374 | 3461 |
"redraw diff lines" |
3462 |
||
9985 | 3463 |
|i pom| |
3464 |
||
3465 |
diffMode ifFalse:[^self]. |
|
13813 | 3466 |
true ifTrue:[^self]. |
3467 |
||
9985 | 3468 |
pom := self hasSelection. |
3469 |
(pom) ifTrue:[ ^ self. ]. |
|
12992 | 3470 |
|
9985 | 3471 |
i := 1. |
14369 | 3472 |
[ i <= (deletedLines size) ] whileTrue:[ |
13942 | 3473 |
((deletedLines at:i) > 0) ifTrue:[ |
3474 |
super |
|
3475 |
drawVisibleLine:(deletedLines at:i) |
|
3476 |
with:fgColor |
|
3477 |
and:self colorDeleted. |
|
3478 |
]. |
|
3479 |
i := i + 1. |
|
9985 | 3480 |
]. |
14369 | 3481 |
|
9985 | 3482 |
i := 1. |
14369 | 3483 |
[ i <= (insertedLines size) ] whileTrue:[ |
13942 | 3484 |
((insertedLines at:i) > 0) ifTrue:[ |
3485 |
super |
|
3486 |
drawVisibleLine:(insertedLines at:i) |
|
3487 |
with:fgColor |
|
3488 |
and:self colorInserted. |
|
3489 |
]. |
|
3490 |
i := i + 1. |
|
9985 | 3491 |
]. |
14369 | 3492 |
|
9985 | 3493 |
i := 1. |
14369 | 3494 |
[ i <= (changedLines size) ] whileTrue:[ |
13942 | 3495 |
((changedLines at:i) > 0) ifTrue:[ |
3496 |
super |
|
3497 |
drawVisibleLine:(changedLines at:i) |
|
3498 |
with:fgColor |
|
3499 |
and:self colorChanged. |
|
3500 |
]. |
|
3501 |
i := i + 1. |
|
9985 | 3502 |
]. |
3503 |
||
3504 |
"Created: / 26-04-2010 / 21:04:31 / Jakub <zelenja7@fel.cvut.cz>" |
|
3505 |
"Modified: / 22-06-2010 / 23:28:30 / Jakub <zelenja7@fel.cvut.cz>" |
|
13813 | 3506 |
"Modified: / 17-03-2012 / 09:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3507 |
! ! |
3508 |
||
3509 |
!CodeView2::TextView methodsFor:'editing'! |
|
3510 |
||
3511 |
contentsChanged |
|
13051 | 3512 |
"this one is sent, whenever contents changes its size" |
3513 |
||
9985 | 3514 |
super contentsChanged. |
13057 | 3515 |
|
3516 |
"/ codeView diffMode ifTrue:[ |
|
3517 |
"/ changedDiffText ifTrue:[ |
|
3518 |
"/ codeView recomputeDiff:self. |
|
3519 |
"/ ] ifFalse:[ |
|
3520 |
"/ changedDiffText := true. |
|
3521 |
"/ ]. |
|
3522 |
"/ ] |
|
3523 |
||
9985 | 3524 |
|
3525 |
"Created: / 22-06-2010 / 23:13:24 / Jakub <zelenja7@fel.cvut.cz>" |
|
3526 |
"Modified: / 01-08-2010 / 20:33:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3527 |
! |
|
3528 |
||
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3529 |
deleteCharBeforeCursor |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3530 |
"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
|
3531 |
|
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3532 |
"BIG FAT WARNING: This method is copied from TextEditView, |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3533 |
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
|
3534 |
before the patch will be pushed up" |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3535 |
|
12787 | 3536 |
|soCol wasOn lineNrAboveCursor ln originalLine prevTab| |
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3537 |
|
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3538 |
wasOn := self hideCursor. |
12787 | 3539 |
|
12783 | 3540 |
"JV@2012-01-06: Do not play with autoindent iff cursor is at the very beginning of the line" |
12787 | 3541 |
(autoIndent |
3542 |
and:[cursorCol ~~ 1 |
|
3543 |
and:[ (tabPositions includes:cursorCol) |
|
3544 |
]]) ifTrue:[ |
|
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3545 |
prevTab := (self prevTabBefore:cursorCol) max:1. |
12782 | 3546 |
"JV@2011-12-10: The list can be shorter than cursorLine, |
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3547 |
trailing because empty lines are not physically in the list." |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3548 |
(list size >= cursorLine) ifTrue:[ |
12787 | 3549 |
ln := originalLine := (list at:cursorLine) ? ''. |
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3550 |
] ifFalse:[ |
12787 | 3551 |
ln := originalLine := ''. |
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3552 |
]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3553 |
ln size < prevTab ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3554 |
ln := ln , (String new:prevTab withAll:Character space). |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3555 |
]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3556 |
(ln copyTo:prevTab) isBlank ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3557 |
(ln copyFrom:prevTab+1) isBlank ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3558 |
cursorCol > prevTab ifTrue:[ |
12787 | 3559 |
self st80EditMode ifTrue:[ |
3560 |
"/ ensure that there is no conflict here: st80EditMode will |
|
3561 |
"/ not allow a cursor position beyond the end of line, |
|
3562 |
"/ so avoid that cursorLine:col: will force us to the beginning of the line |
|
3563 |
originalLine size < prevTab ifTrue:[ |
|
12797 | 3564 |
self at:cursorLine put:ln |
12787 | 3565 |
] |
3566 |
]. |
|
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3567 |
self cursorLine:cursorLine col:prevTab. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3568 |
wasOn ifTrue:[ self showCursor ]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3569 |
^ self |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3570 |
]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3571 |
] ifFalse:[ |
16148 | 3572 |
"/ cg: this is ugly behavior; deleting multiple chars at the beginning |
3573 |
"/ is annoying. |
|
3574 |
"/ therefore, only do it, if there are only blanks after the cursor |
|
3575 |
"/ (ln copyFrom:prevTab+1 to:((cursorCol-1) min:ln size)) isBlank ifTrue:[ |
|
3576 |
"/ self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1. |
|
3577 |
"/ self cursorLine:cursorLine col:prevTab. |
|
3578 |
"/ wasOn ifTrue:[ self showCursor ]. |
|
3579 |
"/ ^ self. |
|
3580 |
"/ ] |
|
10971
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3581 |
] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3582 |
]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3583 |
]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3584 |
|
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3585 |
"/ (autoIndent |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3586 |
"/ and:[cursorCol ~~ 1 |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3587 |
"/ and:[cursorLine <= (list size)]]) |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3588 |
"/ ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3589 |
"/ soCol := (self leftIndentForLine:cursorLine) + 1. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3590 |
"/ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3591 |
"/ (cursorCol == soCol and:[soCol > 1]) ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3592 |
"/ ln := list at:cursorLine. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3593 |
"/ (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3594 |
"/ soCol := 1 |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3595 |
"/ ] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3596 |
"/ ] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3597 |
"/ ] ifFalse:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3598 |
soCol := 1. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3599 |
"/ ]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3600 |
|
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3601 |
(cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3602 |
" |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3603 |
somewhere in the middle of a line |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3604 |
" |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3605 |
self cursorLeft. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3606 |
self deleteCharAtLine:cursorLine col:cursorCol. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3607 |
] ifFalse:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3608 |
" |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3609 |
at begin of line - merge with previous line; |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3610 |
except for the very first line. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3611 |
" |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3612 |
(cursorLine == 1) ifFalse:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3613 |
lineNrAboveCursor := self validateCursorLine:(cursorLine - 1). |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3614 |
lineNrAboveCursor < cursorLine ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3615 |
(lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3616 |
"/ we are beyond the end of the text. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3617 |
"/ move the cursor to the previous line. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3618 |
self cursorLine:lineNrAboveCursor col:1. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3619 |
] ifFalse:[ |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3620 |
self mergeLine:lineNrAboveCursor removeBlanks:false. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3621 |
] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3622 |
] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3623 |
] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3624 |
]. |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3625 |
wasOn ifTrue:[ self showCursor ] |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3626 |
|
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3627 |
"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
|
3628 |
"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
|
3629 |
! |
aee24a2ac4fd
Patch for #deleteCharBeforeCursor, should be moved to TextEditView
vrany
parents:
10970
diff
changeset
|
3630 |
|
9985 | 3631 |
getNewOriginText |
3632 |
|i size pole pom text helperText| |
|
3633 |
||
3634 |
i := 1. |
|
3635 |
pole := list. |
|
3636 |
size := list size. |
|
3637 |
text:=''. |
|
10877 | 3638 |
emptyLines isNil ifTrue:[emptyLines := #()]. |
9985 | 3639 |
[ i <= size ] whileTrue:[ |
3640 |
pom := emptyLines indexOf:i. |
|
3641 |
(pom = 0) ifFalse:[ |
|
3642 |
helperText := pole at:i. |
|
3643 |
(helperText = '') ifFalse:[ |
|
3644 |
(helperText isNil)ifTrue:[helperText:='']. |
|
3645 |
helperText:=helperText,Character cr. |
|
3646 |
text := text asString , helperText asString. |
|
3647 |
]. |
|
3648 |
] ifTrue:[ |
|
3649 |
helperText := pole at:i. |
|
3650 |
(helperText isNil)ifTrue:[helperText:='']. |
|
3651 |
helperText:=helperText,Character cr. |
|
3652 |
text := text asString , helperText asString. |
|
3653 |
]. |
|
3654 |
i:=i+1. |
|
3655 |
]. |
|
3656 |
^text |
|
3657 |
||
3658 |
"Created: / 22-06-2010 / 22:33:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
3659 |
"Modified: / 24-06-2010 / 14:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10877 | 3660 |
"Modified: / 18-11-2011 / 14:58:22 / cg" |
9985 | 3661 |
! ! |
3662 |
||
3663 |
!CodeView2::TextView methodsFor:'editing-basic'! |
|
3664 |
||
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3665 |
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
|
3666 |
"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
|
3667 |
|
10731 | 3668 |
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
|
3669 |
self notifyLinesModifiedFrom: lineNr to: lineNr. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3670 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3671 |
"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
|
3672 |
! |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3673 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3674 |
basicDeleteFromLine:startLineNr toLine:endLineNr |
10728 | 3675 |
|
3676 |
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
|
3677 |
self notifyLinesDeletedFrom:startLineNr to:endLineNr. |
9985 | 3678 |
|
3679 |
"Created: / 28-06-2011 / 09:09:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3680 |
! |
|
3681 |
||
3682 |
basicDeleteLineWithoutRedraw:lineNr |
|
3683 |
||
10728 | 3684 |
super basicDeleteLineWithoutRedraw:lineNr. |
3685 |
self notifyLinesDeletedFrom: lineNr to: lineNr. |
|
9985 | 3686 |
|
3687 |
"Created: / 28-06-2011 / 09:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3688 |
! |
|
3689 |
||
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3690 |
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
|
3691 |
"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
|
3692 |
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
|
3693 |
|
10728 | 3694 |
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
|
3695 |
self notifyLinesModifiedFrom: lineNr to: lineNr. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3696 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3697 |
"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
|
3698 |
! |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3699 |
|
9985 | 3700 |
basicMergeLine:lineNr removeBlanks:removeBlanks |
3701 |
||
10728 | 3702 |
super basicMergeLine:lineNr removeBlanks:removeBlanks. |
9985 | 3703 |
self notifyLinesDeletedFrom: lineNr + 1 to: lineNr + 1. |
3704 |
||
3705 |
"Created: / 28-06-2011 / 09:13:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3706 |
! |
|
3707 |
||
3708 |
basicSplitLine:lineNr before:colNr |
|
3709 |
||
10728 | 3710 |
super basicSplitLine:lineNr before:colNr. |
3711 |
self notifyLinesInsertedFrom: lineNr +1 to: lineNr + 1. |
|
9985 | 3712 |
|
3713 |
"Created: / 28-06-2011 / 09:14:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10977 | 3714 |
! |
3715 |
||
14439 | 3716 |
basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr |
3717 |
super basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr. |
|
3718 |
self updateReallyModified. |
|
3719 |
! |
|
3720 |
||
3721 |
basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
|
3722 |
super basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
|
3723 |
self updateReallyModified. |
|
3724 |
! |
|
3725 |
||
10977 | 3726 |
insertLines:someText from:start to:end before:lineNr |
3727 |
||
3728 |
"/JV@2011-12-20: HACK, the super implementation should |
|
3729 |
"/not use leftIndent...when pasting. Following is a workaround" |
|
14959 | 3730 |
self withAutoIndent:false do:[ |
12787 | 3731 |
super insertLines:someText from:start to:end before:lineNr. |
3732 |
] |
|
10977 | 3733 |
|
3734 |
"Created: / 20-12-2011 / 15:32:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3735 |
! ! |
3736 |
||
3737 |
!CodeView2::TextView methodsFor:'event handling'! |
|
3738 |
||
3739 |
buttonMotion:button x:x y:y |
|
3740 |
||
3741 |
(codeView buttonMotion:button x:x y:y in: self) |
|
3742 |
ifFalse:[super buttonMotion:button x:x y:y]. |
|
3743 |
||
3744 |
"Created: / 14-02-2010 / 16:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3745 |
"Modified: / 06-03-2010 / 20:10:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3746 |
! |
|
3747 |
||
3748 |
buttonPress: button x: x y: y |
|
3749 |
| ctrlDown | |
|
3750 |
||
3751 |
(codeView buttonPress:button x:x y:y in: self) |
|
12870 | 3752 |
ifFalse:[super buttonPress:button x:x y:y]. |
9985 | 3753 |
" |
3754 |
((ctrlDown := self sensor ctrlDown) and: [ codeView syntaxElementSelection notNil]) |
|
3755 |
ifTrue: [codeView buttonPressInTextView: button x:x y:y ctrlDown: ctrlDown]. |
|
3756 |
super |
|
3757 |
buttonPress: button |
|
3758 |
x: x |
|
3759 |
y: y |
|
3760 |
" |
|
3761 |
||
3762 |
"Created: / 14-02-2010 / 18:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3763 |
"Modified: / 06-03-2010 / 20:37:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3764 |
! |
|
3765 |
||
12868 | 3766 |
buttonRelease: button x: x y: y |
3767 |
(codeView buttonRelease:button x:x y:y in: self) |
|
12870 | 3768 |
ifFalse:[super buttonRelease:button x:x y:y]. |
12868 | 3769 |
! |
3770 |
||
9985 | 3771 |
exposeX:x y:y width:w height:h |
3772 |
super |
|
3773 |
exposeX:x |
|
3774 |
y:y |
|
3775 |
width:w |
|
3776 |
height:h. |
|
13374 | 3777 |
|
3778 |
"/ if in diffmode... |
|
9985 | 3779 |
self redrawLines. |
3780 |
||
3781 |
"Created: / 05-04-2010 / 10:07:50 / Jakub <zelenja7@fel.cvut.cz>" |
|
3782 |
"Modified: / 02-05-2010 / 18:41:07 / Jakub <zelenja7@fel.cvut.cz>" |
|
3783 |
! |
|
3784 |
||
3785 |
keyPress:key x:x y:y |
|
3786 |
(codeView keyPress:key x:x y:y in: self) |
|
3787 |
ifFalse:[super keyPress:key x:x y:y]. |
|
3788 |
||
3789 |
"Modified: / 06-03-2010 / 20:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3790 |
"Modified: / 05-04-2010 / 09:55:52 / Jakub <zelenja7@fel.cvut.cz>" |
|
3791 |
! |
|
3792 |
||
3793 |
keyRelease: key x: x y: y |
|
3794 |
||
3795 |
(codeView keyRelease:key x:x y:y in: self) |
|
3796 |
ifFalse:[super keyRelease:key x:x y:y]. |
|
3797 |
" |
|
3798 |
(key = #Control_L) ifTrue: |
|
3799 |
[ codeView highlightClear. self redraw ]. |
|
3800 |
||
3801 |
^ super |
|
3802 |
keyRelease: key |
|
3803 |
x: x |
|
3804 |
y: y |
|
3805 |
" |
|
3806 |
||
3807 |
"Created: / 14-02-2010 / 16:38:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3808 |
"Modified: / 06-03-2010 / 21:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3809 |
! ! |
|
3810 |
||
10970
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3811 |
!CodeView2::TextView methodsFor:'formatting'! |
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3812 |
|
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3813 |
leftIndentForLine:lineNr |
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3814 |
|
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3815 |
| lang | |
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3816 |
lang := codeView language. |
10973
44ccdbc1fb0a
fix in #leftIndentForLine: for view with nil language
vrany
parents:
10972
diff
changeset
|
3817 |
"Bit hacky here, should ask language some language toolbox |
44ccdbc1fb0a
fix in #leftIndentForLine: for view with nil language
vrany
parents:
10972
diff
changeset
|
3818 |
for formatting helper, that should do it..." |
44ccdbc1fb0a
fix in #leftIndentForLine: for view with nil language
vrany
parents:
10972
diff
changeset
|
3819 |
(lang notNil and:[lang isSmalltalk]) ifTrue:[ |
13942 | 3820 |
| line lineNo indent | |
3821 |
lineNo := lineNr. |
|
3822 |
[lineNo ~~ 1] whileTrue:[ |
|
3823 |
lineNo := lineNo - 1. |
|
3824 |
line := self listAt:lineNo. |
|
3825 |
||
3826 |
line notNil ifTrue:[ |
|
3827 |
indent := line indexOfNonSeparatorStartingAt:1. |
|
3828 |
"beggining od block" |
|
3829 |
line notEmptyOrNil ifTrue:[ |
|
14672
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3830 |
| lastCharIndex lastChar | |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3831 |
|
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3832 |
lastCharIndex := line size. |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3833 |
lastChar := nil. |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3834 |
[ lastCharIndex > 0 ] whileTrue:[ |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3835 |
(lastChar := line at: lastCharIndex) isSeparator ifTrue:[ |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3836 |
lastCharIndex := lastCharIndex - 1. |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3837 |
] ifFalse:[ |
14674
71ed373e94bc
Oops, fixed stc compilation problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14672
diff
changeset
|
3838 |
lastCharIndex := -2. "/ To terminate the loop. |
14672
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3839 |
]. |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3840 |
]. |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3841 |
lastCharIndex == -2 ifTrue:[ |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3842 |
lastChar == $[ ifTrue:[ |
13942 | 3843 |
indent := indent + 4. |
14672
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3844 |
] ifFalse:[ |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3845 |
"end of block args" |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3846 |
(lastChar == $| and: [line includes: $[]) ifTrue:[ |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3847 |
indent := indent + 4. |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3848 |
] |
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3849 |
]. |
13942 | 3850 |
]. |
3851 |
]. |
|
3852 |
indent ~~ 0 ifTrue:[ |
|
14672
1359a8b36fe9
Fix in #leftIndentForLine: ignore whitespace at the end of the line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14638
diff
changeset
|
3853 |
^ indent - 1 |
13942 | 3854 |
] |
3855 |
] |
|
3856 |
]. |
|
3857 |
^0. |
|
10970
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3858 |
]. |
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3859 |
^super leftIndentForLine:lineNr |
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3860 |
|
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3861 |
"Created: / 10-12-2011 / 11:02:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14674
71ed373e94bc
Oops, fixed stc compilation problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14672
diff
changeset
|
3862 |
"Modified: / 24-07-2014 / 09:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10970
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3863 |
! ! |
dc9da0fc38ef
Small improvement for auto-indent (when enabled, not by default)
vrany
parents:
10967
diff
changeset
|
3864 |
|
9985 | 3865 |
!CodeView2::TextView methodsFor:'initialization'! |
3866 |
||
3867 |
initialize |
|
3868 |
||
3869 |
super initialize. |
|
3870 |
||
3871 |
changedDiffText := true. |
|
3872 |
diffMode := false. |
|
10224 | 3873 |
suppressNotifications := false. |
10781 | 3874 |
reallyModifiedChannel := false asValue. |
13942 | 3875 |
scrollInProgress := false. |
9985 | 3876 |
|
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
3877 |
self enableMotionEvents. |
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
3878 |
|
9985 | 3879 |
"Created: / 23-06-2010 / 17:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3880 |
"Modified: / 06-07-2011 / 17:46:31 / jv" |
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
3881 |
"Modified: / 21-08-2011 / 10:09:29 / cg" |
13942 | 3882 |
"Modified: / 14-02-2014 / 10:31:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3883 |
! |
3884 |
||
3885 |
setCodeView: aCodeView2 |
|
3886 |
||
3887 |
codeView := aCodeView2. |
|
3888 |
codeView addDependent: self. |
|
3889 |
gutterView := aCodeView2 gutterView. |
|
3890 |
||
3891 |
"Created: / 14-02-2010 / 15:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3892 |
"Modified: / 17-06-2011 / 12:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3893 |
! |
|
3894 |
||
3895 |
setGutterView: aGutterView |
|
3896 |
||
3897 |
self assert: gutterView isNil message:'Attempting to set gutterView twice'. |
|
3898 |
gutterView := aGutterView. |
|
3899 |
gutterView setTextView: self. |
|
3900 |
||
3901 |
"Created: / 02-09-2009 / 21:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3902 |
! ! |
|
3903 |
||
3904 |
!CodeView2::TextView methodsFor:'menu & menu actions'! |
|
3905 |
||
10781 | 3906 |
accept |
3907 |
||
3908 |
super accept. |
|
3909 |
reallyModifiedChannel value: false. |
|
10785 | 3910 |
listOriginal := list copy. |
10781 | 3911 |
|
3912 |
"Created: / 07-10-2011 / 19:36:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3913 |
! |
|
3914 |
||
10784 | 3915 |
cancel |
3916 |
||
10785 | 3917 |
self list: listOriginal |
10784 | 3918 |
|
3919 |
"Created: / 08-02-2010 / 09:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3920 |
! |
|
3921 |
||
9985 | 3922 |
editMenu |
3923 |
||
11398
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3924 |
^ codeView editMenu |
9985 | 3925 |
|
3926 |
"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
|
3927 |
"Modified (format): / 08-03-2012 / 12:30:22 / cg" |
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3928 |
! |
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3929 |
|
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3930 |
searchVariableVisible |
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3931 |
"search variable option in searchbox visible?" |
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3932 |
|
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3933 |
^ true |
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3934 |
|
84d3987c0155
better search (for variables)
Claus Gittinger <cg@exept.de>
parents:
11393
diff
changeset
|
3935 |
"Created: / 08-03-2012 / 14:01:51 / cg" |
9985 | 3936 |
! ! |
3937 |
||
3938 |
!CodeView2::TextView methodsFor:'notification'! |
|
3939 |
||
3940 |
notifyLinesDeletedFrom: startLine to: endLine |
|
3941 |
||
10781 | 3942 |
self updateReallyModified. |
10224 | 3943 |
suppressNotifications ifTrue:[^self]. |
3944 |
codeView linesDeletedFrom: startLine to: endLine. |
|
3945 |
suppressNotifications := true. |
|
3946 |
||
9985 | 3947 |
"Created: / 28-06-2011 / 09:12:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3948 |
"Modified: / 06-07-2011 / 17:47:05 / jv" |
10781 | 3949 |
"Modified: / 07-10-2011 / 19:20:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3950 |
! |
3951 |
||
3952 |
notifyLinesInsertedFrom: startLine to: endLine |
|
3953 |
||
10781 | 3954 |
self updateReallyModified. |
10224 | 3955 |
suppressNotifications ifTrue:[^self]. |
3956 |
codeView linesInsertedFrom: startLine to: endLine. |
|
3957 |
suppressNotifications := true. |
|
3958 |
||
9985 | 3959 |
"Created: / 28-06-2011 / 09:12:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3960 |
"Modified: / 06-07-2011 / 17:47:20 / jv" |
10781 | 3961 |
"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
|
3962 |
! |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3963 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3964 |
notifyLinesModifiedFrom: startLine to: endLine |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3965 |
|
10781 | 3966 |
self updateReallyModified. |
10708
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3967 |
suppressNotifications ifTrue:[^self]. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3968 |
codeView linesModifiedFrom: startLine to: endLine. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3969 |
suppressNotifications := true. |
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3970 |
|
dd79e944752e
Fixes for syntax highlighting and code navigation. Now it should work fine debugger.
vrany
parents:
10689
diff
changeset
|
3971 |
"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
|
3972 |
"Created: / 16-09-2011 / 15:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3973 |
! ! |
3974 |
||
3975 |
!CodeView2::TextView methodsFor:'private'! |
|
3976 |
||
14503 | 3977 |
isTextDifferentFromOriginalSource |
10781 | 3978 |
"check for modified code by comparing the source against |
3979 |
the codeViews contents. |
|
14503 | 3980 |
That's the true modified value |
3981 |
(in case user undid his changes, and the displayed text is actually original)" |
|
3982 |
||
3983 |
|different changedSource originalSource |
|
3984 |
lastLineOfChangedSource lastLineOfOriginalSource |
|
3985 |
originalL changedL checkIfDifferent| |
|
3986 |
||
3987 |
"/ possibly call at higher prio to prevent it from being changed while we convert it (by editing) |
|
3988 |
||
3989 |
different := false. |
|
3990 |
||
3991 |
"/ cg: don't do that (collecting original/changedSource); |
|
3992 |
"/ for huge files (>8Mb), this makes editing annoying slow (editing a trace output, for example) |
|
12347 | 3993 |
"/ changedSource := list ? #(). |
3994 |
"/ changedSource := changedSource collect:[:line | line isEmptyOrNil ifTrue:[nil] ifFalse:[line]]. |
|
3995 |
"/ [changedSource size > 0 and:[changedSource last isNil]] whileTrue:[ |
|
3996 |
"/ changedSource := changedSource removeLast. |
|
3997 |
"/ ]. |
|
3998 |
"/ |
|
3999 |
"/ originalSource := listOriginal ? #() "self model value ? ''". |
|
4000 |
"/ originalSource := originalSource collect:[:line | line isEmptyOrNil ifTrue:[nil] ifFalse:[line]]. |
|
4001 |
"/ [originalSource size > 0 and:[originalSource last isNil]] whileTrue:[ |
|
4002 |
"/ originalSource := originalSource removeLast |
|
4003 |
"/ ]. |
|
4004 |
"/ originalSource size ~~ changedSource size ifTrue:[ |
|
4005 |
"/ modified := true. |
|
4006 |
"/ ] ifFalse:[ |
|
4007 |
"/ | i stopIndex | |
|
4008 |
"/ |
|
4009 |
"/ i := 1. |
|
4010 |
"/ stopIndex := originalSource size + 1. |
|
4011 |
"/ [ modified not and:[ i < stopIndex ] ] whileTrue:[ |
|
4012 |
"/ | originalL changedL | |
|
4013 |
"/ |
|
4014 |
"/ originalL := ((originalSource at: i) ? '') string. |
|
4015 |
"/ changedL := ((changedSource at: i) ? '') string. |
|
4016 |
"/ originalL ~= changedL ifTrue:[ |
|
4017 |
"/ originalL withoutTrailingSeparators ~= changedL withoutTrailingSeparators ifTrue:[ |
|
4018 |
"/ modified := true. |
|
4019 |
"/ ] |
|
4020 |
"/ ]. |
|
4021 |
"/ i := i + 1. |
|
4022 |
"/ ] |
|
4023 |
"/ ]. |
|
14503 | 4024 |
|
4025 |
list size ~~ listOriginal size ifTrue:[ |
|
4026 |
^ true |
|
4027 |
]. |
|
4028 |
||
4029 |
"/ instead, do everything without collecting a new stringcollection. |
|
4030 |
changedSource := list ? #(). |
|
4031 |
lastLineOfChangedSource := changedSource size. |
|
4032 |
[lastLineOfChangedSource > 0 and:[(changedSource at:lastLineOfChangedSource) isEmptyOrNil]] whileTrue:[ |
|
4033 |
lastLineOfChangedSource := lastLineOfChangedSource - 1. |
|
4034 |
]. |
|
4035 |
originalSource := listOriginal ? #(). |
|
4036 |
lastLineOfOriginalSource := originalSource size. |
|
4037 |
[lastLineOfOriginalSource > 0 and:[(originalSource at:lastLineOfOriginalSource) isEmptyOrNil]] whileTrue:[ |
|
4038 |
lastLineOfOriginalSource := lastLineOfOriginalSource - 1. |
|
4039 |
]. |
|
4040 |
||
4041 |
lastLineOfOriginalSource ~~ lastLineOfChangedSource ifTrue:[ |
|
4042 |
^ true. |
|
4043 |
]. |
|
4044 |
||
4045 |
checkIfDifferent := |
|
4046 |
[:lNr | |
|
14590
45e301c7bb21
Fix in CodeView2::TextView>>isTextDifferentFromOriginalSource
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14549
diff
changeset
|
4047 |
|
14504 | 4048 |
lNr > originalSource size ifTrue:[ |
4049 |
originalL := ''. |
|
4050 |
] ifFalse:[ |
|
4051 |
originalL := ((originalSource at: lNr) ? '') string. |
|
4052 |
]. |
|
14511 | 4053 |
lNr > changedSource size ifTrue:[ |
14504 | 4054 |
changedL := ''. |
4055 |
] ifFalse:[ |
|
14511 | 4056 |
changedL := ((changedSource at: lNr) ? '') string. |
14504 | 4057 |
]. |
14503 | 4058 |
originalL ~= changedL ifTrue:[ |
4059 |
originalL withoutTrailingSeparators ~= changedL withoutTrailingSeparators ifTrue:[ |
|
4060 |
^ true. |
|
4061 |
] |
|
4062 |
]. |
|
12347 | 4063 |
]. |
4064 |
||
14503 | 4065 |
"/ do a quick check in the cursor line. This is most likely to be different |
4066 |
"/ saves comparing all the rest in 99% of cases (while typing) |
|
14590
45e301c7bb21
Fix in CodeView2::TextView>>isTextDifferentFromOriginalSource
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14549
diff
changeset
|
4067 |
(cursorLine notNil and:[cursorLine > 0]) ifTrue:[ |
14503 | 4068 |
checkIfDifferent value:cursorLine. |
10781 | 4069 |
]. |
4070 |
||
14503 | 4071 |
1 to:lastLineOfOriginalSource do:checkIfDifferent. |
4072 |
^ false |
|
14590
45e301c7bb21
Fix in CodeView2::TextView>>isTextDifferentFromOriginalSource
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14549
diff
changeset
|
4073 |
|
45e301c7bb21
Fix in CodeView2::TextView>>isTextDifferentFromOriginalSource
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14549
diff
changeset
|
4074 |
"Modified: / 07-07-2014 / 11:11:57 / jv" |
14503 | 4075 |
! |
4076 |
||
4077 |
superEditMenu |
|
4078 |
||
4079 |
^super editMenu |
|
4080 |
||
4081 |
"Created: / 14-02-2010 / 15:48:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4082 |
! |
|
4083 |
||
4084 |
updateReallyModified |
|
4085 |
"check for modified code by comparing the source against |
|
4086 |
the codeViews contents. |
|
4087 |
Thats the true modified value (in case user undid its changes, |
|
4088 |
and the displayed text is actually original" |
|
4089 |
||
4090 |
|modified| |
|
4091 |
||
4092 |
reallyModifiedChannel isNil ifTrue:[^self]. |
|
4093 |
"JV@2011-10-27: Idea is not to do anything if nobody is |
|
4094 |
interested. Not sure if it is a good idea, thought." |
|
4095 |
reallyModifiedChannel dependents isEmptyOrNil ifTrue:[^self]. |
|
4096 |
||
4097 |
"/ higher prio to prevent it from being changed while we convert it (by editing) |
|
4098 |
||
4099 |
modified := self isTextDifferentFromOriginalSource. |
|
4100 |
||
10781 | 4101 |
reallyModifiedChannel value: modified |
4102 |
||
4103 |
"Created: / 07-10-2011 / 19:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10783 | 4104 |
"Modified: / 08-10-2011 / 11:10:01 / cg" |
10844
cbb5f5dd900a
Performance fix in CodeView2::TextView>>updateReallyModified
vrany
parents:
10834
diff
changeset
|
4105 |
"Modified: / 28-10-2011 / 09:23:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 4106 |
! ! |
4107 |
||
11903
5b027fc44ff8
+supportsSyntaxElements query
Claus Gittinger <cg@exept.de>
parents:
11769
diff
changeset
|
4108 |
!CodeView2::TextView methodsFor:'queries'! |
5b027fc44ff8
+supportsSyntaxElements query
Claus Gittinger <cg@exept.de>
parents:
11769
diff
changeset
|
4109 |
|
13625 | 4110 |
editedClass |
4111 |
|cls| |
|
4112 |
||
4113 |
(cls := codeView classHolder value) notNil ifTrue:[ |
|
4114 |
^ cls |
|
4115 |
]. |
|
4116 |
^ super editedClass |
|
4117 |
! |
|
4118 |
||
4119 |
editedMethod |
|
4120 |
|cls| |
|
4121 |
||
4122 |
(cls := codeView methodHolder value) notNil ifTrue:[ |
|
4123 |
^ cls |
|
4124 |
]. |
|
4125 |
^ super editedMethod |
|
4126 |
! |
|
4127 |
||
11903
5b027fc44ff8
+supportsSyntaxElements query
Claus Gittinger <cg@exept.de>
parents:
11769
diff
changeset
|
4128 |
supportsSyntaxElements |
14506 | 4129 |
"syntax elements are a byproduct of the syntax highlighter; |
4130 |
it is a list of elements, which chain together same-named variables |
|
4131 |
and parts of a keyword message's selector. |
|
4132 |
These allow for quick forward/backward navigation to the next/prev. occurrence |
|
4133 |
of a variable. Be aware that the implementation is buggy, in that it does not |
|
4134 |
deal correctly with same-named blockvars of different blocks" |
|
4135 |
||
11903
5b027fc44ff8
+supportsSyntaxElements query
Claus Gittinger <cg@exept.de>
parents:
11769
diff
changeset
|
4136 |
^ true |
12980 | 4137 |
! |
4138 |
||
4139 |
syntaxElementAtPosition:position |
|
4140 |
"is there is a syntax element at position? |
|
4141 |
If so, return the element; otherwise, return nil" |
|
4142 |
||
14506 | 4143 |
|syntaxElements el| |
12980 | 4144 |
|
4145 |
syntaxElements := codeView syntaxElements. |
|
4146 |
syntaxElements isEmptyOrNil ifTrue:[^ nil]. |
|
4147 |
el := syntaxElements detect:[:el | position between:el start and:el stop] ifNone:nil. |
|
4148 |
el isNil ifTrue:[^ nil]. |
|
4149 |
^ el. |
|
4150 |
||
4151 |
"Created: / 08-03-2012 / 14:21:52 / cg" |
|
4152 |
! |
|
4153 |
||
4154 |
syntaxElementForSelectedVariable |
|
4155 |
"is there is a syntax element for a variable under the cursor? |
|
4156 |
If so, return the element; otherwise, return nil" |
|
4157 |
||
4158 |
|element startPosition endPosition| |
|
4159 |
||
14506 | 4160 |
self selectionAsString isEmptyOrNil ifTrue:[ |
4161 |
"/ ^ nil. |
|
4162 |
element := self syntaxElementForVariableUnderCursor. |
|
4163 |
] ifFalse:[ |
|
4164 |
startPosition := self characterPositionOfLine:selectionStartLine col:selectionStartCol. |
|
4165 |
endPosition := self characterPositionOfLine:selectionEndLine col:selectionEndCol. |
|
4166 |
element := self syntaxElementAtPosition:startPosition. |
|
4167 |
]. |
|
12980 | 4168 |
element isNil ifTrue:[^ nil]. |
4169 |
(element start = startPosition and:[element stop = endPosition]) ifFalse:[^ nil]. |
|
4170 |
||
4171 |
element isNil ifTrue:[^ nil]. |
|
4172 |
element isVariableOrSelf ifFalse:[^ nil]. |
|
4173 |
^ element |
|
4174 |
||
4175 |
"Created: / 08-03-2012 / 14:21:15 / cg" |
|
4176 |
! |
|
4177 |
||
4178 |
syntaxElementForSelectorUnderCursor |
|
4179 |
"is there is a syntax element for a message selector under the cursor? |
|
4180 |
If so, return the element; otherwise, return nil" |
|
4181 |
||
4182 |
|elementUnderCursor | |
|
4183 |
||
14506 | 4184 |
elementUnderCursor := self syntaxElementUnderCursor. |
12980 | 4185 |
elementUnderCursor isNil ifTrue:[^ nil]. |
4186 |
elementUnderCursor isSelector ifFalse:[^ nil]. |
|
4187 |
^ elementUnderCursor. |
|
4188 |
||
4189 |
"Created: / 08-03-2012 / 12:44:03 / cg" |
|
4190 |
! |
|
4191 |
||
4192 |
syntaxElementForVariableUnderCursor |
|
4193 |
"is there is a syntax element for a variable under the cursor? |
|
4194 |
If so, return the element; otherwise, return nil" |
|
4195 |
||
4196 |
|elementUnderCursor | |
|
4197 |
||
14506 | 4198 |
elementUnderCursor := self syntaxElementUnderCursor. |
12980 | 4199 |
elementUnderCursor isNil ifTrue:[^ nil]. |
4200 |
elementUnderCursor isVariableOrSelf ifFalse:[^ nil]. |
|
4201 |
^ elementUnderCursor. |
|
4202 |
||
4203 |
"Created: / 08-03-2012 / 12:44:03 / cg" |
|
14506 | 4204 |
! |
4205 |
||
4206 |
syntaxElementUnderCursor |
|
4207 |
"is there is a syntax element under the cursor? |
|
4208 |
If so, return the element; otherwise, return nil" |
|
4209 |
||
4210 |
^ self syntaxElementAtPosition:(self characterPositionOfCursor). |
|
11903
5b027fc44ff8
+supportsSyntaxElements query
Claus Gittinger <cg@exept.de>
parents:
11769
diff
changeset
|
4211 |
! ! |
5b027fc44ff8
+supportsSyntaxElements query
Claus Gittinger <cg@exept.de>
parents:
11769
diff
changeset
|
4212 |
|
9985 | 4213 |
!CodeView2::TextView methodsFor:'scrolling'! |
4214 |
||
13813 | 4215 |
basicScrollTo:anOrigin redraw:doRedraw |
13942 | 4216 |
| savedScrollIProgress | |
4217 |
||
4218 |
savedScrollIProgress := scrollInProgress. |
|
4219 |
scrollInProgress := true. |
|
4220 |
[ |
|
4221 |
super scrollTo:anOrigin redraw:doRedraw |
|
4222 |
] ensure:[ |
|
4223 |
scrollInProgress := savedScrollIProgress. |
|
4224 |
]. |
|
4225 |
"Modified: / 14-02-2014 / 10:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13813 | 4226 |
! |
4227 |
||
9985 | 4228 |
originChanged:delta |
4229 |
||
4230 |
super originChanged:delta. |
|
4231 |
||
13105 | 4232 |
"/ gutterView invalidate. |
9985 | 4233 |
|
4234 |
"Created: / 07-12-2009 / 21:50:49 / Jindra <a>" |
|
4235 |
! |
|
4236 |
||
13813 | 4237 |
scrollTo:anOrigin redraw:doRedraw |
4238 |
||
4239 |
codeView scrollTo:anOrigin redraw:doRedraw in: self. |
|
4240 |
self basicScrollTo:anOrigin redraw:doRedraw |
|
4241 |
||
4242 |
"Modified: / 06-04-2010 / 14:04:28 / Jakub <zelenja7@fel.cvut.cz>" |
|
4243 |
"Modified: / 17-03-2012 / 10:06:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4244 |
"Created: / 19-03-2012 / 17:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 4245 |
! ! |
4246 |
||
10224 | 4247 |
!CodeView2::TextView methodsFor:'undo & again'! |
4248 |
||
4249 |
nonUndoableDo: aBlock |
|
4250 |
||
4251 |
super nonUndoableDo: aBlock. |
|
4252 |
suppressNotifications := false. |
|
4253 |
||
4254 |
"Created: / 06-07-2011 / 17:48:27 / jv" |
|
4255 |
! |
|
4256 |
||
4257 |
undoableDo: aBlock info: into |
|
4258 |
||
4259 |
super undoableDo: aBlock info: into. |
|
4260 |
suppressNotifications := false. |
|
4261 |
||
4262 |
"Created: / 06-07-2011 / 17:48:49 / jv" |
|
4263 |
! ! |
|
4264 |
||
9985 | 4265 |
!CodeView2 class methodsFor:'documentation'! |
4266 |
||
10293 | 4267 |
version |
15718 | 4268 |
^ '$Header$' |
10293 | 4269 |
! |
4270 |
||
9985 | 4271 |
version_CVS |
15718 | 4272 |
^ '$Header$' |
9985 | 4273 |
! |
4274 |
||
4275 |
version_SVN |
|
15718 | 4276 |
^ '$Id$' |
9985 | 4277 |
! ! |
4278 |
||
12347 | 4279 |
|
9985 | 4280 |
CodeView2 initialize! |