Marcel Taeumel uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-mt.1785.mcz
==================== Summary ====================
Name: Morphic-mt.1785 Author: mt Time: 29 October 2021, 2:09:00.086763 pm UUID: 25147fd7-88ac-5842-9b9d-0cf7bc12ea57 Ancestors: Morphic-ct.1784, Morphic-eem.1784
Restores backwards compatibility in #keyString as this format is used to store-and-compare keyboard shortcuts in Etoys and other projects.
Merges fix for event comparision from Morphic-ct.1784.
=============== Diff against Morphic-eem.1784 ===============
Item was changed: ----- Method: KeyboardEvent>>= (in category 'comparing') ----- = aMorphicEvent super = aMorphicEvent ifFalse:[^false]. buttons = aMorphicEvent buttons ifFalse: [^ false]. keyValue = aMorphicEvent keyValue ifFalse: [^ false]. + keyCode = aMorphicEvent keyCode ifFalse: [^ false]. + ^ true! - ^ true - !
Item was changed: ----- Method: KeyboardEvent>>printKeyStringOn: (in category 'printing') ----- printKeyStringOn: aStream "Print a readable string representing the receiver on a given stream"
| kc inBrackets firstBracket keyString | kc := self keyCharacter. inBrackets := false. firstBracket := [ inBrackets ifFalse: [ aStream nextPut: $<. inBrackets := true ]]. + self modifiers + select: [:modifier | + "Show #shift modifier only for control characters for backwards compatibility in #keyString." + modifier ~= #shift or: [ keyValue < 32 ]] + thenDo: [:modifier | + firstBracket value. + "Capitalize modifier for backwards compatibility in #keyString." + aStream nextPutAll: modifier capitalized; nextPutAll: '-' ]. - self modifiers do: [:modifier | - firstBracket value. aStream nextPutAll: modifier; nextPutAll: '-' ].
keyString := (Character constantNameFor: kc) ifNil: [String with: kc]. + keyString := keyString caseOf: { + "Rename several keys for backwards compatibility in #keyString." + [ 'space' ] -> [ ' ' ]. + [ 'return' ] -> [ 'cr' ]. + [ 'arrowDown' ] -> [ 'down' ]. + [ 'arrowUp' ] -> [ 'up' ]. + [ 'arrowLeft' ] -> [ 'left' ]. + [ 'arrowRight' ] -> [ 'right' ] + } otherwise: [ keyString ]. + keyString size > 1 ifTrue: [ firstBracket value ]. aStream nextPutAll: keyString.
inBrackets ifTrue: [aStream nextPut: $> ]!
Item was changed: ----- Method: KeyboardExerciser>>logEvent: (in category 'event handling') ----- logEvent: evt
| eventMorph | evt = self lastEvent ifTrue: [^ self logEventRepetition: evt].
eventMorph := evt asMorph. eventMorph setProperty: #event toValue: evt copy; + balloonText: ('Click to inspect. Shift+click to explore.\Virtual key: {8}\Virtual modifiers: {5}\Physical key: {9}\Physical modifiers: {6}\Key value: 0x{1} ({2}) \Key character: {3}\Key string: {4}\{7}' withCRs format: { - balloonText: ('Click to inspect. Shift+click to explore.\Virtual key: {7}\Virtual modifiers: {4}\Physical key: {8}\Physical modifiers: {5}\Key value: 0x{1} ({2}) \Key character: {3}\{6}' withCRs format: { evt keyValue printPaddedWith: $0 to: 2 base: 16. evt keyValue. evt isKeystroke ifTrue: [evt keyCharacter printString] ifFalse: ['-']. + evt isKeystroke ifTrue: [evt keyString printString] ifFalse: ['-']. (evt virtualModifiers joinSeparatedBy: ' ') asUppercase. (evt physicalModifiers joinSeparatedBy: ' ') asUppercase. evt printString. evt virtualKey printString. evt physicalKey asString printString}). eventMorph on: #mouseEnter send: #handleEvent:emphasize: to: self; on: #mouseLeave send: #handleEvent:deemphasize: to: self; on: #mouseDown send: #handleEvent:inspect: to: self.
self addMorphBack: eventMorph.!
packages@lists.squeakfoundation.org