'From etoys2.1 of 26 July 2007 [latest update: #1544] on 9 August 2007 at 10:29:03 pm'! "Change Set: unmatchedMouseDown-sw Date: 9 August 2007 Author: Scott Wallace If one halts the creation of an event-recording by hitting ESC while a mouse button is down, we now synthesize a bracketing mouse-up, to avoid some odd consequences of playback ending with the playback-hand's mouse button nominally still down."! !EventRecordingSpace methodsFor: 'processing' stamp: 'sw 8/9/2007 21:35'! playingEnded "The playback reached the end." | snippetsList | self state: #atEndOfPlayback. snippetsList := eventRecorder valueOfProperty: #snippetsList. snippetsList isEmptyOrNil ifFalse: [snippetsList do: [:soundEvent | eventRecorder mergeMediaEvent: soundEvent]. self pushEventTapeToEventRoll ]. eventRecorder removeProperty: #snippetsList. self populateControlsPanel. self borderColor: self color. self abandonReplayHandsAndHalos. self removeProperty: #suspendedContentArea. self refreshRoll. self removeAlarm: #offerTickingMenu: "in case timing unlucky." ! ! !EventPlaybackSpace methodsFor: 'processing' stamp: 'sw 8/9/2007 21:34'! playingEnded "The playback reached the end." self dismantlePaintBoxArtifacts. autoDismiss ifTrue: [^ self abandon]. self state: #atEndOfPlayback. self populateControlsPanel. self borderColor: self color. self abandonReplayHandsAndHalos. self removeAlarm: #offerTickingMenu:. "In case timing is unlucky" ! ! !EventSequence methodsFor: 'accessing' stamp: 'sw 8/9/2007 21:35'! duration "Answer how long the event lasts, in milliseconds. If no stopTime has yet been established, answer zero." ^ (stopTime ifNil: [startTime]) - startTime! ! !MentoringEventRecorder methodsFor: 'commands' stamp: 'sw 8/9/2007 21:50'! handleEscape "The user hit esc to stop recording or playback, so stop." | interimTape unmatchedMouseDown upEvent | tapeStream ifNotNil: [(#(recording recordingWithSound) includes: self state ) ifTrue: [interimTape := tapeStream contents. unmatchedMouseDown := nil. interimTape reversed detect: [:evt | evt eventType = #mouseDown ifTrue: [unmatchedMouseDown := evt. true] ifFalse: [evt eventType = #mouseUp]] ifNone: [nil]. unmatchedMouseDown ifNotNil: ["synthesize a matching up-event" upEvent := unmatchedMouseDown veryDeepCopy. upEvent timeStamp: Time millisecondClockValue. upEvent setType: #mouseUp. tapeStream nextPut: upEvent]. tape _ tapeStream contents. saved _ false]]. self pauseIn: self world. tapeStream _ nil. recordMeter ifNotNil: [recordMeter width: 1]. recordingSpace escapeHitInEventRecorder! !