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