author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 27 Sep 2012 21:08:20 +0100 | |
branch | jv |
changeset 12296 | 6921627a8c27 |
parent 12287 | 400a99059170 |
child 12301 | d9f03189bb66 |
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 |
|
31 |
instanceVariableNames:'gutterView textView textViewScroller methodHolder languageHolder |
|
32 |
classHolder browserHolder codeAspect modifiedChannel |
|
12125 | 33 |
showGutterChannel showAcceptCancelBarChannel modeHolder |
34 |
serviceManager services servicesFromClient syntaxElements |
|
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
35 |
currentParseNodeHolder currentBlockNodeHolder |
12125 | 36 |
syntaxElementSelection highlightEmphasis diffMode |
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
37 |
synchronizedCodeViews' |
9985 | 38 |
classVariableNames:'TraceSelectors' |
39 |
poolDictionaries:'' |
|
40 |
category:'Interface-CodeView' |
|
41 |
! |
|
42 |
||
43 |
SimpleView subclass:#GutterView |
|
12125 | 44 |
instanceVariableNames:'codeView textView textViewScroller widthAcceptCancel |
45 |
widthAnnotations widthDiffInfo firstLineShown lastLineShown |
|
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
46 |
acceptColor cancelColor diffColor currentBlockNodeHolder' |
9985 | 47 |
classVariableNames:'' |
48 |
poolDictionaries:'' |
|
49 |
privateIn:CodeView2 |
|
50 |
! |
|
51 |
||
52 |
CodeView subclass:#TextView |
|
12125 | 53 |
instanceVariableNames:'listOriginal codeView gutterView diffMode deletedLines |
54 |
insertedLines lastFirstLine changedLines scrolled originDiffText |
|
55 |
emptyLines changedDiffText suppressNotifications |
|
56 |
reallyModifiedChannel' |
|
9985 | 57 |
classVariableNames:'' |
58 |
poolDictionaries:'' |
|
59 |
privateIn:CodeView2 |
|
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 |
|
12205 | 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 |
||
12205 | 218 |
|
10290 | 219 |
" |
12205 | 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 |
||
226 |
^ |
|
227 |
#(Menu |
|
228 |
( |
|
229 |
(MenuItem |
|
10262 | 230 |
label: 'Implementors...' |
9985 | 231 |
itemValue: browseImplementorsOfIt |
232 |
translateLabel: true |
|
10262 | 233 |
submenuChannel: implementorsMenu |
9985 | 234 |
shortcutKey: ImplementorsOfIt |
235 |
) |
|
236 |
(MenuItem |
|
10262 | 237 |
label: 'Senders...' |
9985 | 238 |
itemValue: browseSendersOfIt |
239 |
translateLabel: true |
|
10262 | 240 |
submenuChannel: sendersMenu |
9985 | 241 |
shortcutKey: SendersOfIt |
242 |
) |
|
243 |
(MenuItem |
|
244 |
label: 'Refactor' |
|
12205 | 245 |
nameKey: refactor |
9985 | 246 |
translateLabel: true |
247 |
isVisible: false |
|
248 |
shortcutKey: Shift |
|
249 |
) |
|
250 |
(MenuItem |
|
251 |
label: '-' |
|
252 |
) |
|
253 |
(MenuItem |
|
254 |
label: 'Accept' |
|
255 |
itemValue: accept |
|
256 |
translateLabel: true |
|
257 |
shortcutKey: Accept |
|
258 |
) |
|
259 |
(MenuItem |
|
260 |
label: '-' |
|
261 |
) |
|
262 |
(MenuItem |
|
263 |
label: 'Cut' |
|
264 |
itemValue: cut |
|
265 |
translateLabel: true |
|
266 |
shortcutKey: Cut |
|
267 |
) |
|
268 |
(MenuItem |
|
269 |
label: 'Copy' |
|
270 |
itemValue: copySelection |
|
271 |
translateLabel: true |
|
272 |
shortcutKey: Copy |
|
273 |
) |
|
274 |
(MenuItem |
|
275 |
label: 'Paste' |
|
276 |
itemValue: pasteOrReplace |
|
277 |
translateLabel: true |
|
278 |
shortcutKey: Paste |
|
279 |
) |
|
280 |
(MenuItem |
|
281 |
label: '-' |
|
282 |
) |
|
283 |
(MenuItem |
|
284 |
label: 'Undo' |
|
285 |
itemValue: undo |
|
286 |
translateLabel: true |
|
287 |
shortcutKey: Undo |
|
288 |
) |
|
289 |
(MenuItem |
|
290 |
label: '-' |
|
291 |
) |
|
292 |
(MenuItem |
|
293 |
label: 'Do it' |
|
294 |
itemValue: doIt |
|
295 |
translateLabel: true |
|
296 |
shortcutKey: DoIt |
|
297 |
) |
|
298 |
(MenuItem |
|
299 |
label: 'Print it' |
|
300 |
itemValue: printIt |
|
301 |
translateLabel: true |
|
302 |
shortcutKey: PrintIt |
|
303 |
) |
|
304 |
(MenuItem |
|
305 |
label: 'Inspect it' |
|
306 |
itemValue: inspectIt |
|
307 |
translateLabel: true |
|
308 |
shortcutKey: InspectIt |
|
309 |
) |
|
310 |
(MenuItem |
|
311 |
label: 'Profile it' |
|
312 |
itemValue: profileIt |
|
313 |
translateLabel: true |
|
314 |
shortcutKey: InspectIt |
|
315 |
) |
|
316 |
(MenuItem |
|
317 |
label: '-' |
|
318 |
) |
|
319 |
(MenuItem |
|
320 |
label: 'Show Gutter' |
|
321 |
nameKey: ShowGutter |
|
322 |
translateLabel: true |
|
323 |
indication: showGutterChannel |
|
324 |
) |
|
325 |
(MenuItem |
|
326 |
label: 'More' |
|
327 |
nameKey: More |
|
328 |
translateLabel: true |
|
329 |
) |
|
330 |
(MenuItem |
|
331 |
label: 'Services' |
|
332 |
translateLabel: true |
|
333 |
submenuChannel: servicesMenu |
|
334 |
) |
|
335 |
(MenuItem |
|
336 |
label: 'Debug' |
|
337 |
translateLabel: true |
|
338 |
submenu: |
|
339 |
(Menu |
|
340 |
( |
|
341 |
(MenuItem |
|
342 |
label: 'Inspect ' |
|
343 |
itemValue: inspectView |
|
344 |
translateLabel: true |
|
345 |
) |
|
346 |
(MenuItem |
|
347 |
label: 'Inspect Syntax Elements' |
|
348 |
itemValue: inspectSyntaxElements |
|
349 |
translateLabel: true |
|
350 |
) |
|
351 |
(MenuItem |
|
12205 | 352 |
label: 'Inspect Selected Selector' |
9985 | 353 |
itemValue: inspectSelectedSelector |
354 |
translateLabel: true |
|
355 |
) |
|
356 |
) |
|
357 |
nil |
|
358 |
nil |
|
359 |
) |
|
360 |
) |
|
361 |
) |
|
362 |
nil |
|
363 |
nil |
|
364 |
) |
|
10290 | 365 |
|
12205 | 366 |
"Modified: / 08-03-2012 / 12:36:18 / cg" |
10290 | 367 |
! |
368 |
||
369 |
editMenu_stxStyle |
|
370 |
"This resource specification was automatically generated |
|
371 |
by the MenuEditor of ST/X." |
|
372 |
||
373 |
"Do not manually edit this!! If it is corrupted, |
|
374 |
the MenuEditor may not be able to read the specification." |
|
375 |
||
12158 | 376 |
|
10290 | 377 |
" |
378 |
MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_stxStyle |
|
379 |
(Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_stxStyle)) startUp |
|
380 |
" |
|
381 |
||
382 |
<resource: #menu> |
|
383 |
||
384 |
^ |
|
385 |
#(Menu |
|
386 |
( |
|
387 |
(MenuItem |
|
388 |
label: 'Undo' |
|
389 |
itemValue: undo |
|
390 |
translateLabel: true |
|
391 |
shortcutKey: Undo |
|
392 |
) |
|
393 |
(MenuItem |
|
394 |
label: 'Again' |
|
395 |
itemValue: again |
|
396 |
translateLabel: true |
|
397 |
shortcutKey: Again |
|
398 |
) |
|
399 |
(MenuItem |
|
400 |
label: '-' |
|
401 |
) |
|
402 |
(MenuItem |
|
403 |
label: 'Cut' |
|
404 |
itemValue: cut |
|
405 |
translateLabel: true |
|
406 |
shortcutKey: Cut |
|
407 |
) |
|
408 |
(MenuItem |
|
409 |
label: 'Copy' |
|
410 |
itemValue: copySelection |
|
411 |
translateLabel: true |
|
412 |
shortcutKey: Copy |
|
413 |
) |
|
414 |
(MenuItem |
|
415 |
label: 'Paste' |
|
416 |
itemValue: pasteOrReplace |
|
417 |
translateLabel: true |
|
418 |
shortcutKey: Paste |
|
419 |
) |
|
420 |
(MenuItem |
|
421 |
label: '-' |
|
422 |
) |
|
423 |
(MenuItem |
|
424 |
label: 'DoIt' |
|
425 |
itemValue: doIt |
|
426 |
translateLabel: true |
|
427 |
shortcutKey: DoIt |
|
428 |
) |
|
429 |
(MenuItem |
|
430 |
label: 'PrintIt' |
|
431 |
itemValue: printIt |
|
432 |
translateLabel: true |
|
433 |
shortcutKey: PrintIt |
|
434 |
) |
|
435 |
(MenuItem |
|
436 |
label: 'InspectIt' |
|
437 |
itemValue: inspectIt |
|
438 |
translateLabel: true |
|
439 |
shortcutKey: InspectIt |
|
440 |
) |
|
441 |
(MenuItem |
|
442 |
label: '-' |
|
443 |
) |
|
444 |
(MenuItem |
|
445 |
label: 'Accept' |
|
446 |
itemValue: accept |
|
447 |
translateLabel: true |
|
448 |
shortcutKey: Accept |
|
449 |
) |
|
450 |
(MenuItem |
|
451 |
label: '-' |
|
12205 | 452 |
isVisible: false |
10290 | 453 |
) |
454 |
(MenuItem |
|
455 |
label: 'Refactor' |
|
12205 | 456 |
nameKey: refactor |
10290 | 457 |
translateLabel: true |
458 |
isVisible: false |
|
459 |
shortcutKey: Shift |
|
460 |
) |
|
461 |
(MenuItem |
|
462 |
label: 'Services' |
|
463 |
translateLabel: true |
|
12158 | 464 |
isVisible: false |
10290 | 465 |
submenuChannel: servicesMenu |
466 |
) |
|
467 |
(MenuItem |
|
12205 | 468 |
label: '=' |
10290 | 469 |
) |
470 |
(MenuItem |
|
471 |
label: 'More' |
|
472 |
nameKey: More |
|
473 |
translateLabel: true |
|
474 |
shortcutKey: Ctrl |
|
475 |
) |
|
476 |
) |
|
477 |
nil |
|
478 |
nil |
|
479 |
) |
|
12205 | 480 |
|
481 |
"Modified: / 02-03-2012 / 19:53:19 / cg" |
|
9985 | 482 |
! ! |
483 |
||
12244 | 484 |
!CodeView2 methodsFor:'* As yet uncategorized *'! |
485 |
||
486 |
defaultFileNameForSave |
|
487 |
self halt:'please define defaultFileNameForSave here'. |
|
488 |
||
489 |
"Created: / 11-05-2012 / 15:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
490 |
! ! |
|
491 |
||
9985 | 492 |
!CodeView2 methodsFor:'accessing'! |
493 |
||
494 |
acceptAction:aBlock |
|
495 |
||
496 |
textView acceptAction: aBlock |
|
497 |
||
498 |
"Modified: / 01-08-2010 / 20:40:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
499 |
! |
|
500 |
||
10224 | 501 |
breakpoints |
502 |
||
503 |
services do:[:each| |
|
504 |
(each isKindOf: BreakpointService) ifTrue:[ |
|
505 |
^each breakpoints |
|
506 |
] |
|
507 |
]. |
|
12125 | 508 |
^ nil |
10224 | 509 |
|
510 |
"Created: / 06-07-2011 / 18:05:35 / jv" |
|
12125 | 511 |
"Modified: / 06-10-2011 / 14:13:53 / cg" |
10224 | 512 |
! |
513 |
||
10245 | 514 |
browser |
515 |
||
516 |
^self browserHolder value |
|
517 |
||
518 |
"Created: / 07-07-2011 / 12:25:59 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
519 |
! |
|
520 |
||
9985 | 521 |
codeAspect |
522 |
|app| |
|
12287 | 523 |
|
9985 | 524 |
codeAspect ifNotNil:[^codeAspect]. |
12287 | 525 |
methodHolder value ifNotNil:[^SyntaxHighlighter codeAspectMethod]. |
9985 | 526 |
|
527 |
^((app := self topView application) notNil and:[app respondsTo: #codeAspect]) |
|
528 |
ifTrue:[app codeAspect] |
|
12287 | 529 |
ifFalse:[(SyntaxHighlighter codeAspectExpression)] |
9985 | 530 |
|
10409 | 531 |
"Modified: / 27-07-2011 / 13:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12287 | 532 |
"Modified: / 27-07-2012 / 22:22:27 / cg" |
9985 | 533 |
! |
534 |
||
535 |
codeAspect:aSymbol |
|
12287 | 536 |
self assert:( #(expression method classDefinition) includes:aSymbol ). |
537 |
||
9985 | 538 |
codeAspect := aSymbol. |
12287 | 539 |
|
540 |
"Modified: / 27-07-2012 / 22:32:19 / cg" |
|
9985 | 541 |
! |
542 |
||
12243
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
543 |
compilerClass |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
544 |
^textView compilerClass |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
545 |
|
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
546 |
"Created: / 10-05-2012 / 23:47:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
547 |
! |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
548 |
|
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
549 |
compilerClass: aClass |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
550 |
textView compilerClass: aClass |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
551 |
|
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
552 |
"Created: / 10-05-2012 / 23:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
553 |
! |
bf110cbcc7d3
- WorkspaceApplication - support for SQLWorkspace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12229
diff
changeset
|
554 |
|
9985 | 555 |
contents |
556 |
||
557 |
^textView contents |
|
558 |
||
559 |
"Created: / 14-02-2010 / 22:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
560 |
! |
|
561 |
||
562 |
contents: aStringOrStringCollection |
|
563 |
||
564 |
textView contents: aStringOrStringCollection. |
|
565 |
"/self update:#value with: aStringOrStringCollection from: textView model |
|
566 |
||
10330 | 567 |
"Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 568 |
! |
569 |
||
12171 | 570 |
contents: aStringOrStringCollection clear: clearPrevious |
571 |
"Set the contents. If clearPrevous is true, then |
|
572 |
previous original text is cleared and set to given one. |
|
573 |
(so the text is considered not modified)" |
|
574 |
||
575 |
textView contents: aStringOrStringCollection clear: clearPrevious |
|
576 |
||
577 |
"Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
578 |
"Created: / 17-02-2012 / 00:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
579 |
! |
|
580 |
||
581 |
currentParseNode |
|
582 |
||
583 |
^self currentParseNodeHolder value |
|
584 |
||
585 |
"Created: / 21-02-2012 / 14:20:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
586 |
! |
|
587 |
||
12244 | 588 |
delegate: anObject |
589 |
||
590 |
super delegate: anObject. |
|
591 |
self textView delegate: anObject. |
|
592 |
self gutterView delegate: anObject. |
|
593 |
||
594 |
"Created: / 11-05-2012 / 10:29:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
595 |
! |
|
596 |
||
9985 | 597 |
diffMode |
598 |
^ diffMode |
|
599 |
! |
|
600 |
||
601 |
diffMode:aBoolean |
|
602 |
diffMode := aBoolean. |
|
603 |
textView diffMode: aBoolean |
|
604 |
||
605 |
"Modified: / 08-04-2011 / 20:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
606 |
! |
|
607 |
||
608 |
font |
|
609 |
||
610 |
^textView font |
|
611 |
||
612 |
"Created: / 16-02-2010 / 10:26:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
613 |
! |
|
614 |
||
615 |
font: aFont |
|
616 |
||
617 |
^textView font: aFont |
|
618 |
||
619 |
"Created: / 16-02-2010 / 10:26:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
620 |
! |
|
621 |
||
622 |
mode |
|
623 |
||
624 |
^self modeHolder value |
|
625 |
||
626 |
"Created: / 13-06-2011 / 10:49:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
627 |
! |
|
628 |
||
629 |
mode: aSymbol |
|
12287 | 630 |
"is this the same as codeAspect ?" |
9985 | 631 |
|
632 |
self assert: (#(expression method) includes: aSymbol). |
|
633 |
||
634 |
^self modeHolder value: aSymbol |
|
635 |
||
636 |
"Created: / 13-06-2011 / 10:50:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
637 |
"Modified: / 15-06-2011 / 16:37:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12287 | 638 |
"Modified (comment): / 27-07-2012 / 22:19:49 / cg" |
9985 | 639 |
! |
640 |
||
10409 | 641 |
model |
642 |
||
643 |
^textView model. |
|
644 |
||
645 |
"Created: / 27-07-2011 / 12:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
646 |
! |
|
647 |
||
648 |
model: aValueModel |
|
649 |
||
650 |
|oldValue newValue| |
|
651 |
||
652 |
textView model notNil ifTrue:[ |
|
653 |
oldValue := textView model value. |
|
654 |
textView model removeDependent:self. |
|
655 |
]. |
|
656 |
textView model: aValueModel. |
|
657 |
textView model notNil ifTrue:[ |
|
658 |
textView model addDependent:self. |
|
659 |
]. |
|
660 |
newValue := textView model value. |
|
661 |
oldValue ~~ newValue ifTrue:[ |
|
662 |
self update:#value with:newValue from:textView model. |
|
663 |
]. |
|
664 |
||
12194
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12193
diff
changeset
|
665 |
"Modified: / 17-03-2012 / 16:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10409 | 666 |
! |
667 |
||
9985 | 668 |
modified |
669 |
"return true if text was modified" |
|
670 |
||
10245 | 671 |
^ self modifiedChannel value |
672 |
||
673 |
"Modified: / 07-07-2011 / 12:15:43 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 674 |
! |
675 |
||
676 |
modified:aBoolean |
|
677 |
"set/clear the modified flag" |
|
678 |
||
10245 | 679 |
self modifiedChannel value:aBoolean |
680 |
||
681 |
"Modified: / 14-02-1997 / 16:44:05 / cg" |
|
682 |
"Modified: / 07-07-2011 / 12:15:39 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 683 |
! |
684 |
||
685 |
scrolledView |
|
686 |
||
687 |
^self |
|
688 |
||
689 |
"Created: / 14-02-2010 / 22:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
690 |
! |
|
691 |
||
10487 | 692 |
services |
12125 | 693 |
^ services ? #() |
10487 | 694 |
|
695 |
"Created: / 05-08-2011 / 10:14:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 696 |
"Modified (format): / 06-10-2011 / 14:11:11 / cg" |
697 |
! |
|
698 |
||
699 |
services:aCollectionOfServices |
|
700 |
"allow setting of the services (instances); |
|
701 |
this is needed for FileBrowser, to setup a codeView2 without Smalltalk-specific |
|
702 |
services" |
|
703 |
||
704 |
servicesFromClient := true. |
|
705 |
services := aCollectionOfServices. |
|
706 |
||
707 |
"Created: / 06-10-2011 / 14:15:36 / cg" |
|
708 |
! |
|
709 |
||
710 |
showAcceptCancelBar |
|
711 |
||
712 |
^showAcceptCancelBarChannel value |
|
713 |
||
714 |
"Created: / 10-10-2011 / 16:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
715 |
! |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
716 |
|
9985 | 717 |
showGutter |
718 |
||
719 |
^showGutterChannel value |
|
720 |
||
721 |
"Created: / 23-06-2010 / 19:37:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
722 |
! |
|
723 |
||
724 |
synchronizeWith: aCodeView |
|
725 |
||
726 |
self assert: aCodeView ~= self. |
|
727 |
(synchronizedCodeViews includes: aCodeView) ifTrue:[^self]. |
|
728 |
synchronizedCodeViews := synchronizedCodeViews copyWith: aCodeView. |
|
729 |
||
730 |
"Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>" |
|
731 |
"Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12198
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
732 |
! |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
733 |
|
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
734 |
unsynchronizeWith: aCodeView |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
735 |
|
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
736 |
self assert: aCodeView ~= self. |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
737 |
(synchronizedCodeViews includes: aCodeView) ifFalse:[^self]. |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
738 |
synchronizedCodeViews := synchronizedCodeViews copyWithout: aCodeView. |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
739 |
|
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
740 |
"Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>" |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
741 |
"Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
742 |
"Created: / 19-03-2012 / 14:25:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 743 |
! ! |
744 |
||
10409 | 745 |
!CodeView2 methodsFor:'accessing - code component'! |
746 |
||
747 |
klass |
|
748 |
||
749 |
| v | |
|
750 |
||
751 |
(v := self classHolder value) notNil ifTrue:[^v]. |
|
752 |
(v := self methodHolder value) notNil ifTrue:[^v mclass]. |
|
753 |
||
12194
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12193
diff
changeset
|
754 |
^nil |
10409 | 755 |
|
756 |
"Created: / 27-07-2011 / 13:14:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12205 | 757 |
! ! |
758 |
||
759 |
!CodeView2 methodsFor:'accessing-code component'! |
|
10409 | 760 |
|
761 |
klass: aClass |
|
762 |
||
763 |
"Created: / 27-07-2011 / 13:13:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
764 |
! |
|
765 |
||
766 |
language |
|
767 |
"return the value in 'languageHolder'" |
|
768 |
||
769 |
| v | |
|
770 |
||
771 |
(v := self languageHolder value) notNil ifTrue:[^v]. |
|
772 |
(v := self methodHolder value) notNil ifTrue:[^v programmingLanguage]. |
|
773 |
(v := self classHolder value) notNil ifTrue:[^v programmingLanguage]. |
|
774 |
||
12125 | 775 |
"/No, no default language, please. |
776 |
"/^SmalltalkLanguage instance |
|
777 |
^nil |
|
778 |
||
779 |
"Modified: / 07-12-2011 / 16:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10409 | 780 |
! |
781 |
||
782 |
language: newValue |
|
783 |
"set the value in 'languageHolder'" |
|
784 |
||
785 |
self languageHolder value: newValue |
|
786 |
! |
|
787 |
||
788 |
method |
|
789 |
||
790 |
^self methodHolder value |
|
791 |
||
792 |
"Created: / 27-07-2011 / 13:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
793 |
! |
|
794 |
||
795 |
method: aMethod |
|
796 |
||
797 |
^self methodHolder value: aMethod |
|
798 |
||
799 |
"Created: / 27-07-2011 / 13:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
800 |
! ! |
|
801 |
||
9985 | 802 |
!CodeView2 methodsFor:'aspects'! |
803 |
||
804 |
browserHolder |
|
12125 | 805 |
browserHolder isNil ifTrue:[ |
9985 | 806 |
browserHolder := ValueHolder new |
807 |
]. |
|
808 |
^browserHolder |
|
809 |
||
810 |
"Modified: / 14-02-2010 / 19:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 811 |
"Modified: / 18-11-2011 / 14:58:15 / cg" |
9985 | 812 |
! |
813 |
||
814 |
browserHolder:aValueModel |
|
815 |
browserHolder := aValueModel. |
|
816 |
! |
|
817 |
||
818 |
classHolder |
|
819 |
"return/create the 'classHolder' value holder (automatically generated)" |
|
820 |
||
821 |
classHolder isNil ifTrue:[ |
|
10409 | 822 |
classHolder := ValueHolder with: nil. |
9985 | 823 |
classHolder addDependent:self. |
824 |
]. |
|
825 |
^ classHolder |
|
826 |
||
10409 | 827 |
"Modified: / 27-07-2011 / 13:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 828 |
! |
829 |
||
830 |
classHolder:aValueModel |
|
831 |
"set the 'classHolder' value holder (automatically generated)" |
|
832 |
||
833 |
|old oldValue newValue| |
|
834 |
||
835 |
classHolder notNil ifTrue:[ |
|
836 |
oldValue := classHolder value. |
|
837 |
classHolder removeDependent:self. |
|
838 |
]. |
|
839 |
classHolder := aValueModel. |
|
840 |
classHolder notNil ifTrue:[ |
|
841 |
classHolder addDependent:self. |
|
842 |
]. |
|
843 |
old := methodHolder. |
|
844 |
newValue := classHolder value. |
|
845 |
oldValue ~~ newValue ifTrue:[ |
|
846 |
self update:#value with:newValue from:classHolder. |
|
847 |
]. |
|
848 |
||
849 |
self changed: #classHolder with: old -> classHolder |
|
850 |
||
851 |
"Modified: / 17-06-2011 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
852 |
! |
|
853 |
||
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
854 |
currentBlockNodeHolder |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
855 |
"return/create the 'currentBlockNodeHolder' value holder (automatically generated)" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
856 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
857 |
currentBlockNodeHolder isNil ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
858 |
currentBlockNodeHolder := ValueHolder new. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
859 |
]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
860 |
^ currentBlockNodeHolder |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
861 |
! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
862 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
863 |
currentBlockNodeHolder:something |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
864 |
"set the 'currentBlockNodeHolder' value holder (automatically generated)" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
865 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
866 |
currentBlockNodeHolder := something. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
867 |
! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
868 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
869 |
currentParseNodeHolder |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
870 |
"return/create the 'currentParseNodeHolder' value holder (automatically generated)" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
871 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
872 |
currentParseNodeHolder isNil ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
873 |
currentParseNodeHolder := ValueHolder new. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
874 |
]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
875 |
^ currentParseNodeHolder |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
876 |
! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
877 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
878 |
currentParseNodeHolder:something |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
879 |
"set the 'currentParseNodeHolder' value holder (automatically generated)" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
880 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
881 |
currentParseNodeHolder := something. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
882 |
gutterView notNil ifTrue:[ gutterView currentBlockNodeHolder: currentBlockNodeHolder ]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
883 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
884 |
"Modified: / 16-02-2012 / 23:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
885 |
! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
886 |
|
9985 | 887 |
languageHolder |
888 |
languageHolder isNil ifTrue:[ |
|
12265 | 889 |
"/ cg: I dont like the smalltalk default here, because everyone who is not showing ST-code (expecco, filebrowser etc.) |
12125 | 890 |
"/ has to explicitely clear the valueholder. I guess, it is better for the few |
891 |
"/ others to explicitely set it, if they do not provide syntaxHighlighter per method |
|
892 |
"/ or class. |
|
893 |
languageHolder := ValueHolder with: nil "SmalltalkLanguage instance". |
|
9985 | 894 |
languageHolder addDependent:self. |
895 |
]. |
|
896 |
^ languageHolder |
|
12125 | 897 |
|
12265 | 898 |
"Modified: / 19-07-2012 / 16:51:04 / cg" |
9985 | 899 |
! |
900 |
||
901 |
languageHolder:aValueModel |
|
902 |
"set the 'languageHolder' value holder (automatically generated)" |
|
903 |
||
904 |
|old oldValue newValue| |
|
905 |
||
906 |
languageHolder notNil ifTrue:[ |
|
907 |
oldValue := languageHolder value. |
|
908 |
languageHolder removeDependent:self. |
|
909 |
]. |
|
910 |
languageHolder := aValueModel. |
|
911 |
languageHolder notNil ifTrue:[ |
|
912 |
languageHolder addDependent:self. |
|
913 |
]. |
|
914 |
old := languageHolder. |
|
915 |
newValue := languageHolder value. |
|
916 |
oldValue ~~ newValue ifTrue:[ |
|
917 |
self update:#value with:newValue from:languageHolder. |
|
918 |
]. |
|
919 |
||
920 |
self changed: #languageHolder with: old -> languageHolder |
|
921 |
||
922 |
"Modified: / 17-06-2011 / 12:56:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12265 | 923 |
"Modified: / 19-07-2012 / 16:51:08 / cg" |
9985 | 924 |
! |
925 |
||
926 |
methodHolder |
|
927 |
"return/create the 'methodHolder' value holder (automatically generated)" |
|
928 |
||
929 |
methodHolder isNil ifTrue:[ |
|
930 |
methodHolder := ValueHolder new. |
|
931 |
methodHolder addDependent:self. |
|
932 |
]. |
|
933 |
^ methodHolder |
|
934 |
! |
|
935 |
||
936 |
methodHolder:aValueModel |
|
937 |
"set the 'methodHolder' value holder (automatically generated)" |
|
938 |
||
939 |
|old oldValue newValue| |
|
940 |
||
941 |
methodHolder notNil ifTrue:[ |
|
942 |
oldValue := methodHolder value. |
|
943 |
methodHolder removeDependent:self. |
|
944 |
]. |
|
945 |
old := methodHolder. |
|
946 |
methodHolder := aValueModel. |
|
947 |
methodHolder notNil ifTrue:[ |
|
948 |
methodHolder addDependent:self. |
|
949 |
]. |
|
950 |
newValue := methodHolder value. |
|
951 |
oldValue ~~ newValue ifTrue:[ |
|
952 |
self update:#value with:newValue from:methodHolder. |
|
953 |
]. |
|
954 |
||
955 |
self changed: #methodHolder with: old -> methodHolder |
|
956 |
||
957 |
"Modified: / 17-06-2011 / 12:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
958 |
! |
|
959 |
||
960 |
modeHolder |
|
961 |
"return/create the 'modeHolder' value holder (automatically generated)" |
|
962 |
||
12287 | 963 |
"is this the codeAspect?" |
9985 | 964 |
modeHolder isNil ifTrue:[ |
965 |
modeHolder := #expression asValue. |
|
966 |
modeHolder addDependent:self. |
|
967 |
]. |
|
968 |
^ modeHolder |
|
969 |
||
970 |
"Modified: / 13-06-2011 / 10:52:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12287 | 971 |
"Modified (comment): / 27-07-2012 / 22:22:19 / cg" |
9985 | 972 |
! |
973 |
||
974 |
modeHolder:something |
|
975 |
"set the 'modeHolder' value holder (automatically generated)" |
|
976 |
||
977 |
|oldValue newValue| |
|
978 |
||
979 |
modeHolder notNil ifTrue:[ |
|
980 |
oldValue := modeHolder value. |
|
981 |
modeHolder removeDependent:self. |
|
982 |
]. |
|
983 |
modeHolder := something. |
|
984 |
modeHolder notNil ifTrue:[ |
|
985 |
modeHolder addDependent:self. |
|
986 |
]. |
|
987 |
newValue := modeHolder value. |
|
988 |
oldValue ~~ newValue ifTrue:[ |
|
989 |
self update:#value with:newValue from:modeHolder. |
|
990 |
]. |
|
991 |
||
992 |
self changed: #modeHolder with: modeHolder |
|
993 |
||
994 |
"Modified: / 17-06-2011 / 12:55:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
995 |
! ! |
|
996 |
||
997 |
!CodeView2 methodsFor:'change & update'! |
|
998 |
||
999 |
update:aspect with:param from:sender |
|
1000 |
||
12269
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
1001 |
sender == modeHolder ifTrue:[ |
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
1002 |
codeAspect := modeHolder value |
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
1003 |
]. |
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
1004 |
|
10245 | 1005 |
sender == showGutterChannel ifTrue: [ |
1006 |
self updateGutterVisibility. |
|
1007 |
^self. |
|
1008 |
]. |
|
9985 | 1009 |
|
12125 | 1010 |
services do:[:each | |
1011 |
each isEnabled ifTrue:[ |
|
1012 |
each update:aspect with:param from:sender |
|
1013 |
] |
|
1014 |
]. |
|
9985 | 1015 |
|
1016 |
super update:aspect with:param from:sender |
|
1017 |
||
10245 | 1018 |
"Modified: / 07-07-2011 / 12:07:04 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
12125 | 1019 |
"Modified: / 06-10-2011 / 14:14:36 / cg" |
12269
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
1020 |
"Modified: / 26-07-2012 / 19:25:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1021 |
! |
1022 |
||
1023 |
updateGutterVisibility |
|
1024 |
||
1025 |
self showGutterChannel value ifTrue:[ |
|
1026 |
textViewScroller origin:(gutterView width @ 0.0) corner:(1.0 @ 1.0). |
|
1027 |
gutterView beVisible. |
|
1028 |
] ifFalse:[ |
|
1029 |
textViewScroller origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
1030 |
gutterView beInvisible. |
|
1031 |
] |
|
1032 |
||
1033 |
"Created: / 23-06-2010 / 19:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1034 |
! ! |
|
1035 |
||
1036 |
!CodeView2 methodsFor:'channels'! |
|
1037 |
||
1038 |
modifiedChannel |
|
1039 |
"return the valueHolder holding true if text was modified" |
|
1040 |
||
10245 | 1041 |
^ textView modifiedChannel |
1042 |
"/ ^ modifiedChannel |
|
1043 |
||
1044 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
9985 | 1045 |
! |
1046 |
||
1047 |
modifiedChannel:aValueHolder |
|
1048 |
"set the valueHolder holding true if text was modified" |
|
1049 |
||
12125 | 1050 |
textView modifiedChannel removeDependent:self. |
1051 |
textView modifiedChannel:aValueHolder. |
|
1052 |
textView modifiedChannel addDependent:self. |
|
10245 | 1053 |
|
1054 |
"/ |prev| |
|
1055 |
"/ |
|
1056 |
"/ prev := modifiedChannel. |
|
1057 |
"/ modifiedChannel := aValueHolder. |
|
1058 |
"/ self setupChannel:aValueHolder for:nil withOld:prev |
|
1059 |
||
1060 |
"Created: / 30-01-1998 / 14:51:32 / cg" |
|
1061 |
"Modified: / 07-07-2011 / 12:07:43 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
12125 | 1062 |
"Modified: / 05-09-2011 / 05:13:27 / cg" |
1063 |
! |
|
1064 |
||
1065 |
reallyModifiedChannel |
|
1066 |
"return the valueHolder holding true if text was modified" |
|
1067 |
||
1068 |
^ textView reallyModifiedChannel |
|
1069 |
||
1070 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
1071 |
"Created: / 08-10-2011 / 12:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1072 |
! |
|
1073 |
||
1074 |
reallyModifiedChannel: aValueModel |
|
1075 |
||
1076 |
^ textView reallyModifiedChannel: aValueModel |
|
1077 |
||
1078 |
"Modified: / 07-07-2011 / 12:07:26 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
1079 |
"Created: / 08-10-2011 / 12:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1080 |
! |
|
1081 |
||
1082 |
showAcceptCancelBarChannel |
|
1083 |
||
1084 |
^showAcceptCancelBarChannel |
|
1085 |
||
1086 |
"Created: / 10-10-2011 / 16:23:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1087 |
! |
|
1088 |
||
1089 |
showAcceptCancelBarChannel:aValueHolder |
|
1090 |
"set the valueHolder holding true if text was modified" |
|
1091 |
||
1092 |
|prev| |
|
1093 |
||
1094 |
prev := showAcceptCancelBarChannel. |
|
1095 |
showAcceptCancelBarChannel := aValueHolder. |
|
1096 |
self setupChannel:aValueHolder for:nil withOld:prev. |
|
1097 |
||
1098 |
"Created: / 10-10-2011 / 16:24:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1099 |
! |
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
1100 |
|
9985 | 1101 |
showGutterChannel |
1102 |
||
1103 |
^showGutterChannel |
|
1104 |
||
1105 |
"Created: / 23-06-2010 / 19:02:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1106 |
! |
|
1107 |
||
1108 |
showGutterChannel:aValueHolder |
|
1109 |
"set the valueHolder holding true if text was modified" |
|
1110 |
||
1111 |
|prev| |
|
1112 |
||
1113 |
prev := showGutterChannel. |
|
1114 |
showGutterChannel := aValueHolder. |
|
1115 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
1116 |
||
1117 |
"Created: / 23-06-2010 / 19:03:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1118 |
! ! |
|
1119 |
||
10262 | 1120 |
!CodeView2 methodsFor:'code services'! |
1121 |
||
1122 |
browseMethod: method |
|
1123 |
||
1124 |
self browseMethod: method label: nil. |
|
1125 |
||
1126 |
"Created: / 14-02-2010 / 19:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1127 |
! |
|
1128 |
||
1129 |
browseMethod: method label: label |
|
1130 |
||
12125 | 1131 |
self browser isNil ifTrue: [^NewSystemBrowser openInMethod:method]. |
10262 | 1132 |
(UserPreferences current alwaysOpenNewTabWhenCtrlClick |
1133 |
or:[self browser navigationState modified]) |
|
1134 |
ifTrue: |
|
1135 |
[self browser |
|
1136 |
spawnFullBrowserInClass: method mclass |
|
1137 |
selector:method selector |
|
1138 |
in:#newBuffer] |
|
1139 |
ifFalse: |
|
1140 |
[self browser |
|
1141 |
switchToClass: method containingClass |
|
1142 |
selector: method selector]. |
|
1143 |
||
1144 |
"Modified: / 19-02-2008 / 10:15:17 / janfrog" |
|
1145 |
"Created: / 19-10-2008 / 08:16:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1146 |
"Modified: / 25-07-2010 / 13:34:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 1147 |
"Modified: / 18-11-2011 / 14:58:12 / cg" |
10262 | 1148 |
! |
1149 |
||
1150 |
browseMethods: methods label: label |
|
1151 |
||
1152 |
methods size = 1 ifTrue: |
|
1153 |
[^self browseMethod: methods anyOne label: label]. |
|
1154 |
||
1155 |
self browser |
|
1156 |
ifNil: [NewSystemBrowser browseMethods: methods title: label] |
|
1157 |
ifNotNil:[self browser spawnMethodBrowserFor:methods in:#newBuffer label:label] |
|
1158 |
||
1159 |
"Created: / 26-12-2007 / 11:32:04 / janfrog" |
|
1160 |
"Modified: / 19-10-2008 / 08:17:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1161 |
! |
|
1162 |
||
1163 |
extractSelectorAndSelectedTextFrom: givenSelectedText |
|
1164 |
| selector selectedText compilerClass na | |
|
12205 | 1165 |
|
10262 | 1166 |
selectedText := givenSelectedText. |
1167 |
compilerClass := self language compilerClass. |
|
1168 |
selectedText size > 0 ifTrue:[ |
|
12205 | 1169 |
"/ self windowGroup withWaitCursorDo:[ |
10262 | 1170 |
"/ hack, for now and expecco; must ask the Parser eventually... |
1171 |
(compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser]) ifTrue:[ |
|
1172 |
"/ selector is in one piece anyway |
|
1173 |
(selectedText includes:$_) ifFalse:[ |
|
1174 |
"/ zero or one args - sigh (need to parse more to figure this out) |
|
1175 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:1. |
|
1176 |
selectedText := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:0. |
|
1177 |
] ifTrue:[ |
|
1178 |
"/ count _#s plus one arg - sigh |
|
1179 |
na := (selectedText occurrencesOf:$_) + 1. |
|
1180 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:na |
|
1181 |
]. |
|
1182 |
] ifFalse:[ |
|
1183 |
selector := SystemBrowser extractSelectorFrom:selectedText. |
|
1184 |
]. |
|
12205 | 1185 |
"/ ] |
10262 | 1186 |
]. |
1187 |
^Array with: selector with: selectedText |
|
1188 |
||
1189 |
"Created: / 30-06-2011 / 19:49:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12205 | 1190 |
"Modified: / 05-03-2012 / 09:04:12 / cg" |
10262 | 1191 |
! |
1192 |
||
1193 |
implementorsOf: selector |
|
1194 |
||
12125 | 1195 |
selector isNil ifTrue:[^#()]. |
10262 | 1196 |
^SystemBrowser |
1197 |
findImplementorsOf: selector |
|
1198 |
in: Smalltalk allClasses |
|
1199 |
ignoreCase: false |
|
1200 |
||
1201 |
"Created: / 26-12-2007 / 11:37:11 / janfrog" |
|
12125 | 1202 |
"Modified: / 18-11-2011 / 14:58:17 / cg" |
10262 | 1203 |
! |
1204 |
||
1205 |
sendersOf: selector |
|
1206 |
||
12125 | 1207 |
selector isNil ifTrue:[^#()]. |
10262 | 1208 |
^SystemBrowser |
1209 |
findSendersOf: selector |
|
1210 |
in: Smalltalk allClasses |
|
1211 |
ignoreCase: false |
|
1212 |
||
1213 |
"Created: / 26-12-2007 / 11:37:22 / janfrog" |
|
1214 |
"Modified: / 30-06-2011 / 19:32:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 1215 |
"Modified: / 18-11-2011 / 14:58:19 / cg" |
10262 | 1216 |
! ! |
1217 |
||
9985 | 1218 |
!CodeView2 methodsFor:'delegation'! |
1219 |
||
1220 |
doesNotUnderstand: aMessage |
|
1221 |
||
1222 |
((textView respondsTo: aMessage selector) |
|
1223 |
and:[(TraceSelectors includes:aMessage selector) not]) |
|
1224 |
ifTrue:[^aMessage sendTo: textView]. |
|
1225 |
^super doesNotUnderstand: aMessage |
|
1226 |
||
1227 |
"Created: / 13-02-2010 / 23:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1228 |
"Modified: / 14-02-2010 / 09:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1229 |
! |
|
1230 |
||
1231 |
hasSelection |
|
1232 |
||
1233 |
^textView hasSelection |
|
1234 |
||
1235 |
"Created: / 14-02-2010 / 09:53:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1236 |
! ! |
|
1237 |
||
1238 |
!CodeView2 methodsFor:'delegation - events'! |
|
1239 |
||
1240 |
buttonMotion: button x:x y:y in: view |
|
1241 |
"Delegates events to services. Answers true iff at least |
|
1242 |
one service handler method returns true. In that case, |
|
12133
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1243 |
the event is is NOT passed to the rest of services AND it is NOT |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1244 |
processes by the view." |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1245 |
|
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1246 |
services do:[:service| |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1247 |
service isEnabled ifTrue:[ |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1248 |
(service buttonMotion: button x:x y:y in: view) == true ifTrue:[ |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1249 |
^true |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1250 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1251 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1252 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1253 |
^ false |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1254 |
|
12125 | 1255 |
"Modified: / 06-10-2011 / 14:13:57 / cg" |
12133
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1256 |
"Modified: / 31-01-2012 / 12:21:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1257 |
! |
1258 |
||
1259 |
buttonPress: button x:x y:y in: view |
|
1260 |
"Delegates events to services. Answers true iff at least |
|
1261 |
one service handler method returns true. In that case, |
|
12221
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1262 |
the event is is NOT passed to the rest of services AND it is NOT |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1263 |
processes by the view." |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1264 |
|
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1265 |
services do:[:service| |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1266 |
(service isEnabled and:[(service buttonPress: button x:x y:y in: view) == true]) ifTrue:[ |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1267 |
^true |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1268 |
] |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1269 |
]. |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1270 |
^false |
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1271 |
|
12125 | 1272 |
"Modified: / 06-10-2011 / 14:14:00 / cg" |
12205 | 1273 |
"Modified (format): / 05-03-2012 / 08:56:02 / cg" |
12221
413e98858ddc
- EditFieldWithCompletion
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12205
diff
changeset
|
1274 |
"Modified: / 04-04-2012 / 12:42:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1275 |
! |
1276 |
||
1277 |
keyPress: key x:x y:y in: view |
|
1278 |
"Delegates events to services. Answers true iff at least |
|
1279 |
one service handler method returns true. In that case, |
|
12133
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1280 |
the event is is NOT passed to the rest of services AND it is NOT |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1281 |
processes by the view." |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1282 |
|
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1283 |
services do:[:service| |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1284 |
service isEnabled ifTrue:[ |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1285 |
(service keyPress: key x:x y:y in: view) == true ifTrue:[ |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1286 |
^true |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1287 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1288 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1289 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1290 |
^ false |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1291 |
|
12125 | 1292 |
"Modified: / 06-10-2011 / 14:14:11 / cg" |
12133
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1293 |
"Modified: / 31-01-2012 / 12:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1294 |
! |
1295 |
||
1296 |
keyRelease: key x:x y:y in: view |
|
1297 |
"Delegates events to services. Answers true iff at least |
|
1298 |
one service handler method returns true. In that case, |
|
12133
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1299 |
the event is is NOT passed to the rest of services AND it is NOT |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1300 |
processes by the view." |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1301 |
|
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1302 |
services do:[:service| |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1303 |
service isEnabled ifTrue:[ |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1304 |
(service keyRelease: key x:x y:y in: view) == true ifTrue:[ |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1305 |
^true |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1306 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1307 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1308 |
]. |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1309 |
^ false |
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1310 |
|
12125 | 1311 |
"Modified: / 06-10-2011 / 14:14:13 / cg" |
12133
077d0d147d4b
- Tools::CodeView2: when a service processes an event, it is not passed to other services
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
1312 |
"Modified: / 31-01-2012 / 12:21:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1313 |
! |
1314 |
||
12205 | 1315 |
scrollTo:origin redraw:doRedraw in: view |
1316 |
view == textView ifTrue: [ |
|
1317 |
"/my text view scrolled... |
|
1318 |
synchronizedCodeViews do:[:codeView| |
|
1319 |
codeView scrollTo:origin redraw:doRedraw in: view. |
|
1320 |
] |
|
1321 |
] ifFalse: [ |
|
1322 |
"/other code view scrolls and I'm notified about that |
|
1323 |
textView basicScrollTo:origin redraw:doRedraw. |
|
1324 |
] |
|
1325 |
||
1326 |
"Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>" |
|
1327 |
"Created: / 19-03-2012 / 17:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1328 |
! ! |
|
1329 |
||
1330 |
!CodeView2 methodsFor:'delegation-drawing'! |
|
1331 |
||
1332 |
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
|
1333 |
"See the comment in |
|
1334 |
CodeViewService>>drawLine:in:atX..." |
|
1335 |
||
1336 |
services do:[:each| |
|
1337 |
each drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg |
|
1338 |
] |
|
1339 |
||
1340 |
"Created: / 17-06-2011 / 13:50:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1341 |
"Modified: / 06-10-2011 / 14:14:04 / cg" |
|
1342 |
! |
|
1343 |
||
1344 |
redrawVisibleLine: visLineNr |
|
1345 |
||
1346 |
"Created: / 07-03-2010 / 14:44:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1347 |
! |
|
1348 |
||
1349 |
redrawVisibleLine:visLine col:colNr |
|
1350 |
||
1351 |
"Modified: / 05-11-2007 / 17:35:53 / cg" |
|
1352 |
"Modified: / 07-03-2010 / 14:45:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1353 |
! |
|
1354 |
||
1355 |
redrawVisibleLine:visLine from:startCol |
|
1356 |
||
1357 |
"Modified: / 07-03-2010 / 14:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1358 |
! |
|
1359 |
||
1360 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
1361 |
||
1362 |
"Modified: / 07-03-2010 / 14:46:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1363 |
! ! |
|
1364 |
||
1365 |
!CodeView2 methodsFor:'delegation-events'! |
|
1366 |
||
10224 | 1367 |
linesDeletedFrom: start to: end |
1368 |
||
1369 |
services do: [:each | |
|
1370 |
each isEnabled ifTrue: [ |
|
1371 |
each linesDeletedFrom: start to: end |
|
1372 |
] |
|
1373 |
]. |
|
1374 |
||
1375 |
"Created: / 06-07-2011 / 17:12:54 / jv" |
|
12125 | 1376 |
"Modified: / 06-10-2011 / 14:14:16 / cg" |
1377 |
"Modified: / 07-10-2011 / 19:14:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10224 | 1378 |
! |
1379 |
||
1380 |
linesInsertedFrom: start to: end |
|
1381 |
||
1382 |
services do: [:each | |
|
1383 |
each isEnabled ifTrue: [ |
|
1384 |
each linesInsertedFrom: start to: end |
|
1385 |
] |
|
1386 |
]. |
|
1387 |
||
1388 |
"Created: / 06-07-2011 / 17:12:48 / jv" |
|
12125 | 1389 |
"Modified: / 06-10-2011 / 14:14:20 / cg" |
10224 | 1390 |
! |
1391 |
||
1392 |
linesModifiedFrom: start to: end |
|
1393 |
||
1394 |
services do: [:each | |
|
1395 |
each isEnabled ifTrue: [ |
|
1396 |
each linesModifiedFrom: start to: end |
|
1397 |
] |
|
1398 |
]. |
|
1399 |
||
1400 |
"Created: / 06-07-2011 / 17:12:58 / jv" |
|
12125 | 1401 |
"Modified: / 06-10-2011 / 14:13:44 / cg" |
12269
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
1402 |
! ! |
9985 | 1403 |
|
1404 |
!CodeView2 methodsFor:'diff mode'! |
|
1405 |
||
1406 |
recomputeDiff:view |
|
1407 |
|t1 t2 pom diffHelper view2| |
|
1408 |
||
1409 |
t1 := view getNewOriginText. |
|
1410 |
synchronizedCodeViews do:[:codeView | |
|
1411 |
view2 := codeView |
|
1412 |
]. |
|
1413 |
view changedDiffText:false. |
|
1414 |
view2 changedDiffText:false. |
|
1415 |
t2 := view2 getNewOriginText. |
|
1416 |
pom := DiffCodeView2 new. |
|
1417 |
(view == textView) ifTrue:[ |
|
1418 |
diffHelper := pom computeDiffDataForText1:t1 text2:t2. |
|
1419 |
(view) contents:(diffHelper text1). |
|
1420 |
(view) deletedLines:(diffHelper deleted). |
|
1421 |
(view) changedLines:(diffHelper changed). |
|
1422 |
(view) originDiffText:t1. |
|
1423 |
(view) emptyLines:(diffHelper inserted). |
|
1424 |
(view) changedLines:(diffHelper changed). |
|
1425 |
(view2) contents:(diffHelper text2). |
|
1426 |
(view2) insertedLines:(diffHelper inserted). |
|
1427 |
(view2) changedLines:(diffHelper changed). |
|
1428 |
(view2) originDiffText:t2. |
|
1429 |
(view2) emptyLines:(diffHelper deleted). |
|
1430 |
]. |
|
1431 |
||
1432 |
"Modified: / 22-06-2010 / 23:35:41 / Jakub <zelenja7@fel.cvut.cz>" |
|
1433 |
"Modified: / 23-06-2010 / 17:25:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1434 |
! ! |
|
1435 |
||
1436 |
!CodeView2 methodsFor:'initialization'! |
|
1437 |
||
1438 |
initialize |
|
1439 |
"Invoked when a new instance is created." |
|
1440 |
"Call super initialize" |
|
1441 |
||
1442 |
super initialize. |
|
1443 |
"Now set up some visual properties" |
|
1444 |
self level:-1. |
|
1445 |
"Now initialize sub-views" |
|
1446 |
showGutterChannel := (ValueHolder with: true). |
|
1447 |
showGutterChannel addDependent: self. |
|
12125 | 1448 |
showAcceptCancelBarChannel := (ValueHolder with: (UserPreferences current codeView2ShowAcceptCancel)). |
1449 |
||
9985 | 1450 |
self initializeGutterView. |
1451 |
self initializeTextView. |
|
1452 |
gutterView setCodeView:self. |
|
1453 |
textView setCodeView:self. |
|
1454 |
modifiedChannel := ValueHolder with:false. |
|
1455 |
diffMode := false. |
|
1456 |
synchronizedCodeViews := #(). |
|
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1457 |
currentParseNodeHolder := ValueHolder new. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1458 |
currentBlockNodeHolder := ValueHolder new. |
12125 | 1459 |
|
1460 |
servicesFromClient := false. |
|
9985 | 1461 |
services := OrderedCollection new. |
12125 | 1462 |
self initializeServices. |
9985 | 1463 |
|
1464 |
"Modified: / 14-12-2009 / 13:59:53 / Jindra <a>" |
|
1465 |
"Modified: / 06-04-2010 / 13:56:35 / Jakub <zelenja7@fel.cvut.cz>" |
|
12125 | 1466 |
"Modified: / 06-10-2011 / 14:15:48 / cg" |
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1467 |
"Modified: / 16-02-2012 / 23:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1468 |
! |
1469 |
||
1470 |
initializeGutterView |
|
1471 |
||
1472 |
gutterView := CodeView2::GutterView new. |
|
1473 |
gutterView origin:(0.0 @ 0.0) corner:(gutterView preferredWidth @ 1.0). |
|
1474 |
showGutterChannel value ifTrue:[self addSubView: gutterView]. |
|
1475 |
||
1476 |
"Created: / 02-09-2009 / 21:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1477 |
"Modified: / 23-06-2010 / 19:14:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1478 |
! |
|
1479 |
||
1480 |
initializeServices |
|
1481 |
| serviceClasses | |
|
10409 | 1482 |
|
12125 | 1483 |
"/ only do it, if the services have not yet been defined by the user of this view |
1484 |
"/ (FileBrowser does not want Smalltalk-specific services) |
|
1485 |
servicesFromClient ifFalse:[ |
|
12134
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12133
diff
changeset
|
1486 |
serviceClasses := CodeViewService availableServices |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12133
diff
changeset
|
1487 |
sort:[:a :b| |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12133
diff
changeset
|
1488 |
a priority = b priority |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12133
diff
changeset
|
1489 |
ifTrue:[a name < b name] |
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12133
diff
changeset
|
1490 |
ifFalse:[a priority > b priority]]. |
12125 | 1491 |
serviceClasses do:[:cls| |
1492 |
self registerService: cls new |
|
1493 |
]. |
|
1494 |
]. |
|
9985 | 1495 |
|
12125 | 1496 |
"Modified: / 06-10-2011 / 14:16:01 / cg" |
12134
a2f71b97f850
Services are not installed according their priority - its a hack, but...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12133
diff
changeset
|
1497 |
"Modified: / 01-02-2012 / 10:30:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1498 |
! |
1499 |
||
1500 |
initializeTextView |
|
1501 |
||
1502 |
"Initialize textView. gutterView have to be |
|
1503 |
already initialized!!" |
|
1504 |
||
1505 |
textViewScroller := HVScrollableView for: CodeView2::TextView in: self. |
|
1506 |
textViewScroller |
|
1507 |
origin: ((self showGutter ifTrue:[gutterView width] ifFalse:[0.0]) @ 0.0) |
|
1508 |
corner: 1.0@1.0; |
|
1509 |
level: 0. |
|
1510 |
textView := textViewScroller scrolledView. |
|
1511 |
textView level: 0. |
|
1512 |
||
1513 |
textView modifiedChannel addDependent: self. |
|
1514 |
||
1515 |
"Created: / 02-09-2009 / 21:36:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1516 |
"Modified: / 23-06-2010 / 19:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1517 |
! ! |
|
1518 |
||
1519 |
!CodeView2 methodsFor:'menu actions'! |
|
1520 |
||
12125 | 1521 |
accept |
1522 |
textView accept |
|
1523 |
||
1524 |
"Created: / 07-09-2011 / 21:29:07 / cg" |
|
1525 |
! |
|
1526 |
||
10375 | 1527 |
again |
1528 |
textView again |
|
1529 |
||
1530 |
"Created: / 16-02-2010 / 19:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1531 |
"Created: / 22-07-2011 / 17:44:31 / cg" |
|
1532 |
! |
|
1533 |
||
9985 | 1534 |
browseImplementorsOfIt |
10262 | 1535 |
|
1536 |
textView browseImplementorsOfIt |
|
1537 |
||
1538 |
"Modified: / 30-06-2011 / 19:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1539 |
! |
1540 |
||
1541 |
browseSendersOfIt |
|
10262 | 1542 |
|
1543 |
textView browseSendersOfIt |
|
1544 |
||
1545 |
"Modified: / 30-06-2011 / 19:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 1546 |
! |
1547 |
||
1548 |
copySelection |
|
1549 |
||
1550 |
textView copySelection |
|
1551 |
||
1552 |
"Created: / 16-02-2010 / 19:36:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1553 |
! |
|
1554 |
||
1555 |
cut |
|
1556 |
||
1557 |
textView cut |
|
1558 |
||
1559 |
"Created: / 16-02-2010 / 19:36:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1560 |
! |
|
1561 |
||
1562 |
doIt |
|
1563 |
||
1564 |
textView doIt |
|
1565 |
||
1566 |
"Modified: / 16-02-2010 / 19:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1567 |
! |
|
1568 |
||
1569 |
inspectIt |
|
1570 |
||
1571 |
textView inspectIt |
|
1572 |
||
1573 |
"Modified: / 16-02-2010 / 19:38:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1574 |
! |
|
1575 |
||
1576 |
inspectSelectedSelector |
|
1577 |
||
1578 |
self error: 'Not yet implemented' |
|
1579 |
||
1580 |
"Modified: / 14-02-2010 / 15:58:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1581 |
! |
|
1582 |
||
1583 |
inspectSyntaxElements |
|
1584 |
||
1585 |
syntaxElements inspect |
|
1586 |
||
1587 |
"Modified: / 14-02-2010 / 15:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1588 |
! |
|
1589 |
||
1590 |
inspectView |
|
1591 |
||
1592 |
self inspect |
|
1593 |
||
1594 |
"Modified: / 25-03-2010 / 17:58:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1595 |
! |
|
1596 |
||
1597 |
pasteOrReplace |
|
1598 |
||
1599 |
textView pasteOrReplace |
|
1600 |
||
1601 |
"Created: / 16-02-2010 / 19:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1602 |
! |
|
1603 |
||
1604 |
printIt |
|
1605 |
||
1606 |
textView printIt |
|
1607 |
||
1608 |
"Modified: / 16-02-2010 / 19:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1609 |
! |
|
1610 |
||
1611 |
profileIt |
|
1612 |
||
1613 |
textView profileIt |
|
1614 |
||
1615 |
"Created: / 27-08-2010 / 22:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1616 |
! |
|
1617 |
||
1618 |
undo |
|
1619 |
||
1620 |
textView undo |
|
1621 |
||
1622 |
"Created: / 16-02-2010 / 19:35:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1623 |
! ! |
|
1624 |
||
1625 |
!CodeView2 methodsFor:'menus-dynamic'! |
|
1626 |
||
1627 |
editMenu |
|
12125 | 1628 |
| editMenu superEditMenu moreMenu moreMenuItem | |
1629 |
||
1630 |
superEditMenu := textView superEditMenu. |
|
1631 |
moreMenu := superEditMenu subMenuAt: superEditMenu numberOfItems. |
|
1632 |
||
1633 |
textView sensor ctrlDown ifTrue:[ |
|
1634 |
^superEditMenu |
|
1635 |
]. |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11220
diff
changeset
|
1636 |
|
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11220
diff
changeset
|
1637 |
editMenu := self class editMenu decodeAsLiteralArray. |
9985 | 1638 |
moreMenuItem := editMenu menuItemLabeled: 'More'. |
1639 |
moreMenuItem submenu: moreMenu asMenu. |
|
1640 |
editMenu findGuiResourcesIn: self. |
|
1641 |
^editMenu |
|
1642 |
||
1643 |
"Created: / 25-12-2007 / 10:10:01 / janfrog" |
|
1644 |
"Modified: / 25-12-2007 / 19:50:53 / janfrog" |
|
1645 |
"Modified: / 18-10-2008 / 20:31:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10293 | 1646 |
"Modified: / 08-07-2011 / 13:35:31 / cg" |
12125 | 1647 |
"Modified: / 07-10-2011 / 17:58:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1648 |
! |
1649 |
||
10262 | 1650 |
implementorsMenu |
1651 |
||
1652 |
| selectorAndSelectedText selector selectedText implementors | |
|
1653 |
||
1654 |
selectedText := textView selectionAsString. |
|
1655 |
selectedText size > 0 ifTrue:[ |
|
12205 | 1656 |
"/ self windowGroup withWaitCursorDo:[ |
10262 | 1657 |
selectorAndSelectedText := self extractSelectorAndSelectedTextFrom: selectedText. |
1658 |
selector := selectorAndSelectedText first. |
|
1659 |
selectedText := selectorAndSelectedText second. |
|
1660 |
||
1661 |
(selector notNil and:[selector = selectedText]) ifTrue:[ |
|
1662 |
implementors := (SystemBrowser |
|
12205 | 1663 |
findImplementorsOf:selectedText "Any: (Array with:selectedText)" |
1664 |
in:(Smalltalk allClasses) |
|
1665 |
ignoreCase:false) |
|
1666 |
||
1667 |
] ifFalse:[ |
|
10262 | 1668 |
implementors := (SystemBrowser |
12205 | 1669 |
findImplementorsOfAny:(Array with:selectedText with: selector) |
1670 |
in:(Smalltalk allClasses) |
|
1671 |
ignoreCase:false) |
|
1672 |
]. |
|
1673 |
"/ ] |
|
10262 | 1674 |
] ifFalse:[ |
1675 |
implementors := #(). |
|
1676 |
]. |
|
1677 |
||
1678 |
^self implementorsMenu: implementors selector: (selector ? selectedText) |
|
1679 |
||
1680 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1681 |
"Created: / 30-06-2011 / 19:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12205 | 1682 |
"Modified: / 05-03-2012 / 09:02:43 / cg" |
10262 | 1683 |
! |
1684 |
||
9985 | 1685 |
implementorsMenu: implementors selector: selector |
1686 |
| menu| |
|
1687 |
||
1688 |
menu := Menu new. |
|
10465 | 1689 |
implementors isEmptyOrNil ifTrue:[ |
9985 | 1690 |
menu addItem:(MenuItem label:'No implementors found') disable |
1691 |
] ifFalse:[ |
|
1692 |
menu addItem:(MenuItem |
|
1693 |
label:(selector storeString , (' (all implementors) ') asText allItalic) |
|
1694 |
value:[ |
|
1695 |
self browseMethods:implementors |
|
1696 |
label:'Implementors of ' , selector storeString |
|
1697 |
]). |
|
12205 | 1698 |
|
9985 | 1699 |
menu addSeparator. |
12205 | 1700 |
(implementors asOrderedCollection sort:[:a :b | a mclass name < b mclass name]) |
1701 |
"implementors" do:[:mth | |
|
9985 | 1702 |
menu |
1703 |
addItem:(MenuItem label:(selector storeString |
|
1704 |
, (' in ' , mth containingClass name asText allBold)) |
|
1705 |
value:[ self browseMethod:mth label: 'Implementor of ' , selector storeString ]) |
|
1706 |
] |
|
1707 |
]. |
|
1708 |
^ menu |
|
1709 |
||
1710 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1711 |
"Created: / 14-02-2010 / 19:39:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12205 | 1712 |
"Modified: / 07-03-2012 / 12:56:56 / cg" |
9985 | 1713 |
! |
1714 |
||
10262 | 1715 |
sendersMenu |
1716 |
||
1717 |
| selectorAndSelectedText selector selectedText senders | |
|
1718 |
||
1719 |
selectedText := textView selectionAsString. |
|
1720 |
selectedText size > 0 ifTrue:[ |
|
12205 | 1721 |
"/ self windowGroup withWaitCursorDo:[ |
10262 | 1722 |
selectorAndSelectedText := self extractSelectorAndSelectedTextFrom: selectedText. |
1723 |
selector := selectorAndSelectedText first. |
|
1724 |
selectedText := selectorAndSelectedText second. |
|
1725 |
||
1726 |
(selector notNil and:[selector = selectedText]) ifTrue:[ |
|
1727 |
senders := (SystemBrowser |
|
12205 | 1728 |
findSendersOf:selectedText "Any:(Array with:selectedText)" |
10262 | 1729 |
in:(Smalltalk allClasses) |
1730 |
ignoreCase:false) |
|
1731 |
||
12205 | 1732 |
] ifFalse:[ |
10262 | 1733 |
senders := (SystemBrowser |
1734 |
findSendersOfAny:(Array with:selectedText with: selector) |
|
1735 |
in:(Smalltalk allClasses) |
|
1736 |
ignoreCase:false) |
|
12205 | 1737 |
]. |
1738 |
"/ ] |
|
10262 | 1739 |
] ifFalse:[ |
1740 |
senders := #(). |
|
1741 |
]. |
|
1742 |
||
1743 |
^self sendersMenu: senders selector: (selector ? selectedText) |
|
1744 |
||
1745 |
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1746 |
"Created: / 30-06-2011 / 19:28:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12205 | 1747 |
"Modified: / 05-03-2012 / 09:02:56 / cg" |
10262 | 1748 |
! |
1749 |
||
9985 | 1750 |
sendersMenu: senders selector: selector |
12205 | 1751 |
| menu shownSenderItems numCut sendersSorted| |
9985 | 1752 |
|
10262 | 1753 |
menu := Menu new. |
10465 | 1754 |
senders isEmptyOrNil ifTrue:[ |
9985 | 1755 |
menu addItem:(MenuItem label:'No senders found') disable |
1756 |
] ifFalse:[ |
|
1757 |
menu addItem:(MenuItem |
|
1758 |
label:(selector storeString , (' (all senders)') asText allItalic) |
|
1759 |
value:[ |
|
1760 |
self browseMethods:senders |
|
1761 |
label:'Senders of ' , selector storeString |
|
1762 |
]). |
|
1763 |
menu addSeparator. |
|
12205 | 1764 |
sendersSorted := senders asOrderedCollection |
1765 |
sort:[:a :b | a whoString < b whoString]. |
|
1766 |
shownSenderItems := (senders size > 20) ifTrue:[sendersSorted copyTo:20] ifFalse:[sendersSorted]. |
|
12125 | 1767 |
numCut := senders size - 20. |
1768 |
shownSenderItems do:[:mth | |
|
9985 | 1769 |
menu |
1770 |
addItem:(MenuItem label:(mth selector storeString |
|
1771 |
, (' in ' , mth containingClass name asText allBold)) |
|
1772 |
value:[ self browseMethod:mth label: 'Sender of ' , selector storeString ]) |
|
12125 | 1773 |
]. |
1774 |
numCut > 0 ifTrue:[ |
|
1775 |
menu addSeparator. |
|
1776 |
menu addItem:(MenuItem label:('... %1 more senders not shown here' bindWith:numCut)) disable |
|
1777 |
]. |
|
9985 | 1778 |
]. |
1779 |
^ menu |
|
1780 |
||
1781 |
"Modified: / 19-10-2008 / 08:17:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1782 |
"Created: / 14-02-2010 / 19:40:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10262 | 1783 |
"Modified: / 07-07-2011 / 14:51:54 / jv" |
12205 | 1784 |
"Modified: / 07-03-2012 / 12:58:31 / cg" |
9985 | 1785 |
! |
1786 |
||
1787 |
servicesMenu |
|
10293 | 1788 |
|menu item anyService| |
1789 |
||
9985 | 1790 |
menu := Menu new. |
10293 | 1791 |
|
1792 |
item := MenuItem label:(resources string:'Show Gutter'). |
|
1793 |
item indication:(self showGutterChannel). |
|
1794 |
menu addItem:item. |
|
1795 |
menu addSeparator. |
|
1796 |
||
1797 |
anyService := false. |
|
1798 |
services do:[:service | |
|
1799 |
|item| |
|
1800 |
||
1801 |
item := MenuItem label:(resources string:service label). |
|
1802 |
item indication:((AspectAdaptor forAspect:#enabled) subject:service). |
|
1803 |
menu addItem:item. |
|
1804 |
anyService := true. |
|
1805 |
]. |
|
1806 |
||
1807 |
anyService ifTrue:[ |
|
1808 |
menu addSeparator. |
|
1809 |
]. |
|
1810 |
||
1811 |
item := MenuItem label:(resources string:'Debug'). |
|
1812 |
item submenuChannel:[ self class debugMenu ]. |
|
1813 |
menu addItem:item. |
|
1814 |
||
1815 |
^ menu |
|
9985 | 1816 |
|
1817 |
"Created: / 07-03-2010 / 14:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 1818 |
"Modified: / 06-10-2011 / 14:14:30 / cg" |
9985 | 1819 |
! ! |
1820 |
||
1821 |
!CodeView2 methodsFor:'private'! |
|
1822 |
||
1823 |
codeCompletion |
|
1824 |
|cls |
|
1825 |
"/ crsrPos interval node checkedNode |
|
1826 |
"/ char start stop selectorSoFar matchingSelectors |
|
1827 |
| |
|
1828 |
||
1829 |
||
1830 |
cls := self classHolder value. |
|
1831 |
cls isNil ifTrue:[ |
|
1832 |
self showInfo:'No class'. |
|
1833 |
^ self. |
|
1834 |
]. |
|
1835 |
UserInformation handle:[:ex | |
|
1836 |
self showInfo:(ex messageText). |
|
1837 |
ex proceed. |
|
1838 |
] do:[ |
|
1839 |
self withWaitCursorDo:[ |
|
1840 |
DoWhatIMeanSupport codeCompletionForClass:cls codeView:self. |
|
1841 |
] |
|
1842 |
]. |
|
1843 |
^ self. |
|
1844 |
||
1845 |
"/ |
|
1846 |
"/ interval := self selectedInterval. |
|
1847 |
"/ interval isEmpty ifTrue:[ |
|
1848 |
"/ crsrPos := codeView characterPositionOfCursor - 1. |
|
1849 |
"/ char := codeView characterUnderCursor. |
|
1850 |
"/ [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[ |
|
1851 |
"/ crsrPos := crsrPos - 1. |
|
1852 |
"/ char := codeView characterAtCharacterPosition:crsrPos. |
|
1853 |
"/ ]. |
|
1854 |
"/ interval := crsrPos to:crsrPos. |
|
1855 |
"/ ]. |
|
1856 |
"/ |
|
1857 |
"/ node := self findNodeForInterval:interval allowErrors:true. |
|
1858 |
"/ [node isNil] whileTrue:[ |
|
1859 |
"/ "/ expand to the left ... |
|
1860 |
"/ interval start > 1 ifFalse:[ |
|
1861 |
"/ self showInfo:'No parseNode found'. |
|
1862 |
"/ ^ self. |
|
1863 |
"/ ]. |
|
1864 |
"/ interval start:(interval start - 1). |
|
1865 |
"/ node := self findNodeForInterval:interval allowErrors:true. |
|
1866 |
"/ ]. |
|
1867 |
"/ |
|
1868 |
"/ node isVariable ifTrue:[ |
|
1869 |
"/ self codeCompletionForVariable:node inClass:cls. |
|
1870 |
"/ ^ self. |
|
1871 |
"/ ]. |
|
1872 |
"/ |
|
1873 |
"/ checkedNode := node. |
|
1874 |
"/ [checkedNode notNil] whileTrue:[ |
|
1875 |
"/ checkedNode isMessage ifTrue:[ |
|
1876 |
"/ self codeCompletionForMessage:checkedNode inClass:cls. |
|
1877 |
"/ ^ self |
|
1878 |
"/ ]. |
|
1879 |
"/ checkedNode isMethod ifTrue:[ |
|
1880 |
"/ self codeCompletionForMethod:checkedNode inClass:cls. |
|
1881 |
"/ ^ self. |
|
1882 |
"/ ]. |
|
1883 |
"/ checkedNode := checkedNode parent. |
|
1884 |
"/ ]. |
|
1885 |
"/ |
|
1886 |
"/ self showInfo:'Node is neither variable nor message.'. |
|
1887 |
||
1888 |
"Modified: / 04-07-2006 / 18:48:26 / fm" |
|
1889 |
"Modified: / 20-11-2006 / 12:30:59 / cg" |
|
1890 |
"Modified: / 16-02-2010 / 10:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1891 |
! |
|
1892 |
||
1893 |
reallyModified |
|
1894 |
"check for modified code by comparing the source against |
|
1895 |
the codeViews contents. |
|
1896 |
Thats the true modified value (in case user undid its changes, |
|
1897 |
and the displayed text is actually original" |
|
1898 |
||
1899 |
|modified changedSource originalSource s1 s2| |
|
1900 |
||
1901 |
textView modified ifTrue:[^true]. |
|
1902 |
||
1903 |
"/ higher prio to prevent it from being changed while we convert it (by editing) |
|
1904 |
Processor activeProcess |
|
1905 |
withHigherPriorityDo:[ |
|
12262 | 1906 |
changedSource := textView contentsAsString asStringCollection. |
9985 | 1907 |
]. |
1908 |
changedSource := changedSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded]. |
|
1909 |
changedSource := changedSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]]. |
|
1910 |
[changedSource size > 0 and:[changedSource last isNil]] whileTrue:[ |
|
1911 |
changedSource := changedSource copyWithoutLast:1 |
|
1912 |
]. |
|
1913 |
changedSource := changedSource asString. |
|
1914 |
||
1915 |
originalSource := textView model value ? ''. |
|
1916 |
||
1917 |
originalSource := originalSource asStringCollection. |
|
1918 |
originalSource := originalSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded]. |
|
1919 |
originalSource := originalSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]]. |
|
1920 |
[originalSource size > 0 and:[originalSource last isNil]] whileTrue:[ |
|
1921 |
originalSource := originalSource copyWithoutLast:1 |
|
1922 |
]. |
|
1923 |
||
1924 |
s1 := originalSource asString. |
|
1925 |
s2 := changedSource asString. |
|
1926 |
modified := (s1 ~= s2). |
|
1927 |
||
1928 |
^ modified |
|
1929 |
||
1930 |
"Created: / 06-02-2010 / 19:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12262 | 1931 |
"Modified (format): / 05-06-2012 / 23:55:02 / cg" |
9985 | 1932 |
! |
1933 |
||
1934 |
showInfo: message |
|
1935 |
||
1936 |
| app | |
|
1937 |
(app := self topView application) ifNotNil: |
|
1938 |
[(app respondsTo: #showInfo:) ifTrue: |
|
1939 |
[app showInfo: message]]. |
|
1940 |
||
1941 |
"Modified: / 13-02-2010 / 23:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1942 |
! ! |
|
1943 |
||
1944 |
!CodeView2 methodsFor:'private-accessing'! |
|
1945 |
||
1946 |
gutterView |
|
1947 |
||
1948 |
^gutterView |
|
1949 |
||
1950 |
"Created: / 14-02-2010 / 15:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1951 |
! |
|
1952 |
||
1953 |
syntaxElementSelection |
|
1954 |
^ syntaxElementSelection |
|
1955 |
! |
|
1956 |
||
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1957 |
syntaxElementSelection:anElement |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1958 |
syntaxElementSelection := anElement. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1959 |
anElement isNil ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1960 |
currentParseNodeHolder value: nil. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1961 |
currentBlockNodeHolder value: nil. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1962 |
] ifFalse:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1963 |
currentParseNodeHolder value: anElement node. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1964 |
currentBlockNodeHolder value: anElement node enclosingBlock. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1965 |
] |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1966 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
1967 |
"Modified: / 16-02-2012 / 23:06:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 1968 |
! |
1969 |
||
1970 |
syntaxElements |
|
1971 |
^ syntaxElements |
|
1972 |
! |
|
1973 |
||
1974 |
syntaxElements:something |
|
1975 |
syntaxElements := something. |
|
1976 |
! |
|
1977 |
||
1978 |
textView |
|
1979 |
||
1980 |
^textView |
|
1981 |
||
1982 |
"Created: / 14-02-2010 / 15:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1983 |
! |
|
1984 |
||
1985 |
textViewScroller |
|
1986 |
||
1987 |
^textViewScroller |
|
1988 |
||
1989 |
"Created: / 14-02-2010 / 15:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1990 |
! ! |
|
1991 |
||
11179 | 1992 |
!CodeView2 methodsFor:'realization'! |
1993 |
||
1994 |
postRealize |
|
1995 |
||
12125 | 1996 |
services do:[:service| |
1997 |
service viewRealized. |
|
1998 |
] |
|
1999 |
||
2000 |
"Created: / 23-01-2012 / 10:35:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11179 | 2001 |
! ! |
2002 |
||
9985 | 2003 |
!CodeView2 methodsFor:'services'! |
2004 |
||
2005 |
registerService: aCodeViewService |
|
2006 |
||
2007 |
services add: aCodeViewService. |
|
2008 |
aCodeViewService registerIn: self |
|
2009 |
||
2010 |
"Created: / 06-03-2010 / 19:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2011 |
! |
|
2012 |
||
12265 | 2013 |
unregisterService: aCodeViewService |
9985 | 2014 |
|
2015 |
services remove: aCodeViewService ifAbsent:[^self]. |
|
2016 |
aCodeViewService unregister. |
|
2017 |
||
2018 |
"Created: / 06-03-2010 / 19:21:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12265 | 2019 |
"Created: / 19-07-2012 / 16:34:18 / cg" |
9985 | 2020 |
! ! |
2021 |
||
2022 |
!CodeView2 methodsFor:'testing'! |
|
2023 |
||
12125 | 2024 |
isCodeView2 |
2025 |
||
2026 |
^true |
|
2027 |
||
2028 |
"Created: / 20-07-2010 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2029 |
! |
|
2030 |
||
9985 | 2031 |
isTextView |
2032 |
||
2033 |
^true |
|
2034 |
||
2035 |
"Created: / 14-02-2010 / 22:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2036 |
! ! |
|
2037 |
||
2038 |
!CodeView2::GutterView methodsFor:'accessing'! |
|
2039 |
||
2040 |
setTextView: aTextView |
|
2041 |
||
2042 |
self assert: textView isNil message:'Attempting to set textView twice'. |
|
2043 |
textView := aTextView. |
|
2044 |
||
10577 | 2045 |
"/ self backgroundPaint: textView backgroundPaint darkened lighter. |
2046 |
self viewBackground: (View defaultBackgroundColor). "/ textView backgroundPaint darkened lighter. |
|
9985 | 2047 |
self paint: textView paint. |
2048 |
self font: textView font. |
|
2049 |
||
2050 |
"Created: / 02-09-2009 / 21:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2051 |
"Modified: / 14-12-2009 / 15:09:29 / Jindra <a>" |
|
2052 |
"Modified: / 09-02-2010 / 20:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10577 | 2053 |
"Modified: / 17-08-2011 / 15:15:09 / cg" |
9985 | 2054 |
! |
2055 |
||
2056 |
setTextViewScroller:aScr |
|
2057 |
textViewScroller := aScr. |
|
2058 |
||
2059 |
"Created: / 07-12-2009 / 22:36:31 / Jindra <a>" |
|
2060 |
! ! |
|
2061 |
||
2062 |
!CodeView2::GutterView methodsFor:'accessing-dimensions'! |
|
2063 |
||
12125 | 2064 |
acceptButtonBottom |
2065 |
||
2066 |
^(self height * 0.6) ceiling. |
|
2067 |
||
2068 |
"Created: / 07-10-2011 / 19:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2069 |
! |
|
2070 |
||
2071 |
cancelButtonBottom |
|
2072 |
||
2073 |
^(self height * 0.8) ceiling. |
|
2074 |
||
2075 |
"Created: / 07-10-2011 / 19:54:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2076 |
! |
|
2077 |
||
9985 | 2078 |
padding |
2079 |
||
2080 |
^self paddingLeft + self paddingRight |
|
12125 | 2081 |
+ (widthAcceptCancel ? 0) |
9985 | 2082 |
+ (widthAnnotations ? 0) |
2083 |
+ (widthDiffInfo ? 0) |
|
2084 |
||
2085 |
"Created: / 14-02-2010 / 22:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 2086 |
"Modified: / 07-10-2011 / 19:01:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2087 |
"Modified (format): / 07-10-2011 / 20:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 2088 |
! |
2089 |
||
2090 |
paddingLeft |
|
2091 |
||
2092 |
^0"px" |
|
2093 |
||
2094 |
"Created: / 14-02-2010 / 22:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2095 |
"Modified: / 16-06-2011 / 13:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2096 |
! |
|
2097 |
||
2098 |
paddingRight |
|
2099 |
||
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2100 |
^3"px" |
9985 | 2101 |
|
2102 |
"Created: / 14-02-2010 / 22:27:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2103 |
"Modified: / 16-02-2012 / 22:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2104 |
! |
2105 |
||
2106 |
preferredExtent |
|
12229 | 2107 |
| font w h | |
9985 | 2108 |
|
2109 |
explicitExtent ifNotNil:[^explicitExtent]. |
|
2110 |
preferredExtent ifNotNil:[^preferredExtent]. |
|
2111 |
||
12229 | 2112 |
font := self font. |
2113 |
w := (font widthOf:'00') + self padding. |
|
2114 |
h := textView notNil |
|
2115 |
ifTrue:[textView height] |
|
2116 |
ifFalse:[font height * 12]. |
|
9985 | 2117 |
|
2118 |
^preferredExtent := w @ h |
|
2119 |
||
2120 |
"Modified: / 16-06-2011 / 14:03:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12229 | 2121 |
"Modified (format): / 26-03-2012 / 11:19:54 / cg" |
9985 | 2122 |
! ! |
2123 |
||
12125 | 2124 |
!CodeView2::GutterView methodsFor:'actions'! |
2125 |
||
2126 |
accept |
|
2127 |
||
2128 |
textView accept |
|
2129 |
||
2130 |
"Created: / 07-10-2011 / 20:23:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2131 |
! |
|
2132 |
||
2133 |
cancel |
|
2134 |
||
2135 |
textView cancel |
|
2136 |
||
2137 |
"Created: / 07-10-2011 / 20:23:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2138 |
! |
|
2139 |
||
2140 |
diff |
|
2141 |
||
2142 |
"Created: / 07-10-2011 / 20:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2143 |
! ! |
|
2144 |
||
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2145 |
!CodeView2::GutterView methodsFor:'aspects'! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2146 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2147 |
currentBlockNodeHolder |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2148 |
"return/create the 'currentBlockNodeHolder' value holder (automatically generated)" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2149 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2150 |
currentBlockNodeHolder isNil ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2151 |
currentBlockNodeHolder := ValueHolder new. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2152 |
currentBlockNodeHolder addDependent:self. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2153 |
]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2154 |
^ currentBlockNodeHolder |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2155 |
! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2156 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2157 |
currentBlockNodeHolder:something |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2158 |
"set the 'currentBlockNodeHolder' value holder (automatically generated)" |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2159 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2160 |
|oldValue newValue| |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2161 |
|
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2162 |
currentBlockNodeHolder notNil ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2163 |
oldValue := currentBlockNodeHolder value. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2164 |
currentBlockNodeHolder removeDependent:self. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2165 |
]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2166 |
currentBlockNodeHolder := something. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2167 |
currentBlockNodeHolder notNil ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2168 |
currentBlockNodeHolder addDependent:self. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2169 |
]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2170 |
newValue := currentBlockNodeHolder value. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2171 |
oldValue ~~ newValue ifTrue:[ |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2172 |
self update:#value with:newValue from:currentBlockNodeHolder. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2173 |
]. |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2174 |
! ! |
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2175 |
|
9985 | 2176 |
!CodeView2::GutterView methodsFor:'change & update'! |
2177 |
||
2178 |
update:something with:aParameter from:changedObject |
|
2179 |
self shown ifFalse:[^self]. |
|
2180 |
||
10326 | 2181 |
(changedObject == textView) ifTrue:[ |
2182 |
(something == #sizeOfContents) ifTrue:[ |
|
2183 |
"/ cg: with that test, it does not update when the text becomes smaller... |
|
2184 |
"/ (firstLineShown ~= textView firstLineShown |
|
2185 |
"/ or:[lastLineShown ~= (textView lastLineShown - 1)]) ifTrue:[ |
|
10312 | 2186 |
self invalidate. |
2187 |
^self. |
|
10326 | 2188 |
"/ ] |
2189 |
]. |
|
10312 | 2190 |
]. |
12125 | 2191 |
(changedObject == textView reallyModifiedChannel) ifTrue:[ |
2192 |
self invalidate. |
|
2193 |
]. |
|
9985 | 2194 |
|
12224 | 2195 |
changedObject == codeView currentBlockNodeHolder ifTrue:[ |
2196 |
self invalidate. |
|
2197 |
^ self. |
|
2198 |
]. |
|
2199 |
||
2200 |
||
9985 | 2201 |
"/ changedObject == someOfMyValueHolders ifTrue:[ |
2202 |
"/ self doSomethingApropriate. |
|
2203 |
"/ ^ self. |
|
2204 |
"/ ]. |
|
2205 |
super update:something with:aParameter from:changedObject |
|
2206 |
||
10326 | 2207 |
"Modified (format): / 15-07-2011 / 20:14:04 / cg" |
12224 | 2208 |
"Modified: / 05-04-2012 / 17:47:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2209 |
! ! |
2210 |
||
2211 |
!CodeView2::GutterView methodsFor:'event handling'! |
|
2212 |
||
2213 |
buttonPress: btn x: x y: y |
|
12254 | 2214 |
|extraSafeArea| |
2215 |
||
12125 | 2216 |
(x <= (self paddingLeft + widthAcceptCancel)) ifTrue:[ |
2217 |
(y < self acceptButtonBottom) ifTrue:[ |
|
2218 |
self accept. |
|
2219 |
^self. |
|
2220 |
]. |
|
2221 |
(y < self cancelButtonBottom) ifTrue:[ |
|
2222 |
self cancel. |
|
2223 |
^self. |
|
2224 |
]. |
|
2225 |
self diff. |
|
2226 |
^self. |
|
2227 |
]. |
|
2228 |
||
12254 | 2229 |
"Do not allow clicking on line numbers..." |
12287 | 2230 |
extraSafeArea := "('999' widthOn:self)" 5. |
12254 | 2231 |
x < (self width - self paddingRight - widthDiffInfo - extraSafeArea) ifFalse:[^ self]. |
12125 | 2232 |
|
2233 |
((x > (self paddingLeft + widthAcceptCancel)) or: |
|
12254 | 2234 |
[x < (self width - self paddingRight - widthDiffInfo)] |
2235 |
) ifTrue:[ |
|
2236 |
(codeView buttonPress: btn x:x y:y in: self) ifFalse:[ |
|
9985 | 2237 |
super buttonPress: btn x: x y: y |
2238 |
] |
|
12254 | 2239 |
] ifFalse:[ |
2240 |
super buttonPress: btn x: x y: y |
|
2241 |
] |
|
9985 | 2242 |
|
2243 |
"Created: / 17-06-2011 / 13:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12254 | 2244 |
"Modified (comment): / 18-05-2012 / 10:56:54 / cg" |
9985 | 2245 |
! ! |
2246 |
||
12125 | 2247 |
!CodeView2::GutterView methodsFor:'help'! |
2248 |
||
2249 |
flyByHelpText |
|
2250 |
^ 'Click to toggle breakpoint. Shift-Click to toggle tracepoint.' |
|
2251 |
||
2252 |
"Created: / 27-01-2012 / 14:04:52 / cg" |
|
2253 |
! ! |
|
2254 |
||
9985 | 2255 |
!CodeView2::GutterView methodsFor:'initialization'! |
2256 |
||
2257 |
initialize |
|
2258 |
||
2259 |
super initialize. |
|
12125 | 2260 |
widthAcceptCancel := 16. |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
2261 |
widthAnnotations := "16"8. |
9985 | 2262 |
widthDiffInfo := 5. |
2263 |
||
12125 | 2264 |
acceptColor := Color green lighter. |
2265 |
cancelColor := Color red lighter lighter. |
|
2266 |
diffColor := Color yellow lighter lighter. |
|
2267 |
||
9985 | 2268 |
"Created: / 16-06-2011 / 13:47:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2269 |
! |
|
2270 |
||
2271 |
setCodeView: aCodeView2 |
|
2272 |
||
2273 |
codeView := aCodeView2. |
|
2274 |
codeView addDependent: self. |
|
12125 | 2275 |
codeView reallyModifiedChannel addDependent: self. |
12224 | 2276 |
codeView currentBlockNodeHolder addDependent: self. |
2277 |
||
9985 | 2278 |
textView := aCodeView2 textView. |
2279 |
textView addDependent: self. |
|
12168
95a3a7290554
Fixes, some support for SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12158
diff
changeset
|
2280 |
self currentBlockNodeHolder: codeView currentBlockNodeHolder. |
9985 | 2281 |
textViewScroller := aCodeView2 textViewScroller. |
10577 | 2282 |
"/ self backgroundPaint: (textView viewBackground "backgroundPaint" blendWith: (Color gray:80)). |
2283 |
self viewBackground: (View defaultBackgroundColor). |
|
9985 | 2284 |
|
2285 |
"Created: / 14-02-2010 / 15:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10577 | 2286 |
"Modified: / 17-08-2011 / 15:15:55 / cg" |
12224 | 2287 |
"Modified: / 05-04-2012 / 17:46:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2288 |
! ! |
2289 |
||
2290 |
!CodeView2::GutterView methodsFor:'queries'! |
|
2291 |
||
2292 |
displayedString: line |
|
2293 |
"get text to display in gutter for specified list line number" |
|
2294 |
||
2295 |
^(line asString). |
|
2296 |
||
2297 |
"Created: / 14-12-2009 / 13:37:47 / Jindra <a>" |
|
2298 |
! |
|
2299 |
||
2300 |
lineColor:line |
|
2301 |
"return special color for given line if required, nil otherwise" |
|
2302 |
"used only if lineFont return nil" |
|
2303 |
||
2304 |
^nil |
|
2305 |
||
2306 |
"Created: / 14-12-2009 / 15:01:31 / Jindra <a>" |
|
2307 |
! |
|
2308 |
||
2309 |
lineDisplayable:line |
|
2310 |
"true if this list line can be displayed" |
|
2311 |
^(textView listLineIsVisible:line) |
|
2312 |
||
2313 |
"Created: / 14-12-2009 / 13:38:23 / Jindra <a>" |
|
2314 |
! |
|
2315 |
||
2316 |
lineFont:line |
|
2317 |
"return special font for given line if required, nil otherwise" |
|
2318 |
||
2319 |
^nil |
|
2320 |
||
2321 |
"Created: / 14-12-2009 / 14:40:17 / Jindra <a>" |
|
2322 |
! |
|
2323 |
||
2324 |
yOfTextViewLine:line |
|
2325 |
^(textView yOfLine:line) + 1 |
|
2326 |
||
2327 |
"Created: / 14-12-2009 / 13:35:07 / Jindra <a>" |
|
2328 |
! ! |
|
2329 |
||
2330 |
!CodeView2::GutterView methodsFor:'redrawing'! |
|
2331 |
||
12125 | 2332 |
redrawAcceptCancelBarX: x y: y width:w height:h |
2333 |
||
2334 |
| rw acceptBottom cancelBottom | |
|
2335 |
||
2336 |
x > ((self paddingLeft) + (widthAcceptCancel ? 0)) ifTrue:[ |
|
2337 |
^self. |
|
2338 |
]. |
|
2339 |
rw := ((x + w) min: (self paddingLeft + (widthAcceptCancel ? 0))) - x. |
|
2340 |
||
2341 |
||
2342 |
textView reallyModified ifFalse:[ |
|
2343 |
self fillRectangleX:x y:y width:rw height:h color: self viewBackground |
|
2344 |
] ifTrue:[ |
|
2345 |
acceptBottom := self acceptButtonBottom. |
|
2346 |
cancelBottom := self cancelButtonBottom. |
|
2347 |
y < acceptBottom ifTrue:[ |
|
2348 |
self fillRectangleX:x y:y width:rw height: ((y + h) min: acceptBottom) color: acceptColor. |
|
2349 |
]. |
|
2350 |
(y < cancelBottom) ifTrue:[ |
|
2351 |
self fillRectangleX:x y: acceptBottom + 1width:rw height: ((y + h) min: cancelBottom) - acceptBottom - 1color: cancelColor. |
|
2352 |
]. |
|
2353 |
(y + h >= cancelBottom) ifTrue:[ |
|
2354 |
self fillRectangleX:x y: cancelBottom + 1 width:rw height: (y + h) - cancelBottom - 1 color: diffColor. |
|
2355 |
] |
|
2356 |
||
2357 |
] |
|
2358 |
||
2359 |
"Created: / 07-10-2011 / 19:44:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2360 |
! |
|
2361 |
||
9985 | 2362 |
redrawBackgroundX:x y:y width:w height:h |
2363 |
"redraws gutter background" |
|
2364 |
||
2365 |
"background is filled with background color" |
|
2366 |
self |
|
2367 |
fillRectangleX:x |
|
2368 |
y:y |
|
2369 |
width:w |
|
2370 |
height:h |
|
12125 | 2371 |
color: self viewBackground "backgroundPaint". |
9985 | 2372 |
|
2373 |
"separator line is drawn with foreground color" |
|
2374 |
self |
|
2375 |
displayLineFromX:(self width - 2) |
|
2376 |
y:y |
|
2377 |
toX:(self width - 2) |
|
2378 |
y:(y+h). |
|
2379 |
||
2380 |
"Created: / 14-12-2009 / 13:15:53 / Jindra <a>" |
|
2381 |
"Modified: / 14-12-2009 / 15:09:54 / Jindra <a>" |
|
10577 | 2382 |
"Modified: / 17-08-2011 / 15:12:47 / cg" |
12125 | 2383 |
"Modified (comment): / 07-10-2011 / 19:37:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2384 |
! |
2385 |
||
2386 |
redrawLine:line |
|
2387 |
||
2388 |
^self redrawLine:line cleared: false. |
|
2389 |
||
2390 |
"Modified: / 17-06-2011 / 14:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2391 |
! |
|
2392 |
||
2393 |
redrawLine:line cleared: cleared |
|
2394 |
"redraws specified line. Returns width of drawn object. Color of drawn objects should be taken from lineFont, lineColor" |
|
2395 |
||
12224 | 2396 |
|lineString y0 yOfLine textW requiredW oldFont newFont oldColor newColor| |
9985 | 2397 |
|
2398 |
lineString := self displayedString:line. |
|
2399 |
textW := (lineString widthOn:self). |
|
2400 |
requiredW := textW + self padding. |
|
2401 |
||
2402 |
oldFont := self font. |
|
2403 |
oldColor := self paint. |
|
2404 |
newFont := self lineFont:line. |
|
12205 | 2405 |
newFont isNil ifTrue:[ |
2406 |
newFont := oldFont. |
|
2407 |
newColor := self lineColor:line. |
|
12224 | 2408 |
newColor notNil ifTrue:[ self paint:newColor ]. |
12205 | 2409 |
] ifFalse:[ |
2410 |
self font:newFont. |
|
2411 |
]. |
|
2412 |
(newFont heightOn:device) > (textView font heightOn:device) ifTrue:[ |
|
2413 |
newFont := textView font. |
|
2414 |
self font:newFont |
|
2415 |
]. |
|
2416 |
||
12265 | 2417 |
y0 := (textView yOfLine:line) |
2418 |
+ (textView font ascentOn:device) |
|
2419 |
"/ - (newFont descentOn:device) |
|
2420 |
+ 1. |
|
9985 | 2421 |
|
2422 |
cleared ifFalse:[ |
|
2423 |
self clearRectangleX:0 y:y0 - font height width: self width - 2 height: font height + font descent. |
|
2424 |
]. |
|
2425 |
||
2426 |
"Let the services to draw annotations and other stuff" |
|
2427 |
codeView |
|
2428 |
drawLine:line in: self |
|
12125 | 2429 |
atX: self paddingLeft + (widthAcceptCancel ? 0) y:y0 width: widthAnnotations height: font height |
9985 | 2430 |
from:nil to:nil with:self paint and: self backgroundColor. |
2431 |
self |
|
2432 |
displayString:lineString |
|
2433 |
x:(self width - textW - self paddingRight - widthDiffInfo) |
|
2434 |
y:y0. |
|
12224 | 2435 |
newFont notNil ifTrue:[ |
2436 |
self font:oldFont. |
|
2437 |
self paint:oldColor |
|
2438 |
] ifFalse:[ |
|
2439 |
newColor notNil ifTrue:[ |
|
2440 |
self paint:oldColor |
|
2441 |
]. |
|
2442 |
]. |
|
2443 |
||
9985 | 2444 |
^ requiredW. |
2445 |
||
2446 |
"Modified: / 14-12-2009 / 15:30:44 / Jindra <a>" |
|
2447 |
"Created: / 17-06-2011 / 14:11:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12265 | 2448 |
"Modified: / 18-07-2012 / 19:05:24 / cg" |
9985 | 2449 |
! |
2450 |
||
10224 | 2451 |
redrawLinesFrom:start |
2452 |
||
10312 | 2453 |
start to: (textView lastLineShown - 1 min: textView list size) do:[:line| |
10224 | 2454 |
self redrawLine:line cleared: false. |
2455 |
] |
|
2456 |
||
2457 |
"Created: / 06-07-2011 / 17:25:36 / jv" |
|
10312 | 2458 |
"Modified: / 12-07-2011 / 17:14:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 2459 |
! |
2460 |
||
9985 | 2461 |
redrawX:x y:y width:w height:h |
10312 | 2462 |
| requiredW currentW | |
9985 | 2463 |
|
2464 |
self redrawBackgroundX:x y:y width:w height:h. |
|
10793
c19380a197aa
Added channel for controlling visibility of accept/cancel
vrany
parents:
10791
diff
changeset
|
2465 |
|
12125 | 2466 |
codeView showAcceptCancelBar ifTrue:[ |
2467 |
self redrawAcceptCancelBarX:x y:y width:w height:h. |
|
2468 |
]. |
|
2469 |
||
10312 | 2470 |
firstLineShown := textView firstLineShown. |
2471 |
lastLineShown := textView lastLineShown - 1 min: textView list size. |
|
9985 | 2472 |
|
2473 |
currentW := requiredW := self width. |
|
10312 | 2474 |
firstLineShown to:lastLineShown do: |
9985 | 2475 |
[:line | |
2476 |
requiredW := requiredW max: (self redrawLine:line cleared: true)]. |
|
2477 |
||
2478 |
(requiredW > self width) ifTrue:[ |
|
2479 |
self corner:(requiredW @ 1.0). |
|
2480 |
textViewScroller origin:(requiredW @ 0.0) corner:(1.0 @ 1.0). |
|
2481 |
self invalidate. |
|
2482 |
]. |
|
2483 |
||
2484 |
"Created: / 03-09-2009 / 08:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2485 |
"Modified: / 14-12-2009 / 14:13:14 / Jindra <a>" |
|
12125 | 2486 |
"Modified: / 10-10-2011 / 16:35:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2487 |
! ! |
2488 |
||
2489 |
!CodeView2::TextView methodsFor:'accessing'! |
|
2490 |
||
2491 |
changedDiffText |
|
2492 |
^ changedDiffText |
|
2493 |
! |
|
2494 |
||
2495 |
changedDiffText:something |
|
2496 |
changedDiffText := something. |
|
2497 |
! |
|
2498 |
||
2499 |
changedLines |
|
2500 |
^ changedLines |
|
2501 |
||
2502 |
"Created: / 26-04-2010 / 20:30:32 / Jakub <zelenja7@fel.cvut.cz>" |
|
2503 |
"Modified: / 26-04-2010 / 21:48:13 / Jakub <zelenja7@fel.cvut.cz>" |
|
2504 |
! |
|
2505 |
||
2506 |
changedLines:something |
|
2507 |
changedLines := something. |
|
2508 |
||
2509 |
"Created: / 26-04-2010 / 20:30:19 / Jakub <zelenja7@fel.cvut.cz>" |
|
2510 |
"Modified: / 02-05-2010 / 19:13:32 / Jakub <zelenja7@fel.cvut.cz>" |
|
2511 |
! |
|
2512 |
||
12125 | 2513 |
contents: text |
2514 |
||
2515 |
super contents: text. |
|
2516 |
reallyModifiedChannel value: false. |
|
2517 |
||
2518 |
"Created: / 07-10-2011 / 20:32:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2519 |
! |
|
2520 |
||
12171 | 2521 |
contents: text clear: clearPrevious |
2522 |
||
2523 |
| savedListOriginal | |
|
2524 |
savedListOriginal := listOriginal. |
|
2525 |
super contents: text. |
|
2526 |
listOriginal := savedListOriginal. |
|
2527 |
self updateReallyModified. |
|
2528 |
||
2529 |
"Created: / 17-02-2012 / 00:35:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2530 |
! |
|
2531 |
||
9985 | 2532 |
deletedLines |
2533 |
^ deletedLines |
|
2534 |
||
2535 |
"Modified: / 26-04-2010 / 21:48:23 / Jakub <zelenja7@fel.cvut.cz>" |
|
2536 |
! |
|
2537 |
||
12262 | 2538 |
deletedLines:something |
2539 |
deletedLines := something. |
|
9985 | 2540 |
|
2541 |
"Modified: / 26-04-2010 / 21:48:54 / Jakub <zelenja7@fel.cvut.cz>" |
|
12262 | 2542 |
"Modified (format): / 17-07-2012 / 18:56:44 / cg" |
9985 | 2543 |
! |
2544 |
||
2545 |
diffMode |
|
2546 |
^ diffMode |
|
2547 |
! |
|
2548 |
||
2549 |
diffMode:something |
|
2550 |
diffMode := something. |
|
2551 |
! |
|
2552 |
||
2553 |
emptyLines |
|
2554 |
^ emptyLines |
|
2555 |
! |
|
2556 |
||
2557 |
emptyLines:something |
|
2558 |
emptyLines := something. |
|
2559 |
! |
|
2560 |
||
12251
5ca4da2bb38c
Fixed baseline computation in CodeView2::GutterView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12244
diff
changeset
|
2561 |
fontAscent |
5ca4da2bb38c
Fixed baseline computation in CodeView2::GutterView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12244
diff
changeset
|
2562 |
^fontAscent notNil ifTrue:[fontAscent] ifFalse:[super fontAscent] |
5ca4da2bb38c
Fixed baseline computation in CodeView2::GutterView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12244
diff
changeset
|
2563 |
|
5ca4da2bb38c
Fixed baseline computation in CodeView2::GutterView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12244
diff
changeset
|
2564 |
"Created: / 19-05-2012 / 14:13:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ca4da2bb38c
Fixed baseline computation in CodeView2::GutterView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12244
diff
changeset
|
2565 |
! |
5ca4da2bb38c
Fixed baseline computation in CodeView2::GutterView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12244
diff
changeset
|
2566 |
|
9985 | 2567 |
insertedLines |
2568 |
^ insertedLines |
|
2569 |
||
2570 |
"Modified: / 26-04-2010 / 21:48:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
2571 |
! |
|
2572 |
||
12262 | 2573 |
insertedLines:something |
2574 |
insertedLines := something. |
|
9985 | 2575 |
|
2576 |
"Modified: / 26-04-2010 / 21:48:59 / Jakub <zelenja7@fel.cvut.cz>" |
|
12262 | 2577 |
"Modified (format): / 17-07-2012 / 18:56:50 / cg" |
9985 | 2578 |
! |
2579 |
||
10245 | 2580 |
modifiedChannel: aValueHolder |
2581 |
||
2582 |
super modifiedChannel: aValueHolder |
|
2583 |
||
2584 |
"Created: / 07-07-2011 / 12:27:11 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
2585 |
! |
|
2586 |
||
9985 | 2587 |
originDiffText |
2588 |
^ originDiffText |
|
2589 |
! |
|
2590 |
||
2591 |
originDiffText:something |
|
2592 |
originDiffText := something. |
|
12125 | 2593 |
! |
2594 |
||
2595 |
reallyModified |
|
2596 |
||
2597 |
^self reallyModifiedChannel value |
|
2598 |
||
2599 |
"Created: / 07-10-2011 / 19:28:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 2600 |
! ! |
2601 |
||
12205 | 2602 |
!CodeView2::TextView methodsFor:'accessing-colors'! |
9985 | 2603 |
|
2604 |
colorChanged |
|
2605 |
^ Color redByte:240 greenByte: 192 blueByte: 192 |
|
2606 |
||
2607 |
"Modified: / 24-06-2010 / 14:05:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2608 |
! |
|
2609 |
||
2610 |
colorDeleted |
|
2611 |
^ self colorInserted. |
|
2612 |
"/^ Color pink |
|
2613 |
||
2614 |
"Modified: / 24-06-2010 / 14:16:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 2615 |
"Modified (format): / 07-10-2011 / 20:26:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12262 | 2616 |
"Modified (format): / 17-07-2012 / 18:57:14 / cg" |
9985 | 2617 |
! |
2618 |
||
2619 |
colorInserted |
|
2620 |
^ Color redByte: 239 greenByte: 225 blueByte: 152 |
|
2621 |
||
2622 |
"Modified: / 24-06-2010 / 14:13:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2623 |
! ! |
|
2624 |
||
12125 | 2625 |
!CodeView2::TextView methodsFor:'accessing-contents'! |
2626 |
||
2627 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings |
|
2628 |
||
2629 |
super list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings. |
|
2630 |
listOriginal := aCollection copy. |
|
2631 |
reallyModifiedChannel value: false. |
|
2632 |
self notifyLinesModifiedFrom: 1 to: list size. |
|
2633 |
||
2634 |
"Created: / 08-10-2011 / 12:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2635 |
! |
|
2636 |
||
2637 |
setList:aCollection expandTabs:expandTabs redraw:doRedraw |
|
2638 |
||
2639 |
super setList:aCollection expandTabs:expandTabs redraw:doRedraw. |
|
2640 |
listOriginal := aCollection copy. |
|
2641 |
reallyModifiedChannel value: false. |
|
2642 |
self notifyLinesModifiedFrom: 1 to: list size. |
|
2643 |
||
2644 |
"Created: / 07-10-2011 / 18:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2645 |
! ! |
|
2646 |
||
12198
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2647 |
!CodeView2::TextView methodsFor:'accessing-look'! |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2648 |
|
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2649 |
lineSpacing |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2650 |
|
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2651 |
^lineSpacing |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2652 |
|
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2653 |
"Modified: / 22-05-1996 / 12:22:29 / cg" |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2654 |
"Created: / 19-03-2012 / 13:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2655 |
! ! |
414e7b69ecda
Text/ChangeSet diff improved
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12194
diff
changeset
|
2656 |
|
12125 | 2657 |
!CodeView2::TextView methodsFor:'accessing-state'! |
2658 |
||
2659 |
beUnmodified |
|
2660 |
||
2661 |
self modifiedChannel value: false. |
|
2662 |
reallyModifiedChannel value: false. |
|
2663 |
listOriginal := list copy. |
|
2664 |
||
2665 |
"Created: / 08-10-2011 / 12:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2666 |
! |
|
2667 |
||
2668 |
isModified |
|
2669 |
||
2670 |
^self modified |
|
2671 |
||
2672 |
"Created: / 08-10-2011 / 12:52:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2673 |
! |
|
2674 |
||
2675 |
isReallyModified |
|
2676 |
||
2677 |
^self reallyModified |
|
2678 |
||
2679 |
"Created: / 08-10-2011 / 12:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2680 |
! ! |
|
2681 |
||
2682 |
!CodeView2::TextView methodsFor:'channels'! |
|
2683 |
||
2684 |
reallyModifiedChannel |
|
2685 |
||
2686 |
^ reallyModifiedChannel |
|
2687 |
||
2688 |
"Created: / 07-10-2011 / 18:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2689 |
! |
|
2690 |
||
2691 |
reallyModifiedChannel: aValueModel |
|
2692 |
||
2693 |
|prev| |
|
2694 |
||
2695 |
prev := reallyModifiedChannel. |
|
2696 |
prev notNil ifTrue:[ |
|
2697 |
gutterView notNil ifTrue:[ |
|
2698 |
reallyModifiedChannel removeDependent: gutterView. |
|
2699 |
] |
|
2700 |
]. |
|
2701 |
reallyModifiedChannel := aValueModel. |
|
2702 |
self setupChannel:aValueModel for:nil withOld:prev. |
|
2703 |
gutterView notNil ifTrue:[ |
|
2704 |
reallyModifiedChannel addDependent: gutterView. |
|
2705 |
] |
|
2706 |
||
2707 |
"Created: / 07-10-2011 / 18:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10781 | 2708 |
! ! |
2709 |
||
9985 | 2710 |
!CodeView2::TextView methodsFor:'drawing'! |
2711 |
||
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2712 |
backgroundForVisibleLine:visLineNr default:bg |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2713 |
| lineNr | |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2714 |
|
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2715 |
|
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2716 |
diffMode ifTrue:[ |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2717 |
lineNr := self visibleLineToListLine:visLineNr. |
12193
c0bdf75cfde5
Improvements in Diff3Tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12192
diff
changeset
|
2718 |
(insertedLines notEmptyOrNil and:[insertedLines includes:lineNr]) ifTrue:[ |
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2719 |
^self colorInserted |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2720 |
]. |
12193
c0bdf75cfde5
Improvements in Diff3Tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12192
diff
changeset
|
2721 |
(changedLines notEmptyOrNil and:[changedLines includes:lineNr]) ifTrue:[ |
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2722 |
^self colorChanged |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2723 |
]. |
12193
c0bdf75cfde5
Improvements in Diff3Tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12192
diff
changeset
|
2724 |
(deletedLines notEmptyOrNil and:[deletedLines includes:lineNr]) ifTrue:[ |
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2725 |
^self colorDeleted |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2726 |
]. |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2727 |
]. |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2728 |
^ bg |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2729 |
|
12193
c0bdf75cfde5
Improvements in Diff3Tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12192
diff
changeset
|
2730 |
"Modified: / 17-03-2012 / 12:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2731 |
! |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2732 |
|
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2733 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2734 |
"draw a visible line range in fg/bg" |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2735 |
|
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2736 |
diffMode ifFalse:[ |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2737 |
super drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg. |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2738 |
^self. |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2739 |
]. |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2740 |
|
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2741 |
startVisLineNr to: endVisLineNr do:[:visLineNr| |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2742 |
self drawVisibleLine: visLineNr with:fg and:bg |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2743 |
] |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2744 |
|
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2745 |
"Modified: / 15-12-1999 / 23:19:39 / cg" |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2746 |
"Created: / 17-03-2012 / 09:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2747 |
! |
2748 |
||
2749 |
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg |
|
2750 |
super |
|
2751 |
drawLine:line |
|
2752 |
fromX:x |
|
2753 |
inVisible:visLineNr |
|
2754 |
with:fg |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2755 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
9985 | 2756 |
|
2757 |
"Created: / 05-04-2010 / 12:07:07 / Jakub <zelenja7@fel.cvut.cz>" |
|
2758 |
"Modified: / 02-05-2010 / 18:46:00 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2759 |
"Modified: / 17-03-2012 / 10:05:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2760 |
! |
2761 |
||
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2762 |
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg |
9985 | 2763 |
super |
2764 |
drawLine:lineStringArg |
|
2765 |
inVisible:visLineNr |
|
2766 |
col:col |
|
2767 |
with:fg |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2768 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
9985 | 2769 |
|
2770 |
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>" |
|
2771 |
"Modified: / 02-05-2010 / 18:45:56 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2772 |
"Modified: / 17-03-2012 / 10:04:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2773 |
! |
2774 |
||
2775 |
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg |
|
2776 |
super |
|
2777 |
drawLine:lineStringArg |
|
2778 |
inVisible:visLineNr |
|
2779 |
from:startCol |
|
2780 |
to:endColOrNil |
|
2781 |
with:fg |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2782 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
9985 | 2783 |
|
2784 |
"Created: / 05-04-2010 / 11:54:54 / Jakub <zelenja7@fel.cvut.cz>" |
|
2785 |
"Modified: / 02-05-2010 / 18:45:52 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2786 |
"Modified: / 17-03-2012 / 10:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2787 |
! |
2788 |
||
2789 |
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg |
|
2790 |
super |
|
2791 |
drawLine:lineString |
|
2792 |
inVisible:visLineNr |
|
2793 |
from:startCol |
|
2794 |
with:fg |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2795 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
9985 | 2796 |
|
2797 |
"Created: / 05-04-2010 / 11:54:26 / Jakub <zelenja7@fel.cvut.cz>" |
|
2798 |
"Modified: / 02-05-2010 / 18:45:48 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2799 |
"Modified: / 17-03-2012 / 10:04:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2800 |
! |
2801 |
||
2802 |
drawVisibleLine:visLineNr with:fg and:bg |
|
2803 |
super |
|
2804 |
drawVisibleLine:visLineNr |
|
2805 |
with:fg |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2806 |
and:(self backgroundForVisibleLine:visLineNr default:bg). |
9985 | 2807 |
|
2808 |
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>" |
|
2809 |
"Modified: / 02-05-2010 / 18:45:44 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2810 |
"Modified: / 17-03-2012 / 10:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2811 |
! |
2812 |
||
2813 |
redrawLines |
|
2814 |
|i pom| |
|
2815 |
||
2816 |
diffMode ifFalse:[^self]. |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2817 |
true ifTrue:[^self]. |
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2818 |
|
9985 | 2819 |
|
2820 |
pom := self hasSelection. |
|
2821 |
(pom) ifTrue:[ ^ self. ]. |
|
2822 |
i := 1. |
|
2823 |
[ |
|
2824 |
i <= (deletedLines size) |
|
2825 |
] whileTrue:[ |
|
2826 |
((deletedLines at:i) > 0) ifTrue:[ |
|
2827 |
super |
|
2828 |
drawVisibleLine:(deletedLines at:i) |
|
2829 |
with:fgColor |
|
2830 |
and:self colorDeleted. |
|
2831 |
]. |
|
2832 |
i := i + 1. |
|
2833 |
]. |
|
2834 |
i := 1. |
|
2835 |
[ |
|
2836 |
i <= (insertedLines size) |
|
2837 |
] whileTrue:[ |
|
2838 |
((insertedLines at:i) > 0) ifTrue:[ |
|
2839 |
super |
|
2840 |
drawVisibleLine:(insertedLines at:i) |
|
2841 |
with:fgColor |
|
2842 |
and:self colorInserted. |
|
2843 |
]. |
|
2844 |
i := i + 1. |
|
2845 |
]. |
|
2846 |
i := 1. |
|
2847 |
[ |
|
2848 |
i <= (changedLines size) |
|
2849 |
] whileTrue:[ |
|
2850 |
((changedLines at:i) > 0) ifTrue:[ |
|
2851 |
super |
|
2852 |
drawVisibleLine:(changedLines at:i) |
|
2853 |
with:fgColor |
|
2854 |
and:self colorChanged. |
|
2855 |
]. |
|
2856 |
i := i + 1. |
|
2857 |
]. |
|
2858 |
||
2859 |
"Created: / 26-04-2010 / 21:04:31 / Jakub <zelenja7@fel.cvut.cz>" |
|
2860 |
"Modified: / 22-06-2010 / 23:28:30 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
2861 |
"Modified: / 17-03-2012 / 09:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 2862 |
! ! |
2863 |
||
2864 |
!CodeView2::TextView methodsFor:'editing'! |
|
2865 |
||
2866 |
contentsChanged |
|
2867 |
super contentsChanged. |
|
2868 |
" |
|
2869 |
codeView diffMode ifTrue:[ |
|
2870 |
changedDiffText ifTrue:[ |
|
2871 |
codeView recomputeDiff:self. |
|
2872 |
] ifFalse:[ |
|
2873 |
changedDiffText := true. |
|
2874 |
]. |
|
2875 |
] |
|
2876 |
" |
|
2877 |
||
2878 |
"Created: / 22-06-2010 / 23:13:24 / Jakub <zelenja7@fel.cvut.cz>" |
|
2879 |
"Modified: / 01-08-2010 / 20:33:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2880 |
! |
|
2881 |
||
12125 | 2882 |
deleteCharBeforeCursor |
2883 |
"delete single character to the left of cursor and move cursor to left" |
|
2884 |
||
2885 |
"BIG FAT WARNING: This method is copied from TextEditView, |
|
2886 |
the fix should be there, but someone smarter should review it |
|
2887 |
before the patch will be pushed up" |
|
2888 |
||
2889 |
|soCol wasOn lineNrAboveCursor ln prevTab| |
|
2890 |
||
2891 |
wasOn := self hideCursor. |
|
2892 |
"JV@2012-01-06: Do not play with autoindent iff cursor is at the very beggining of the line" |
|
2893 |
(autoIndent and:[cursorCol ~~ 1]) ifTrue:[ |
|
2894 |
prevTab := (self prevTabBefore:cursorCol) max:1. |
|
2895 |
"JV@2011-12-10: The list can be shorter that cursorLine, |
|
2896 |
trailing because empty lines are not physically in the list." |
|
2897 |
(list size >= cursorLine) ifTrue:[ |
|
2898 |
ln := (list at:cursorLine) ? ''. |
|
2899 |
] ifFalse:[ |
|
2900 |
ln := ''. |
|
2901 |
]. |
|
2902 |
ln size < prevTab ifTrue:[ |
|
2903 |
ln := ln , (String new:prevTab withAll:Character space). |
|
2904 |
]. |
|
2905 |
(ln copyTo:prevTab) isBlank ifTrue:[ |
|
2906 |
(ln copyFrom:prevTab+1) isBlank ifTrue:[ |
|
2907 |
cursorCol > prevTab ifTrue:[ |
|
2908 |
self cursorLine:cursorLine col:prevTab. |
|
2909 |
wasOn ifTrue:[ self showCursor ]. |
|
2910 |
^ self |
|
2911 |
]. |
|
2912 |
] ifFalse:[ |
|
2913 |
self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1. |
|
2914 |
self cursorLine:cursorLine col:prevTab. |
|
2915 |
wasOn ifTrue:[ self showCursor ]. |
|
2916 |
^ self. |
|
2917 |
] |
|
2918 |
]. |
|
2919 |
]. |
|
2920 |
||
2921 |
"/ (autoIndent |
|
2922 |
"/ and:[cursorCol ~~ 1 |
|
2923 |
"/ and:[cursorLine <= (list size)]]) |
|
2924 |
"/ ifTrue:[ |
|
2925 |
"/ soCol := (self leftIndentForLine:cursorLine) + 1. |
|
2926 |
"/ |
|
2927 |
"/ (cursorCol == soCol and:[soCol > 1]) ifTrue:[ |
|
2928 |
"/ ln := list at:cursorLine. |
|
2929 |
"/ (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[ |
|
2930 |
"/ soCol := 1 |
|
2931 |
"/ ] |
|
2932 |
"/ ] |
|
2933 |
"/ ] ifFalse:[ |
|
2934 |
soCol := 1. |
|
2935 |
"/ ]. |
|
2936 |
||
2937 |
(cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[ |
|
2938 |
" |
|
2939 |
somewhere in the middle of a line |
|
2940 |
" |
|
2941 |
self cursorLeft. |
|
2942 |
self deleteCharAtLine:cursorLine col:cursorCol. |
|
2943 |
] ifFalse:[ |
|
2944 |
" |
|
2945 |
at begin of line - merge with previous line; |
|
2946 |
except for the very first line. |
|
2947 |
" |
|
2948 |
(cursorLine == 1) ifFalse:[ |
|
2949 |
lineNrAboveCursor := self validateCursorLine:(cursorLine - 1). |
|
2950 |
lineNrAboveCursor < cursorLine ifTrue:[ |
|
2951 |
(lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[ |
|
2952 |
"/ we are beyond the end of the text. |
|
2953 |
"/ move the cursor to the previous line. |
|
2954 |
self cursorLine:lineNrAboveCursor col:1. |
|
2955 |
] ifFalse:[ |
|
2956 |
self mergeLine:lineNrAboveCursor removeBlanks:false. |
|
2957 |
] |
|
2958 |
] |
|
2959 |
] |
|
2960 |
]. |
|
2961 |
wasOn ifTrue:[ self showCursor ] |
|
2962 |
||
2963 |
"Modified: / 16-01-1998 / 22:33:04 / cg" |
|
2964 |
"Modified: / 06-01-2012 / 12:42:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2965 |
! |
|
2966 |
||
9985 | 2967 |
getNewOriginText |
2968 |
|i size pole pom text helperText| |
|
2969 |
||
2970 |
i := 1. |
|
2971 |
pole := list. |
|
2972 |
size := list size. |
|
2973 |
text:=''. |
|
12125 | 2974 |
emptyLines isNil ifTrue:[emptyLines := #()]. |
9985 | 2975 |
[ i <= size ] whileTrue:[ |
2976 |
pom := emptyLines indexOf:i. |
|
2977 |
(pom = 0) ifFalse:[ |
|
2978 |
helperText := pole at:i. |
|
2979 |
(helperText = '') ifFalse:[ |
|
2980 |
(helperText isNil)ifTrue:[helperText:='']. |
|
2981 |
helperText:=helperText,Character cr. |
|
2982 |
text := text asString , helperText asString. |
|
2983 |
]. |
|
2984 |
] ifTrue:[ |
|
2985 |
helperText := pole at:i. |
|
2986 |
(helperText isNil)ifTrue:[helperText:='']. |
|
2987 |
helperText:=helperText,Character cr. |
|
2988 |
text := text asString , helperText asString. |
|
2989 |
]. |
|
2990 |
i:=i+1. |
|
2991 |
]. |
|
2992 |
^text |
|
2993 |
||
2994 |
"Created: / 22-06-2010 / 22:33:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
2995 |
"Modified: / 24-06-2010 / 14:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 2996 |
"Modified: / 18-11-2011 / 14:58:22 / cg" |
9985 | 2997 |
! ! |
2998 |
||
2999 |
!CodeView2::TextView methodsFor:'editing-basic'! |
|
3000 |
||
12125 | 3001 |
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3002 |
"delete characters from startCol to endCol in line lineNr" |
|
3003 |
||
3004 |
super basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol. |
|
3005 |
self notifyLinesModifiedFrom: lineNr to: lineNr. |
|
3006 |
||
3007 |
"Created: / 16-09-2011 / 15:13:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3008 |
! |
|
3009 |
||
3010 |
basicDeleteFromLine:startLineNr toLine:endLineNr |
|
3011 |
||
3012 |
super basicDeleteFromLine:startLineNr toLine:endLineNr. |
|
3013 |
self notifyLinesDeletedFrom:startLineNr to:endLineNr. |
|
9985 | 3014 |
|
3015 |
"Created: / 28-06-2011 / 09:09:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3016 |
! |
|
3017 |
||
3018 |
basicDeleteLineWithoutRedraw:lineNr |
|
3019 |
||
12125 | 3020 |
super basicDeleteLineWithoutRedraw:lineNr. |
3021 |
self notifyLinesDeletedFrom: lineNr to: lineNr. |
|
9985 | 3022 |
|
3023 |
"Created: / 28-06-2011 / 09:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3024 |
! |
|
3025 |
||
12125 | 3026 |
basicInsert:aCharacter atLine:lineNr col:colNr |
3027 |
"insert a single character at lineNr/colNr; |
|
3028 |
set emphasis to character at current position" |
|
3029 |
||
3030 |
super basicInsert:aCharacter atLine:lineNr col:colNr. |
|
3031 |
self notifyLinesModifiedFrom: lineNr to: lineNr. |
|
3032 |
||
3033 |
"Created: / 16-09-2011 / 15:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3034 |
! |
|
3035 |
||
9985 | 3036 |
basicMergeLine:lineNr removeBlanks:removeBlanks |
3037 |
||
12125 | 3038 |
super basicMergeLine:lineNr removeBlanks:removeBlanks. |
9985 | 3039 |
self notifyLinesDeletedFrom: lineNr + 1 to: lineNr + 1. |
3040 |
||
3041 |
"Created: / 28-06-2011 / 09:13:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3042 |
! |
|
3043 |
||
3044 |
basicSplitLine:lineNr before:colNr |
|
3045 |
||
12125 | 3046 |
super basicSplitLine:lineNr before:colNr. |
3047 |
self notifyLinesInsertedFrom: lineNr +1 to: lineNr + 1. |
|
9985 | 3048 |
|
3049 |
"Created: / 28-06-2011 / 09:14:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 3050 |
! |
3051 |
||
3052 |
insertLines:someText from:start to:end before:lineNr |
|
3053 |
||
3054 |
"/JV@2011-12-20: HACK, the super implementation should |
|
3055 |
"/not use leftIndent...when pasting. Following is a workaround" |
|
3056 |
| wasAutoIndent | |
|
3057 |
||
3058 |
wasAutoIndent := autoIndent. |
|
3059 |
autoIndent := false. |
|
3060 |
super insertLines:someText from:start to:end before:lineNr. |
|
3061 |
autoIndent := wasAutoIndent |
|
3062 |
||
3063 |
"Created: / 20-12-2011 / 15:32:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3064 |
! ! |
3065 |
||
3066 |
!CodeView2::TextView methodsFor:'event handling'! |
|
3067 |
||
3068 |
buttonMotion:button x:x y:y |
|
3069 |
||
3070 |
(codeView buttonMotion:button x:x y:y in: self) |
|
3071 |
ifFalse:[super buttonMotion:button x:x y:y]. |
|
3072 |
||
3073 |
"Created: / 14-02-2010 / 16:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3074 |
"Modified: / 06-03-2010 / 20:10:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3075 |
! |
|
3076 |
||
3077 |
buttonPress: button x: x y: y |
|
3078 |
| ctrlDown | |
|
3079 |
||
3080 |
(codeView buttonPress:button x:x y:y in: self) |
|
3081 |
ifFalse:[super buttonPress:button x:x y:y]. |
|
3082 |
" |
|
3083 |
((ctrlDown := self sensor ctrlDown) and: [ codeView syntaxElementSelection notNil]) |
|
3084 |
ifTrue: [codeView buttonPressInTextView: button x:x y:y ctrlDown: ctrlDown]. |
|
3085 |
super |
|
3086 |
buttonPress: button |
|
3087 |
x: x |
|
3088 |
y: y |
|
3089 |
" |
|
3090 |
||
3091 |
"Created: / 14-02-2010 / 18:12:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3092 |
"Modified: / 06-03-2010 / 20:37:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3093 |
! |
|
3094 |
||
3095 |
exposeX:x y:y width:w height:h |
|
3096 |
super |
|
3097 |
exposeX:x |
|
3098 |
y:y |
|
3099 |
width:w |
|
3100 |
height:h. |
|
3101 |
self redrawLines. |
|
3102 |
||
3103 |
"Created: / 05-04-2010 / 10:07:50 / Jakub <zelenja7@fel.cvut.cz>" |
|
3104 |
"Modified: / 02-05-2010 / 18:41:07 / Jakub <zelenja7@fel.cvut.cz>" |
|
3105 |
! |
|
3106 |
||
3107 |
keyPress:key x:x y:y |
|
3108 |
(codeView keyPress:key x:x y:y in: self) |
|
3109 |
ifFalse:[super keyPress:key x:x y:y]. |
|
3110 |
||
3111 |
"Modified: / 06-03-2010 / 20:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3112 |
"Modified: / 05-04-2010 / 09:55:52 / Jakub <zelenja7@fel.cvut.cz>" |
|
3113 |
! |
|
3114 |
||
3115 |
keyRelease: key x: x y: y |
|
3116 |
||
3117 |
(codeView keyRelease:key x:x y:y in: self) |
|
3118 |
ifFalse:[super keyRelease:key x:x y:y]. |
|
3119 |
" |
|
3120 |
(key = #Control_L) ifTrue: |
|
3121 |
[ codeView highlightClear. self redraw ]. |
|
3122 |
||
3123 |
^ super |
|
3124 |
keyRelease: key |
|
3125 |
x: x |
|
3126 |
y: y |
|
3127 |
" |
|
3128 |
||
3129 |
"Created: / 14-02-2010 / 16:38:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3130 |
"Modified: / 06-03-2010 / 21:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3131 |
! ! |
|
3132 |
||
12125 | 3133 |
!CodeView2::TextView methodsFor:'formatting'! |
3134 |
||
3135 |
leftIndentForLine:lineNr |
|
3136 |
||
3137 |
| lang | |
|
3138 |
lang := codeView language. |
|
3139 |
"Bit hacky here, should ask language some language toolbox |
|
3140 |
for formatting helper, that should do it..." |
|
3141 |
(lang notNil and:[lang isSmalltalk]) ifTrue:[ |
|
3142 |
| line lineNo indent | |
|
3143 |
lineNo := lineNr. |
|
3144 |
[lineNo ~~ 1] whileTrue:[ |
|
3145 |
lineNo := lineNo - 1. |
|
3146 |
line := self listAt:lineNo. |
|
3147 |
||
3148 |
line notNil ifTrue:[ |
|
3149 |
indent := line indexOfNonSeparatorStartingAt:1. |
|
3150 |
"beggining od block" |
|
3151 |
line notEmptyOrNil ifTrue:[ |
|
3152 |
line last == $[ ifTrue:[ |
|
3153 |
indent := indent + 4. |
|
3154 |
] ifFalse:[ |
|
3155 |
"end of block args" |
|
3156 |
(line last == $| and: [line includes: $[]) ifTrue:[ |
|
3157 |
indent := indent + 4. |
|
3158 |
] |
|
3159 |
]. |
|
3160 |
]. |
|
3161 |
indent ~~ 0 ifTrue:[ |
|
3162 |
^ indent - 1 |
|
3163 |
] |
|
3164 |
] |
|
3165 |
]. |
|
3166 |
^0. |
|
3167 |
]. |
|
3168 |
^super leftIndentForLine:lineNr |
|
3169 |
||
3170 |
"Created: / 10-12-2011 / 11:02:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3171 |
! ! |
|
3172 |
||
9985 | 3173 |
!CodeView2::TextView methodsFor:'initialization'! |
3174 |
||
3175 |
initialize |
|
3176 |
||
3177 |
super initialize. |
|
3178 |
||
3179 |
changedDiffText := true. |
|
3180 |
diffMode := false. |
|
10224 | 3181 |
suppressNotifications := false. |
10523 | 3182 |
autoIndent := UserPreferences current codeView2AutoIndent. |
12125 | 3183 |
reallyModifiedChannel := false asValue. |
3184 |
||
3185 |
self enableMotionEvents. |
|
10630
d59bc761de55
fixed: #sendersMenu:selector:
Claus Gittinger <cg@exept.de>
parents:
10577
diff
changeset
|
3186 |
|
9985 | 3187 |
"Created: / 23-06-2010 / 17:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3188 |
"Modified: / 06-07-2011 / 17:46:31 / jv" |
12125 | 3189 |
"Modified: / 21-08-2011 / 10:09:29 / cg" |
3190 |
"Modified: / 07-10-2011 / 19:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3191 |
! |
3192 |
||
3193 |
setCodeView: aCodeView2 |
|
3194 |
||
3195 |
codeView := aCodeView2. |
|
3196 |
codeView addDependent: self. |
|
3197 |
gutterView := aCodeView2 gutterView. |
|
3198 |
||
3199 |
"Created: / 14-02-2010 / 15:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3200 |
"Modified: / 17-06-2011 / 12:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3201 |
! |
|
3202 |
||
3203 |
setGutterView: aGutterView |
|
3204 |
||
3205 |
self assert: gutterView isNil message:'Attempting to set gutterView twice'. |
|
3206 |
gutterView := aGutterView. |
|
3207 |
gutterView setTextView: self. |
|
3208 |
||
3209 |
"Created: / 02-09-2009 / 21:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3210 |
! ! |
|
3211 |
||
3212 |
!CodeView2::TextView methodsFor:'menu & menu actions'! |
|
3213 |
||
12125 | 3214 |
accept |
3215 |
||
3216 |
super accept. |
|
3217 |
reallyModifiedChannel value: false. |
|
3218 |
listOriginal := list copy. |
|
3219 |
||
3220 |
"Created: / 07-10-2011 / 19:36:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3221 |
! |
|
3222 |
||
3223 |
cancel |
|
3224 |
||
3225 |
self list: listOriginal |
|
3226 |
||
3227 |
"Created: / 08-02-2010 / 09:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3228 |
! |
|
3229 |
||
9985 | 3230 |
editMenu |
3231 |
||
12205 | 3232 |
^ codeView editMenu |
9985 | 3233 |
|
3234 |
"Created: / 14-02-2010 / 15:49:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12205 | 3235 |
"Modified (format): / 08-03-2012 / 12:30:22 / cg" |
3236 |
! |
|
3237 |
||
3238 |
searchVariableVisible |
|
3239 |
"search variable option in searchbox visible?" |
|
3240 |
||
3241 |
^ true |
|
3242 |
||
3243 |
"Created: / 08-03-2012 / 14:01:51 / cg" |
|
3244 |
! |
|
3245 |
||
3246 |
syntaxElementAtPosition:position |
|
3247 |
"if there is a syntax element for a variable under the cursor? |
|
3248 |
If so, return the element; otherwise, return nil" |
|
3249 |
||
3250 |
|syntaxElements el element| |
|
3251 |
||
3252 |
syntaxElements := codeView syntaxElements. |
|
3253 |
syntaxElements isEmptyOrNil ifTrue:[^ nil]. |
|
3254 |
el := syntaxElements detect:[:el | position between:el start and:el stop] ifNone:nil. |
|
3255 |
el isNil ifTrue:[^ nil]. |
|
3256 |
element := 1234. |
|
3257 |
^ el. |
|
3258 |
||
3259 |
"Created: / 08-03-2012 / 14:21:52 / cg" |
|
3260 |
! |
|
3261 |
||
3262 |
syntaxElementForSelectedVariable |
|
3263 |
"if there is a syntax element for a variable under the cursor? |
|
3264 |
If so, return the element; otherwise, return nil" |
|
3265 |
||
3266 |
|element startPosition endPosition| |
|
3267 |
||
3268 |
self selectionAsString isEmptyOrNil ifTrue:[^ nil]. |
|
3269 |
startPosition := self characterPositionOfLine:selectionStartLine col:selectionStartCol. |
|
3270 |
endPosition := self characterPositionOfLine:selectionEndLine col:selectionEndCol. |
|
3271 |
element := self syntaxElementAtPosition:startPosition. |
|
3272 |
element isNil ifTrue:[^ nil]. |
|
3273 |
(element start = startPosition and:[element stop = endPosition]) ifFalse:[^ nil]. |
|
3274 |
||
3275 |
element isNil ifTrue:[^ nil]. |
|
3276 |
element isVariableOrSelf ifFalse:[^ nil]. |
|
3277 |
^ element |
|
3278 |
||
3279 |
"Created: / 08-03-2012 / 14:21:15 / cg" |
|
3280 |
! |
|
3281 |
||
3282 |
syntaxElementForVariableUnderCursor |
|
3283 |
"if there is a syntax element for a variable under the cursor? |
|
3284 |
If so, return the element; otherwise, return nil" |
|
3285 |
||
3286 |
|elementUnderCursor | |
|
3287 |
||
3288 |
elementUnderCursor := self syntaxElementAtPosition:(self characterPositionOfCursor). |
|
3289 |
elementUnderCursor isNil ifTrue:[^ nil]. |
|
3290 |
elementUnderCursor isVariableOrSelf ifFalse:[^ nil]. |
|
3291 |
^ elementUnderCursor. |
|
3292 |
||
3293 |
"Created: / 08-03-2012 / 12:44:03 / cg" |
|
9985 | 3294 |
! ! |
3295 |
||
3296 |
!CodeView2::TextView methodsFor:'notification'! |
|
3297 |
||
3298 |
notifyLinesDeletedFrom: startLine to: endLine |
|
3299 |
||
12125 | 3300 |
self updateReallyModified. |
10224 | 3301 |
suppressNotifications ifTrue:[^self]. |
3302 |
codeView linesDeletedFrom: startLine to: endLine. |
|
3303 |
suppressNotifications := true. |
|
3304 |
||
9985 | 3305 |
"Created: / 28-06-2011 / 09:12:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3306 |
"Modified: / 06-07-2011 / 17:47:05 / jv" |
12125 | 3307 |
"Modified: / 07-10-2011 / 19:20:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9985 | 3308 |
! |
3309 |
||
3310 |
notifyLinesInsertedFrom: startLine to: endLine |
|
3311 |
||
12125 | 3312 |
self updateReallyModified. |
10224 | 3313 |
suppressNotifications ifTrue:[^self]. |
3314 |
codeView linesInsertedFrom: startLine to: endLine. |
|
3315 |
suppressNotifications := true. |
|
3316 |
||
9985 | 3317 |
"Created: / 28-06-2011 / 09:12:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10224 | 3318 |
"Modified: / 06-07-2011 / 17:47:20 / jv" |
12125 | 3319 |
"Modified: / 07-10-2011 / 19:20:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3320 |
! |
|
3321 |
||
3322 |
notifyLinesModifiedFrom: startLine to: endLine |
|
3323 |
||
3324 |
self updateReallyModified. |
|
3325 |
suppressNotifications ifTrue:[^self]. |
|
3326 |
codeView linesModifiedFrom: startLine to: endLine. |
|
3327 |
suppressNotifications := true. |
|
3328 |
||
3329 |
"Modified: / 06-07-2011 / 17:47:20 / jv" |
|
3330 |
"Created: / 16-09-2011 / 15:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3331 |
! ! |
3332 |
||
3333 |
!CodeView2::TextView methodsFor:'private'! |
|
3334 |
||
3335 |
superEditMenu |
|
3336 |
||
3337 |
^super editMenu |
|
3338 |
||
3339 |
"Created: / 14-02-2010 / 15:48:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 3340 |
! |
3341 |
||
3342 |
updateReallyModified |
|
3343 |
"check for modified code by comparing the source against |
|
3344 |
the codeViews contents. |
|
3345 |
Thats the true modified value (in case user undid its changes, |
|
3346 |
and the displayed text is actually original" |
|
3347 |
||
3348 |
|modified changedSource originalSource| |
|
3349 |
||
3350 |
reallyModifiedChannel isNil ifTrue:[^self]. |
|
3351 |
"JV@2011-10-27: Idea is not to do anything if nobody is |
|
3352 |
interested. Not sure if it is a good idea, thought." |
|
3353 |
reallyModifiedChannel dependents isEmptyOrNil ifTrue:[^self]. |
|
3354 |
||
3355 |
"/ higher prio to prevent it from being changed while we convert it (by editing) |
|
3356 |
||
3357 |
modified := false. |
|
3358 |
||
3359 |
list size ~~ listOriginal size ifTrue:[ |
|
3360 |
modified := true. |
|
3361 |
] ifFalse:[ |
|
3362 |
changedSource := list ? #(). |
|
3363 |
changedSource := changedSource collect:[:line | line isEmptyOrNil ifTrue:[nil] ifFalse:[line]]. |
|
3364 |
[changedSource size > 0 and:[changedSource last isNil]] whileTrue:[ |
|
3365 |
changedSource := changedSource removeLast. |
|
3366 |
]. |
|
3367 |
||
3368 |
originalSource := listOriginal ? #() "self model value ? ''". |
|
3369 |
originalSource := originalSource collect:[:line | line isEmptyOrNil ifTrue:[nil] ifFalse:[line]]. |
|
3370 |
[originalSource size > 0 and:[originalSource last isNil]] whileTrue:[ |
|
3371 |
originalSource := originalSource removeLast |
|
3372 |
]. |
|
3373 |
originalSource size ~~ changedSource size ifTrue:[ |
|
3374 |
modified := true. |
|
3375 |
] ifFalse:[ |
|
3376 |
| i s | |
|
3377 |
i := 1. |
|
3378 |
s := originalSource size + 1. |
|
3379 |
[ modified not and:[ i < s ] ] whileTrue:[ |
|
3380 |
| originalL changedL | |
|
3381 |
||
3382 |
originalL := ((originalSource at: i) ? '') string. |
|
3383 |
changedL := ((changedSource at: i) ? '') string. |
|
3384 |
originalL ~= changedL ifTrue:[ |
|
3385 |
originalL withoutTrailingSeparators ~= changedL withoutTrailingSeparators ifTrue:[ |
|
3386 |
modified := true. |
|
3387 |
] |
|
3388 |
]. |
|
3389 |
i := i + 1. |
|
3390 |
] |
|
3391 |
] |
|
3392 |
]. |
|
3393 |
||
3394 |
reallyModifiedChannel value: modified |
|
3395 |
||
3396 |
"Created: / 07-10-2011 / 19:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3397 |
"Modified: / 08-10-2011 / 11:10:01 / cg" |
|
3398 |
"Modified: / 28-10-2011 / 09:23:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3399 |
! ! |
3400 |
||
3401 |
!CodeView2::TextView methodsFor:'scrolling'! |
|
3402 |
||
12199 | 3403 |
basicScrollTo:anOrigin redraw:doRedraw |
3404 |
super scrollTo:anOrigin redraw:doRedraw |
|
3405 |
||
3406 |
"Modified: / 06-04-2010 / 14:05:40 / Jakub <zelenja7@fel.cvut.cz>" |
|
3407 |
"Modified: / 17-03-2012 / 10:06:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3408 |
"Created: / 19-03-2012 / 17:01:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9985 | 3409 |
! |
3410 |
||
3411 |
originChanged:delta |
|
3412 |
||
3413 |
super originChanged:delta. |
|
3414 |
||
3415 |
gutterView invalidate. |
|
3416 |
||
3417 |
"Created: / 07-12-2009 / 21:50:49 / Jindra <a>" |
|
3418 |
! |
|
3419 |
||
12199 | 3420 |
scrollTo:anOrigin redraw:doRedraw |
3421 |
||
3422 |
codeView scrollTo:anOrigin redraw:doRedraw in: self. |
|
3423 |
self basicScrollTo:anOrigin redraw:doRedraw |
|
9985 | 3424 |
|
3425 |
"Modified: / 06-04-2010 / 14:04:28 / Jakub <zelenja7@fel.cvut.cz>" |
|
12192
15f47901fb64
Fixes in Diff2/Diff3 text views
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12171
diff
changeset
|
3426 |
"Modified: / 17-03-2012 / 10:06:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12199 | 3427 |
"Created: / 19-03-2012 / 17:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12269
79f87eee62e5
ChangeSetBrowser2 improvements:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12265
diff
changeset
|
3428 |
! ! |
9985 | 3429 |
|
10224 | 3430 |
!CodeView2::TextView methodsFor:'undo & again'! |
3431 |
||
3432 |
nonUndoableDo: aBlock |
|
3433 |
||
3434 |
super nonUndoableDo: aBlock. |
|
3435 |
suppressNotifications := false. |
|
3436 |
||
3437 |
"Created: / 06-07-2011 / 17:48:27 / jv" |
|
3438 |
! |
|
3439 |
||
3440 |
undoableDo: aBlock info: into |
|
3441 |
||
3442 |
super undoableDo: aBlock info: into. |
|
3443 |
suppressNotifications := false. |
|
3444 |
||
3445 |
"Created: / 06-07-2011 / 17:48:49 / jv" |
|
3446 |
! ! |
|
3447 |
||
9985 | 3448 |
!CodeView2 class methodsFor:'documentation'! |
3449 |
||
10293 | 3450 |
version |
12287 | 3451 |
^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.65 2012/08/23 12:25:31 cg Exp $' |
10293 | 3452 |
! |
3453 |
||
9985 | 3454 |
version_CVS |
12287 | 3455 |
^ '§Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.65 2012/08/23 12:25:31 cg Exp §' |
9985 | 3456 |
! |
3457 |
||
3458 |
version_SVN |
|
12287 | 3459 |
^ '$Id: Tools__CodeView2.st 8048 2012-09-07 17:28:09Z vranyj1 $' |
9985 | 3460 |
! ! |
3461 |
||
12125 | 3462 |
CodeView2 initialize! |