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