EditTextViewCompletionSupport.st
author Claus Gittinger <cg@exept.de>
Fri, 02 Aug 2019 17:44:39 +0200
changeset 6657 90673a5bc399
parent 6650 340342c01ce4
child 6659 bf9e461b517c
permissions -rw-r--r--
#REFACTORING by exept class: EditTextViewCompletionSupport changed: #computeAndShowCompletions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:libwidg' }"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     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
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
Object subclass:#EditTextViewCompletionSupport
5772
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
     6
	instanceVariableNames:'completionView completionProcess editView autoSelect
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
     7
		editViewLostFocusBlock'
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	classVariableNames:'LastCompletions'
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	poolDictionaries:''
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
	category:'Views-Text'
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
!EditTextViewCompletionSupport class methodsFor:'documentation'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
documentation
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
    An abstract supperclass to support completion in text views.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
    Individual completion engines may create a subclass of 
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
    EditTextCompletionSupport and customize it.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
5788
3043bff6248c #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 5772
diff changeset
    21
    Basically, they have to implement #computeCompletions
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
    [author:]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
        Claus Gittinger
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    [instance variables:]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
    [class variables:]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
    [see also:]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
!EditTextViewCompletionSupport class methodsFor:'instance creation'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
for:anEditView
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    ^ self new editView:anEditView
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
!EditTextViewCompletionSupport class methodsFor:'queries'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
isAbstract
5509
b5286dea20fa #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5411
diff changeset
    44
    ^ self == EditTextViewCompletionSupport
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    "Created: / 26-09-2013 / 16:22:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
!EditTextViewCompletionSupport methodsFor:'accessing'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
editView:anEditTextView
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
    editView := anEditTextView.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
!EditTextViewCompletionSupport methodsFor:'events'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
buttonPress:button x:x y:y
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    self closeCompletionView.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
editViewLostFocus
5772
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
    62
    "this is a hack for Windows:
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
    63
     on windows, an activate:false event is first sent to my textView,
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
    64
     then an activate is sent to the completion popup.
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
    65
     this is done BEFORE the buttonPress event is delivered.
5891
584219e0a322 #OTHER by mawalch
mawalch
parents: 5788
diff changeset
    66
     therefore, allow for the activate of the completionMenu and its button event to be processed.
