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