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