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