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