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