CodeView.st
changeset 1749 0d0f27322523
parent 1625 2203f9f0d3f3
child 2046 3593143e38e3
equal deleted inserted replaced
1748:88215be18503 1749:0d0f27322523
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 Workspace subclass:#CodeView
    13 Workspace subclass:#CodeView
    14 	instanceVariableNames:'explainAction formatAction'
    14 	instanceVariableNames:'explainAction formatAction pointerOverWordAction'
    15 	classVariableNames:''
    15 	classVariableNames:''
    16 	poolDictionaries:''
    16 	poolDictionaries:''
    17 	category:'Interface-Workspace'
    17 	category:'Interface-Workspace'
    18 !
    18 !
    19 
    19 
    86     "set the action to be performed on format"
    86     "set the action to be performed on format"
    87 
    87 
    88     formatAction := aBlock
    88     formatAction := aBlock
    89 
    89 
    90     "Created: / 17.2.1998 / 17:05:13 / cg"
    90     "Created: / 17.2.1998 / 17:05:13 / cg"
       
    91 !
       
    92 
       
    93 pointerOverWordAction:aBlock
       
    94     pointerOverWordAction := aBlock.
       
    95     pointerOverWordAction notNil ifTrue:[
       
    96         self enableMotionEvents.
       
    97     ] ifFalse:[
       
    98         self disableMotionEvents
       
    99     ]
       
   100 
       
   101 
    91 ! !
   102 ! !
    92 
   103 
    93 !CodeView methodsFor:'event handling'!
   104 !CodeView methodsFor:'event handling'!
       
   105 
       
   106 buttonMotion:state x:x y:y
       
   107     |col line word|
       
   108 
       
   109     pointerOverWordAction notNil ifTrue:[
       
   110         state == 0 ifTrue:[
       
   111             line := self visibleLineOfY:y.
       
   112             col := self colOfX:x inVisibleLine:line.
       
   113             line := self visibleLineToAbsoluteLine:line.
       
   114 
       
   115             self wordAtLine:line col:col do:[:selectLine :beginCol :endLine :endCol :flag |
       
   116                 word := self listAt:selectLine from:beginCol to:endCol.
       
   117                 word notNil ifTrue:[
       
   118                     pointerOverWordAction value:word value:line value:col
       
   119                 ]
       
   120             ].
       
   121             ^ self
       
   122         ].
       
   123     ].
       
   124     super buttonMotion:state x:x y:y
       
   125 
       
   126 !
    94 
   127 
    95 keyPress:key x:x y:y
   128 keyPress:key x:x y:y
    96     "catch keyboard shortcuts"
   129     "catch keyboard shortcuts"
    97 
   130 
    98     <resource: #keyboard (#Explain #Help 
   131     <resource: #keyboard (#Explain #Help 
   222 ! !
   255 ! !
   223 
   256 
   224 !CodeView class methodsFor:'documentation'!
   257 !CodeView class methodsFor:'documentation'!
   225 
   258 
   226 version
   259 version
   227     ^ '$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.40 1998-07-29 15:57:20 cg Exp $'
   260     ^ '$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.41 1999-02-19 18:11:03 cg Exp $'
   228 ! !
   261 ! !