author | Claus Gittinger <cg@exept.de> |
Thu, 17 Dec 2015 19:33:22 +0100 | |
changeset 5524 | 56e7888d6438 |
parent 5509 | b5286dea20fa |
child 5697 | 41f084492b81 |
permissions | -rw-r--r-- |
4788 | 1 |
"{ Package: 'stx:libwidg' }" |
2 |
||
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
3 |
"{ NameSpace: Smalltalk }" |
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
4 |
|
4788 | 5 |
Object subclass:#EditTextViewCompletionSupport |
6 |
instanceVariableNames:'completionView completionProcess editView autoSelect' |
|
7 |
classVariableNames:'LastCompletions' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'Views-Text' |
|
10 |
! |
|
11 |
||
12 |
!EditTextViewCompletionSupport class methodsFor:'documentation'! |
|
13 |
||
14 |
documentation |
|
15 |
" |
|
16 |
An abstract supperclass to support completion in text views. |
|
17 |
Individual completion engines may create a subclass of |
|
18 |
EditTextCompletionSupport and customize it. |
|
19 |
||
20 |
Basucally, they have to implement #computeCompletions |
|
21 |
||
22 |
[author:] |
|
23 |
Claus Gittinger |
|
24 |
||
25 |
[instance variables:] |
|
26 |
||
27 |
[class variables:] |
|
28 |
||
29 |
[see also:] |
|
30 |
||
31 |
" |
|
32 |
! ! |
|
33 |
||
34 |
!EditTextViewCompletionSupport class methodsFor:'instance creation'! |
|
35 |
||
36 |
for:anEditView |
|
37 |
^ self new editView:anEditView |
|
38 |
! ! |
|
39 |
||
40 |
!EditTextViewCompletionSupport class methodsFor:'queries'! |
|
41 |
||
42 |
isAbstract |
|
5509 | 43 |
^ self == EditTextViewCompletionSupport |
4788 | 44 |
|
45 |
"Created: / 26-09-2013 / 16:22:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
46 |
! ! |
|
47 |
||
48 |
!EditTextViewCompletionSupport methodsFor:'accessing'! |
|
49 |
||
50 |
editView:anEditTextView |
|
51 |
editView := anEditTextView. |
|
52 |
! ! |
|
53 |
||
54 |
!EditTextViewCompletionSupport methodsFor:'events'! |
|
55 |
||
56 |
buttonPress:button x:x y:y |
|
57 |
self closeCompletionView. |
|
58 |
! |
|
59 |
||
60 |
editViewLostFocus |
|
61 |
completionView notNil ifTrue:[ |
|
4808
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
62 |
"/ this is a hack for Windows: |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
63 |
"/ on windows, an activate:false event is first sent to my textView, |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
64 |
"/ then an activate is sent to the completion popup. |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
65 |
"/ this is done BEFORE the buttonPress event is delivered. |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
66 |
"/ therefore, allow for the activate of the completionMenu and it's button event to be processed. |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
67 |
"/ before forcing it to be closed... |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
68 |
editView graphicsDevice anyButtonPressed ifTrue:[ |
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
69 |
editView sensor pushUserEvent:#editViewLostFocus for:self. |
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
70 |
] ifFalse:[ |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
71 |
self closeCompletionView |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
72 |
] |
4808
b37597d2df93
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4805
diff
changeset
|
73 |
]. |
4788 | 74 |
! |
75 |
||
76 |
handleKeyPress:key x:x y:y |
|
77 |
"return true, if I have eaten this keypress" |
|
78 |
||
5064
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
79 |
|ch completeImmediate eatCursorLeftOrRight eatCursorUpDown| |
4788 | 80 |
|
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
81 |
"/ completeImmediate := UserPreferences current immediateCodeCompletion. |
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
82 |
|
4788 | 83 |
"/ open on CTRL- or TAB-key? |
84 |
(completionView isNil or:[completionView realized not]) ifTrue:[ |
|
85 |
editView hasSelection ifFalse:[ |
|
86 |
((ch := editView characterBeforeCursor) notNil "/ i.e. not at begin of line |
|
5411
fa4c9122e6ef
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5410
diff
changeset
|
87 |
and:[ ch isLetterOrDigit or:[ ch == $_ ] ]) ifTrue:[ |
4788 | 88 |
(key == #Control_L or:[ key == #Ctrl or:[ key == #Control_R or:[ key == #Control]]]) ifTrue:[ |
89 |
UserPreferences current codeCompletionOnControlKey ifTrue:[ |
|
90 |
autoSelect := true. |
|
91 |
self updateCompletionList |
|
92 |
] |
|
93 |
]. |
|
4805
dd3fd2a4f3e9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4788
diff
changeset
|
94 |
((key == #Tab) and:[editView sensor shiftDown not]) ifTrue:[ |
4788 | 95 |
UserPreferences current codeCompletionOnTabKey ifTrue:[ |
96 |
autoSelect := true. |
|
97 |
self updateCompletionList. |
|
98 |
^ true |
|
99 |
]. |
|
100 |
] |
|
101 |
]. |
|
102 |
]. |
|
103 |
^ false. |
|
104 |
]. |
|
105 |
||
106 |
"/ key for completion view ? (careful: do not forward too many, it would disturb user's typing) |
|
107 |
key isCharacter ifFalse:[ |
|
108 |
"/ forward to menu |
|
109 |
(completionView notNil) ifTrue:[ |
|
5064
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
110 |
"/never |
4788 | 111 |
eatCursorLeftOrRight := false. |
112 |
"/ completeImmediate not |
|
113 |
"/ or:[ editView sensor shiftDown |
|
114 |
"/ or:[ editView sensor ctrlDown ]]. |
|
5064
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
115 |
"/ only with shift or ctrl |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
116 |
eatCursorUpDown := |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
117 |
(UserPreferences current codeCompletionViewKeyboardNavigationNeedsModifier not) |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
118 |
or:[ editView sensor shiftDown |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
119 |
or:[editView sensor ctrlDown]]. |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
120 |
|
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
121 |
((key == #CursorDown and:[eatCursorUpDown]) |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
122 |
or:[ (key == #CursorUp and:[eatCursorUpDown]) |
4788 | 123 |
or:[ ((key == #CursorLeft) and:[eatCursorLeftOrRight]) |
124 |
or:[ ((key == #CursorRight) and:[eatCursorLeftOrRight]) |
|
125 |
or:[ ((key == #Return) and:[ completionView hasSelection ]) |
|
126 |
]]]]) ifTrue:[ |
|
5064
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
127 |
"/ forward to completion view |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
128 |
completionView sensor pushUserEvent:#value for:[ completionView keyPress:key x:0 y:0 ]. |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
129 |
^ true. |
4788 | 130 |
]. |
131 |
||
132 |
(key == #Control_L or:[ key == #Control_R or:[ key == #Control or:[ key == #Ctrl ]]]) ifTrue:[ |
|
133 |
"/ CTRL is a toggle |
|
5064
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
134 |
"/ self closeCompletionView. |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
135 |
"/ ^ true. |
55e4260c1ea1
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5033
diff
changeset
|
136 |
^ false "/ don't eat |
4788 | 137 |
]. |
138 |
(key == #Escape) ifTrue:[ |
|
139 |
self closeCompletionView. |
|
140 |
^ true "/ EAT |
|
141 |
]. |
|
142 |
"/ shift does not close |
|
143 |
(key == #Shift_L or:[ key == #Shift_R or:[ key == #Shift]]) ifTrue:[ |
|
144 |
^ false "/ don' eat |
|
145 |
]. |
|
146 |
||
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
147 |
(key == #BackSpace) ifTrue:[ |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
148 |
^ false "/ don' eat |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
149 |
]. |
4788 | 150 |
self closeCompletionView. |
151 |
^ false "/ don' eat |
|
152 |
]. |
|
153 |
]. |
|
154 |
^ false. |
|
155 |
! |
|
156 |
||
157 |
postKeyPress:key |
|
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
158 |
|doComplete| |
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
159 |
|
4788 | 160 |
UserPreferences current immediateCodeCompletion ifFalse:[ |
161 |
"/ only update, if already open |
|
162 |
completionView isNil ifTrue:[^ self]. |
|
163 |
]. |
|
164 |
||
165 |
(key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[ |
|
166 |
autoSelect := false. |
|
167 |
self updateCompletionList. |
|
168 |
^ self |
|
169 |
]. |
|
170 |
||
171 |
key isCharacter ifTrue:[ |
|
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
172 |
(doComplete := key isSeparator not) ifFalse:[ |
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
173 |
"/ also on a separator, but only if at the end of a non-empty line |
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
174 |
doComplete := editView lineStringBeforeCursor withoutSeparators notEmpty. |
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
175 |
]. |
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
176 |
doComplete ifFalse:[ |
4788 | 177 |
self closeCompletionView |
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
178 |
] ifTrue:[ |
4788 | 179 |
autoSelect := false. |
180 |
self updateCompletionList. |
|
181 |
]. |
|
182 |
^ self |
|
183 |
]. |
|
184 |
! ! |
|
185 |
||
186 |
!EditTextViewCompletionSupport methodsFor:'private'! |
|
187 |
||
4824
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
188 |
computeCompletions |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
189 |
"Actually compute the completions and update the completion view." |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
190 |
|
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
191 |
self subclassResponsibility |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
192 |
|
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
193 |
"Created: / 26-09-2013 / 17:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
194 |
! |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
195 |
|
4788 | 196 |
release |
197 |
self stopCompletionProcess. |
|
198 |
self closeCompletionView. |
|
199 |
super release |
|
200 |
! |
|
201 |
||
202 |
startCompletionProcess |
|
203 |
"start the code completion process in the background" |
|
204 |
||
205 |
|initialList cursorX cursorY| |
|
206 |
||
207 |
"/ terminate any previous process |
|
208 |
self stopCompletionProcess. |
|
209 |
||
210 |
(editView sensor hasKeyPressEventFor:nil) ifTrue:[ |
|
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
211 |
"/ 'cl' printCR. |
4788 | 212 |
self closeCompletionView. |
213 |
^ self |
|
214 |
]. |
|
215 |
((cursorX := editView xOfCursor) isNil |
|
216 |
or:[ (cursorY := editView yOfCursor) isNil ]) ifTrue:[ |
|
217 |
"/ no cursor - user is selecting, or cursor has been scrolled out of sight. |
|
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
218 |
"/ 'cl2' printCR. |
4788 | 219 |
self closeCompletionView. |
220 |
^ self |
|
221 |
]. |
|
222 |
||
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
223 |
completionView isNil ifTrue:[ |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
224 |
initialList := #( 'Busy...' ). |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
225 |
"/ 'op1' printCR. |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
226 |
] ifFalse:[ |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
227 |
initialList := completionView list. |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
228 |
"/ 'op2' printCR. |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
229 |
]. |
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
230 |
self openCompletionView:initialList. |
4788 | 231 |
|
232 |
completionProcess := |
|
233 |
[ |
|
234 |
self computeCompletions. |
|
235 |
] forkAt:(Processor activePriority - 1). |
|
236 |
||
237 |
"Modified: / 26-09-2013 / 17:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
238 |
! |
|
239 |
||
240 |
stopCompletionProcess |
|
241 |
"kill any background completion process" |
|
242 |
||
243 |
|p| |
|
244 |
||
245 |
(p := completionProcess) notNil ifTrue:[ |
|
246 |
completionProcess := nil. |
|
247 |
p terminate. |
|
248 |
]. |
|
249 |
! |
|
250 |
||
251 |
updateCompletionList |
|
252 |
"called for keypress events" |
|
253 |
||
254 |
self startCompletionProcess. |
|
255 |
! ! |
|
256 |
||
257 |
!EditTextViewCompletionSupport methodsFor:'private-API'! |
|
258 |
||
259 |
closeCompletionView |
|
260 |
|v| |
|
261 |
||
262 |
(v := completionView) notNil ifTrue:[ |
|
263 |
completionView := nil. |
|
264 |
"/ let it close itself - avoids synchronization problems |
|
265 |
v sensor |
|
266 |
pushUserEvent:#value |
|
267 |
for:[ v topView destroy ] |
|
268 |
]. |
|
269 |
! |
|
270 |
||
271 |
openCompletionView |
|
272 |
"Opens the completion view with an initial list. Called as soon as |
|
273 |
completion is initiated but completion options are not yet computed." |
|
274 |
||
275 |
self openCompletionView: (Array with: 'Busy...') |
|
276 |
||
277 |
"Created: / 26-09-2013 / 17:06:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
278 |
! |
|
279 |
||
280 |
openCompletionView: list |
|
281 |
"Makes sure the completion view is opened and with given `list`." |
|
282 |
||
5033
8b4c2e31bde9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5032
diff
changeset
|
283 |
| cursorPos movePos topView limit | |
4817
597e3af71218
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
284 |
|
4788 | 285 |
"/ move the window |
5033
8b4c2e31bde9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5032
diff
changeset
|
286 |
cursorPos := editView device translatePoint:(editView xOfCursor @ editView yOfCursor) fromView:editView toView:nil. |
8b4c2e31bde9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5032
diff
changeset
|
287 |
cursorPos := cursorPos - (editView viewOrigin x @ 0). |
4788 | 288 |
"/ currently, we have to stay away a bit, to avoid getting the focus |
5033
8b4c2e31bde9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5032
diff
changeset
|
289 |
movePos := cursorPos + (60 @ (editView font height)). |
4788 | 290 |
|
291 |
completionView isNil ifTrue:[ |
|
292 |
completionView := CodeCompletionHelpMenuView new. |
|
293 |
completionView name:'completion'. |
|
294 |
completionView level:0. |
|
295 |
completionView list:list. |
|
296 |
completionView enable:false. |
|
297 |
completionView extent:completionView preferredExtentForContents. |
|
4824
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
298 |
"/ completionView font: editView font. |
4788 | 299 |
topView := CodeCompletionHelpView with:completionView. |
4968
254b5e81199a
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4824
diff
changeset
|
300 |
topView editView:editView. |
4788 | 301 |
] ifFalse:[ |
302 |
completionView list:list. |
|
303 |
topView := completionView topView. |
|
4824
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
304 |
]. |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
305 |
topView ~~ completionView ifTrue:[ |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
306 |
topView resizeToFit. |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
307 |
"/ movePos := editView device |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
308 |
"/ translatePoint:((editView right - topView width) @ (editView top)) |
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
309 |
"/ fromView:editView toView:nil. |
5032
395358c11314
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
310 |
"/ make sure, the window is visible |
395358c11314
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
311 |
limit := topView device monitorBoundsAt:topView origin. |
395358c11314
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
312 |
movePos x + topView extent x > limit corner x ifTrue:[ |
5033
8b4c2e31bde9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5032
diff
changeset
|
313 |
movePos := (cursorPos x - 60 - (topView extent x)) @ movePos y. |
5032
395358c11314
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
314 |
]. |
395358c11314
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
315 |
movePos y + topView extent y > limit corner y ifTrue:[ |
5033
8b4c2e31bde9
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5032
diff
changeset
|
316 |
movePos := movePos x @ (cursorPos y - (topView extent y)). |
5032
395358c11314
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
317 |
]. |
4824
e3806247e940
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
4819
diff
changeset
|
318 |
topView origin:movePos. |
4788 | 319 |
]. |
320 |
||
321 |
"Created: / 26-09-2013 / 17:07:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
322 |
! ! |
|
323 |
||
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
324 |
|
4788 | 325 |
!EditTextViewCompletionSupport class methodsFor:'documentation'! |
326 |
||
327 |
version |
|
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
328 |
^ '$Header$' |
4788 | 329 |
! |
330 |
||
331 |
version_CVS |
|
5410
78eefa911c26
class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents:
5064
diff
changeset
|
332 |
^ '$Header$' |
4788 | 333 |
! ! |
334 |