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