EditTextViewCompletionSupport.st
changeset 5033 8b4c2e31bde9
parent 5032 395358c11314
child 5064 55e4260c1ea1
equal deleted inserted replaced
5032:395358c11314 5033:8b4c2e31bde9
   266 !
   266 !
   267 
   267 
   268 openCompletionView: list
   268 openCompletionView: list
   269     "Makes sure the completion view is opened and with given `list`."
   269     "Makes sure the completion view is opened and with given `list`."
   270     
   270     
   271     | movePos topView limit |
   271     | cursorPos movePos topView limit |
   272 
   272 
   273     "/ move the window
   273     "/ move the window
   274     movePos := editView device translatePoint:(editView xOfCursor @ editView yOfCursor) fromView:editView toView:nil.
   274     cursorPos := editView device translatePoint:(editView xOfCursor @ editView yOfCursor) fromView:editView toView:nil.
   275     movePos := movePos - (editView viewOrigin x @ 0).
   275     cursorPos := cursorPos - (editView viewOrigin x @ 0).
   276     "/ currently, we have to stay away a bit, to avoid getting the focus
   276     "/ currently, we have to stay away a bit, to avoid getting the focus
   277     movePos := movePos + (60 @ (editView font height)).
   277     movePos := cursorPos + (60 @ (editView font height)).
   278 
   278 
   279     completionView isNil ifTrue:[
   279     completionView isNil ifTrue:[
   280         completionView := CodeCompletionHelpMenuView new.
   280         completionView := CodeCompletionHelpMenuView new.
   281         completionView name:'completion'.
   281         completionView name:'completion'.
   282         completionView level:0.
   282         completionView level:0.
   296 "/                        translatePoint:((editView right - topView width) @ (editView top)) 
   296 "/                        translatePoint:((editView right - topView width) @ (editView top)) 
   297 "/                        fromView:editView toView:nil.
   297 "/                        fromView:editView toView:nil.
   298         "/ make sure, the window is visible
   298         "/ make sure, the window is visible
   299         limit := topView device monitorBoundsAt:topView origin.
   299         limit := topView device monitorBoundsAt:topView origin.
   300         movePos x + topView extent x > limit corner x ifTrue:[
   300         movePos x + topView extent x > limit corner x ifTrue:[
   301             movePos := (movePos x - (topView extent x * 2)) @ movePos y.
   301             movePos := (cursorPos x - 60 - (topView extent x)) @ movePos y.
   302         ].
   302         ].
   303         movePos y + topView extent y > limit corner y ifTrue:[
   303         movePos y + topView extent y > limit corner y ifTrue:[
   304             movePos := movePos x @ (movePos y - (topView extent y * 2)).
   304             movePos := movePos x @ (cursorPos y - (topView extent y)).
   305         ].
   305         ].
   306         topView origin:movePos.
   306         topView origin:movePos.
   307     ].
   307     ].
   308 
   308 
   309     "Created: / 26-09-2013 / 17:07:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   309     "Created: / 26-09-2013 / 17:07:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   310 ! !
   310 ! !
   311 
   311 
   312 !EditTextViewCompletionSupport class methodsFor:'documentation'!
   312 !EditTextViewCompletionSupport class methodsFor:'documentation'!
   313 
   313 
   314 version
   314 version
   315     ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.8 2014-05-21 08:06:33 cg Exp $'
   315     ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.9 2014-05-21 08:10:21 cg Exp $'
   316 !
   316 !
   317 
   317 
   318 version_CVS
   318 version_CVS
   319     ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.8 2014-05-21 08:06:33 cg Exp $'
   319     ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.9 2014-05-21 08:10:21 cg Exp $'
   320 ! !
   320 ! !
   321 
   321