hacking EventRecorderMorph

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

hacking EventRecorderMorph

Hilaire Fernandes-3
I will hack a bit the EventRecorderMorph so its recorded mouse position
can be relative to a given morph. Are they any insight anyone can share
to do so ?

Hilaire

_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: hacking EventRecorderMorph

Bert Freudenberg

On Dec 14, 2006, at 0:10 , Hilaire Fernandes wrote:

> I will hack a bit the EventRecorderMorph so its recorded mouse  
> position
> can be relative to a given morph. Are they any insight anyone can  
> share
> to do so ?

Scott Wallace is working on a much improved version of the event  
recorder, this will be made available in the next weeks in the OLPC  
etoys image. We're using that for recording tutorials.

- Bert -


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: hacking EventRecorderMorph

Hilaire Fernandes-3
Bert Freudenberg a écrit :

> On Dec 14, 2006, at 0:10 , Hilaire Fernandes wrote:
>
>> I will hack a bit the EventRecorderMorph so its recorded mouse  
>> position
>> can be relative to a given morph. Are they any insight anyone can  
>> share
>> to do so ?
>
> Scott Wallace is working on a much improved version of the event  
> recorder, this will be made available in the next weeks in the OLPC  
> etoys image. We're using that for recording tutorials.

I will look at it. In the mean time I hacked a subclass of this morph to
be able to specify a target morph. Enclosed the .st. Beware it is very
specific to my need as I removed the possibility to write the event in
file. Instead I am saving the tape in a Magma database.

Hilaire

'From Squeak3.9gamma of ''23 July 2006'' [latest update: #7061] on 15 December 2006 at 9:07:58 am'!
EventRecorderMorph subclass: #IFIEventRecorderMorph
        instanceVariableNames: 'targetMorph targetPosition'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'iFichier-Morphs'!

!IFIEventRecorderMorph methodsFor: 'fileIn/Out' stamp: 'HilaireFernandes 12/13/2006 16:43'!
writeCheck
        ! !


!IFIEventRecorderMorph methodsFor: 'initialization' stamp: 'HilaireFernandes 12/13/2006 16:44'!
addJournalFile! !


!IFIEventRecorderMorph methodsFor: 'accessing' stamp: 'HilaireFernandes 12/13/2006 17:01'!
tape
        ^ tape! !

!IFIEventRecorderMorph methodsFor: 'accessing' stamp: 'HilaireFernandes 12/13/2006 17:04'!
tape: aTape
        ^ tape := aTape! !

!IFIEventRecorderMorph methodsFor: 'accessing' stamp: 'HilaireFernandes 12/14/2006 09:38'!
targetMorph: aMorph
        targetMorph := aMorph ! !

!IFIEventRecorderMorph methodsFor: 'accessing' stamp: 'HilaireFernandes 12/14/2006 16:55'!
targetPosition
        ^ targetPosition ! !


!IFIEventRecorderMorph methodsFor: 'pause/resume' stamp: 'HilaireFernandes 12/14/2006 15:15'!
resumePlayIn: aWorld
        playHand := HandMorphForReplay new recorder: self.
        playHand position: tapeStream peek position.
        aWorld addHand: playHand.
        playHand newKeyboardFocus: aWorld.
        playHand userInitials: 'lecture' andPicture: nil.
        lastEvent := nil.
        lastDelta := 0 @ 0.
        state := #play.
        self synchronize! !


!IFIEventRecorderMorph methodsFor: 'events-processing' stamp: 'HilaireFernandes 12/14/2006 16:55'!
handleListenEvent: anEvent
        "Record the given event"
        (state == #record
                        and: [anEvent hand == recHand])
                ifFalse: [^ self].
        anEvent = lastEvent
                ifTrue: [^ self].
        (anEvent isKeyboard
                        and: [anEvent keyValue = 27
                                "esc"])
                ifTrue: [^ self stop].
        time := anEvent timeStamp.
        self haltOnce.
        tapeStream
                nextPut: ((anEvent copy translateBy: self targetPosition negated)
                                setHand: nil).
        lastEvent := anEvent! !


!IFIEventRecorderMorph methodsFor: 'event handling' stamp: 'HilaireFernandes 12/14/2006 16:55'!
nextEventToPlay
        | evt |
        evt := super nextEventToPlay.
        (evt isNil not
                        and: [evt isMouse])
                ifTrue: [evt := evt copy translateBy: self targetPosition].
        ^ evt! !


!IFIEventRecorderMorph methodsFor: 'stepping and presenter' stamp: 'HilaireFernandes 12/14/2006 16:50'!
stop
        super stop.
        "tape
                ifNotNil: [self condense]"! !


!IFIEventRecorderMorph methodsFor: 'commands' stamp: 'HilaireFernandes 12/14/2006 16:55'!
play
        targetPosition := targetMorph position.
        super play! !

!IFIEventRecorderMorph methodsFor: 'commands' stamp: 'HilaireFernandes 12/14/2006 16:56'!
record
        targetPosition := targetMorph position.
        super record! !

_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland