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