5772
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
    67
     before forcing it to be closed..."
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
    68
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    completionView notNil ifTrue:[
4808
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
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
handleKeyPress:key x:x y:y
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    "return true, if I have eaten this keypress"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
5064
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
    81
    |ch completeImmediate eatCursorLeftOrRight eatCursorUpDown|
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    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
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    "/ open on CTRL- or TAB-key?
6370
b5cd4fd52b3c #BUGFIX by sr
sr
parents: 6315
diff changeset
    86
    (completionView notNil and:[completionView realized]) ifFalse:[
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
        editView hasSelection ifFalse:[
6650
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
    88
            ch := editView characterBeforeCursor.
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
    89
            (ch notNil "/ i.e. not at begin of line
6594
c347f9e598d7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6433
diff changeset
    90
            and:[ ch isLetterOrDigitOrUnderline ]) ifTrue:[
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
                (key == #Control_L or:[ key == #Ctrl or:[ key == #Control_R or:[ key == #Control]]]) ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
                    UserPreferences current codeCompletionOnControlKey ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
                        autoSelect := true.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
                        self updateCompletionList
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
                    ]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
                ].
4805
dd3fd2a4f3e9 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4788
diff changeset
    97
                ((key == #Tab) and:[editView sensor shiftDown not]) ifTrue:[
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
                    UserPreferences current codeCompletionOnTabKey ifTrue:[
6315
1362b6366e09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
    99
                        "/ only if the character after the cursor is a separator!!
1362b6366e09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   100
                        "/ otherwise, we cannot insert tabs 
6370
b5cd4fd52b3c #BUGFIX by sr
sr
parents: 6315
diff changeset
   101
                        ((ch := editView characterAfterCursor) isNil or:[ch isSeparator]) ifTrue:[
6315
1362b6366e09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   102
                            autoSelect := true.
1362b6366e09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   103
                            self updateCompletionList.
1362b6366e09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   104
                            ^ true
1362b6366e09 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   105
                        ].
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
                    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
                ]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
            ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
        ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
        ^ false.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
6197
3a3a1cabb663 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   113
    editView cursorCol <= 1 ifTrue:[^ false].
3a3a1cabb663 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   114
    
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
    "/ key for completion view ? (careful: do not forward too many, it would disturb user's typing)
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
    key isCharacter ifFalse:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
        "/ forward to menu
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
        (completionView notNil) ifTrue:[
5064
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   119
            "/never
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
            eatCursorLeftOrRight := false.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
"/                                    completeImmediate not
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
"/                                    or:[ editView sensor shiftDown 
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
"/                                    or:[ editView sensor ctrlDown ]].
5064
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   124
            "/ only with shift or ctrl
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   125
            eatCursorUpDown := 
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   126
                    (UserPreferences current codeCompletionViewKeyboardNavigationNeedsModifier not)
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   127
                    or:[ editView sensor shiftDown 
5705
1de82431490c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5697
diff changeset
   128
                    or:[ editView sensor ctrlDown]].
5064
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   129
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   130
            ((key == #CursorDown and:[eatCursorUpDown])
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   131
                or:[ (key == #CursorUp and:[eatCursorUpDown])
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
                or:[ ((key == #CursorLeft) and:[eatCursorLeftOrRight])
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
                or:[ ((key == #CursorRight) and:[eatCursorLeftOrRight])
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
                or:[ ((key == #Return) and:[ completionView hasSelection ])
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
            ]]]]) ifTrue:[
5064
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   136
                "/ forward to completion view
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   137
                completionView sensor pushUserEvent:#value for:[ completionView keyPress:key x:0 y:0 ].
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   138
                ^ true.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
            ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
            (key == #Control_L or:[ key == #Control_R or:[ key == #Control or:[ key == #Ctrl ]]]) ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
                "/ CTRL is a toggle
5064
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   143
"/                self closeCompletionView.   
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   144
"/                ^ true.
55e4260c1ea1 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5033
diff changeset
   145
                ^ false "/ don't eat
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
            ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
            (key == #Escape) ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
                self closeCompletionView.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
                ^ true  "/ EAT
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
            ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
            "/ shift does not close
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
            (key == #Shift_L or:[ key == #Shift_R or:[ key == #Shift]]) ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
                ^ false "/ don' eat
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
            ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
4817
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   156
            (key == #BackSpace) ifTrue:[
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   157
                ^ false "/ don' eat
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   158
            ].
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
            self closeCompletionView.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
            ^ false "/ don' eat
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
        ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    ^ false.
6197
3a3a1cabb663 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   164
3a3a1cabb663 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   165
    "Modified: / 24-08-2017 / 21:32:52 / cg"
6370
b5cd4fd52b3c #BUGFIX by sr
sr
parents: 6315
diff changeset
   166
    "Modified: / 03-07-2018 / 13:41:45 / sr"
6594
c347f9e598d7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6433
diff changeset
   167
    "Modified: / 05-06-2019 / 17:06:15 / Claus Gittinger"
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
postKeyPress:key
6650
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
   171
    |doComplete ch|
5410
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   172
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
    UserPreferences current immediateCodeCompletion ifFalse:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
        "/ only update, if already open
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
        completionView isNil ifTrue:[^ self].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
6650
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
   178
    "/ (completionView notNil and:[completionView realized]) ifTrue:[^ self].
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
   179
    editView hasSelection ifTrue:[^ self].
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
   180
    ch := editView characterBeforeCursor.
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
   181
    (ch notNil and:[ch isLetterOrDigitOrUnderline]) ifFalse:[^ self].
340342c01ce4 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 6632
diff changeset
   182
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
    (key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
        autoSelect := false.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
        self updateCompletionList.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
        ^ self
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
    key isCharacter ifTrue:[
5410
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   190
        (doComplete := key isSeparator not) ifFalse:[
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   191
            "/ 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
   192
            doComplete := editView lineStringBeforeCursor withoutSeparators notEmpty.
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   193
        ].
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   194
        doComplete ifFalse:[
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
            self closeCompletionView
5410
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   196
        ] ifTrue:[
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
            autoSelect := false.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
            self updateCompletionList.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
        ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
        ^ self
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   201
    ].
5772
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   202
!
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   203
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   204
startTimeoutForEditViewLostFocus
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   205
    "see comment in #editViewLostFocus"
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   206
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   207
    editViewLostFocusBlock isNil ifTrue:[
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   208
        editViewLostFocusBlock := [self editViewLostFocus].
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   209
    ].
fa9c46bd7a1b #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5705
diff changeset
   210
    Processor addTimedBlock:editViewLostFocusBlock afterMilliseconds:200.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   213
!EditTextViewCompletionSupport methodsFor:'private'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   214
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   215
computeAndShowCompletions
6657
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   216
    "compute completions, then push an event to show them"
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   217
    
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   218
    |completions|
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   219
6657
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   220
    completions := self computeCompletions.
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   221
    completions notEmptyOrNil ifTrue:[
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   222
        self assert:completions isArray.
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   223
        self assert:completions size == 4.
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   224
        editView sensor
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   225
            pushUserEvent:#'suggestionsArrived:implementations:actions:autoSelect:'
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   226
            for:self
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   227
            withArguments:completions
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   228
    ].
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   229
6657
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   230
    "Created: / 15-07-2019 / 17:29:54 / Claus Gittinger"
90673a5bc399 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6650
diff changeset
   231
    "Modified: / 24-07-2019 / 07:53:35 / Claus Gittinger"
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   232
!
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   233
4824
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   234
computeCompletions
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   235
    "Actually compute the completions and update the completion view."
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   236
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   237
    self subclassResponsibility
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   238
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   239
    "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
   240
!
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   241
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   242
release
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   243
    self stopCompletionProcess.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   244
    self closeCompletionView.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   245
    super release
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   246
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   247
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
startCompletionProcess
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
    "start the code completion process in the background"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   250
6627
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   251
    |initialList cursorX cursorY p|
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   252
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
    "/ terminate any previous process
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   254
    self synchronized:[
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   255
        self stopCompletionProcess.
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   256
    ].
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   257
    
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   258
    (editView sensor hasKeyPressEventFor:nil) ifTrue:[ 
4817
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   259
        "/ 'cl' printCR.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   260
        self closeCompletionView. 
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   261
        ^ self
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   262
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   263
    ((cursorX := editView xOfCursor) isNil
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   264
    or:[ (cursorY := editView yOfCursor) isNil ]) ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   265
        "/ 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
   266
        "/ 'cl2' printCR.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   267
        self closeCompletionView. 
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   268
        ^ self
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   269
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   270
4817
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   271
    completionView isNil ifTrue:[
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   272
        initialList := #( 'Busy...' ).
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   273
        "/ 'op1' printCR.
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   274
    ] ifFalse:[
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   275
        initialList := completionView list.
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   276
        "/ 'op2' printCR.
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   277
    ].
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   278
    self openCompletionView:initialList.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   279
6627
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   280
    completionProcess := p := 
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   281
        [
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   282
            [
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   283
                "/ protect end-user applications from errors
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   284
                Error handle:[:ex |
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   285
                    (ParseError accepts:ex creator) ifFalse:[
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   286
                        Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ ex reject ]
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   287
                    ].
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   288
                ] do:[ 
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   289
                    |startTime|
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   290
                    
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   291
                    startTime := Timestamp now.
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   292
                    "/ Wait a while to give user chance finish typing.
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   293
                    "/ This also reduces CPU consumption by avoiding
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   294
                    "/ useless computation
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   295
                    Delay waitForMilliseconds: 200.
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   296
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   297
                    (editView topView isDebugView) ifTrue:[
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   298
                        ControlInterrupt ignoreIn:[
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   299
                            self computeAndShowCompletions.
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   300
                        ].    
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   301
                    ] ifFalse:[    
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   302
                        self computeAndShowCompletions.
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   303
                    ].
6391
935a745d3c55 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6370
diff changeset
   304
                ].
6627
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   305
                p == completionProcess ifTrue:[
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   306
                    completionProcess := nil
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   307
                ]
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   308
            ] ifCurtailed:[
6433
fa1517a0ad10 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6432
diff changeset
   309
                "/ completionView notNil ifTrue:[
fa1517a0ad10 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6432
diff changeset
   310
                "/    completionView topView destroy
fa1517a0ad10 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6432
diff changeset
   311
                "/ ].    
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   312
            ].    
6627
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   313
        ] newProcess.
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   314
    "/ p priority:(Processor activePriority - 1).
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   315
    p priorityRange:(Processor activePriority-1 to:Processor activePriority).
322e0fc5efc4 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6594
diff changeset
   316
    p resume.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   317
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   318
    "Modified: / 26-09-2013 / 17:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6632
8670224f9fd5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6627
diff changeset
   319
    "Modified: / 15-07-2019 / 17:30:55 / Claus Gittinger"
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   320
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   321
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   322
stopCompletionProcess
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   323
    "kill any background completion process"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   324
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   325
    |p|
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   326
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   327
    (p := completionProcess) notNil ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   328
        completionProcess := nil.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   329
        p terminate.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   330
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   331
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   332
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   333
updateCompletionList
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   334
    "called for keypress events"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   335
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   336
    self startCompletionProcess.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   337
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   338
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   339
!EditTextViewCompletionSupport methodsFor:'private-API'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   340
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   341
closeCompletionView
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   342
    |v|
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   343
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   344
    (v := completionView) notNil ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   345
        completionView := nil.
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   346
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   347
        "/ let it close itself - avoids synchronization problems
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   348
        v sensor
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   349
            pushUserEvent:#value
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   350
            for:[ v topView destroy ]
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   351
    ].
6432
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   352
03625766b591 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6391
diff changeset
   353
    "Modified (format): / 14-09-2018 / 22:08:05 / Claus Gittinger"
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   354
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   355
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   356
openCompletionView
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   357
    "Opens the completion view with an initial list. Called as soon as
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
     completion is initiated but completion options are not yet computed."
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   359
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   360
    self openCompletionView: (Array with: 'Busy...')
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   362
    "Created: / 26-09-2013 / 17:06:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   363
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   364
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   365
openCompletionView: list
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   366
    "Makes sure the completion view is opened and with given `list`."
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   367
    
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   368
    | textCursorPosInTextView textCursorPosOnScreen movePos topView 
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   369
      screenBounds screenBoundsCorner 
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   370
      helpViewsExtent helpViewsWidth helpViewsHeight|
4817
597e3af71218 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
   371
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   372
    "/ move the window away from the text cursor (to not cover what user types in)
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   373
    "/ get the screen-relative position of the text cursor
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   374
    textCursorPosInTextView := editView xOfCursor @ editView yOfCursor.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   375
    
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   376
    "/ care for the scroll-offset (xOfCursor/yOFCursor gives me               
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   377
    textCursorPosInTextView := textCursorPosInTextView - (editView viewOrigin x @ 0).
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   378
    
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   379
    textCursorPosOnScreen := editView device 
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   380
                    translatePoint:textCursorPosInTextView 
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   381
                    fromView:editView toView:nil.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   382
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   383
    "/ currently, we have to stay away a bit, to avoid getting the focus
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   384
    "/ this will be somewhat to the down-right of the textCursor
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   385
    movePos := textCursorPosOnScreen + (60 @ (editView font height)).
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   386
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   387
    completionView isNil ifTrue:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   388
        completionView := CodeCompletionHelpMenuView new.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   389
        completionView name:'completion'.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   390
        completionView level:0.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   391
        completionView list:list.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   392
        completionView enable:false.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   393
        completionView extent:completionView preferredExtentForContents.
4824
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   394
        "/ completionView font: editView font.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   395
        topView := CodeCompletionHelpView with:completionView.
4968
254b5e81199a class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4824
diff changeset
   396
        topView editView:editView.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   397
    ] ifFalse:[
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   398
        completionView list:list.
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   399
        topView := completionView topView.
4824
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   400
    ].
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   401
    
4824
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   402
    topView ~~ completionView ifTrue:[
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   403
        topView resizeToFit.
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   404
5032
395358c11314 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4968
diff changeset
   405
        "/ make sure, the window is visible
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   406
        screenBounds := topView device monitorBoundsAt:topView origin.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   407
        screenBoundsCorner := screenBounds corner.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   408
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   409
        helpViewsExtent := topView extent.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   410
        helpViewsWidth := helpViewsExtent x.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   411
        helpViewsHeight := helpViewsExtent y.
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   412
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   413
        "/ if it does not lie completely inside the screen, move it     
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   414
        (movePos x + helpViewsWidth) > screenBoundsCorner x ifTrue:[
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   415
            movePos := (textCursorPosOnScreen x - 60 - helpViewsWidth) @ movePos y.
5032
395358c11314 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4968
diff changeset
   416
        ].
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   417
        (movePos y + helpViewsHeight) > screenBoundsCorner y ifTrue:[
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   418
            movePos := movePos x @ (textCursorPosOnScreen y - helpViewsHeight).
5032
395358c11314 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4968
diff changeset
   419
        ].
5939
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   420
        movePos y < 0 ifTrue:[
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   421
            movePos := movePos x @ 0
c22f1eec3ffd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5891
diff changeset
   422
        ].    
4824
e3806247e940 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 4819
diff changeset
   423
        topView origin:movePos.
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   424
    ].
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   425
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   426
    "Created: / 26-09-2013 / 17:07:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   427
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   428
6391
935a745d3c55 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6370
diff changeset
   429
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   430
!EditTextViewCompletionSupport class methodsFor:'documentation'!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   431
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   432
version
5410
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   433
    ^ '$Header$'
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   434
!
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   435
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   436
version_CVS
5410
78eefa911c26 class: EditTextViewCompletionSupport
Claus Gittinger <cg@exept.de>
parents: 5064
diff changeset
   437
    ^ '$Header$'
4788
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   438
! !
8ac7fbb56cb5 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   439