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