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