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