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