'From etoys2.3 of 28 November 2007 [latest update: #1891] on 6 February 2008 at 12:09:05 pm'! "Change Set: toggleFullScreen3and13-yo Date: 6 February 2008 Author: Yoshiki Ohshima Both Enter and Carriage Return work for toggling full screen (i.e, showing and hiding sugar bar). ParagraphEditor is unchanged to keep the possible Ctrl-Enter feature in text."! !PasteUpMorph methodsFor: '*green' stamp: 'yo 2/6/2008 11:58'! keystrokeInWorld: evt "A keystroke was hit when no keyboard focus was set, so it is sent here to the world instead." | aChar isCmd ascii | aChar _ evt keyCharacter. (ascii _ aChar charCode) = 27 ifTrue: "escape key -- either put up a menu, or simply quietly gobble it" [^ Preferences escapeKeyProducesMenu ifTrue: [self putUpWorldMenuFromEscapeKey]]. ((ascii = 44) and: [(evt commandKeyPressed or: [evt controlKeyPressed])]) "show-source on XO" ifTrue: [^ self showSourceKeyHit]. ((ascii = 3 or: [ascii = 13]) and: [(evt commandKeyPressed or: [evt controlKeyPressed])]) "toggle-full-screen" ifTrue: [^ self toggleFullScreen]. (evt controlKeyPressed not and: [(#(1 4 8 28 29 30 31 32 47) includes: ascii) "home, end, backspace, arrow keys, space, slash." and: [self keyboardNavigationHandler notNil]]) ifTrue: [self keyboardNavigationHandler navigateFromKeystroke: aChar]. isCmd _ evt commandKeyPressed and: [Preferences cmdKeysInText]. (evt commandKeyPressed and: [Preferences eToyFriendly]) ifTrue: [(aChar = $W) ifTrue: [^ self putUpWorldMenu: evt]]. (isCmd and: [Preferences honorDesktopCmdKeys]) ifTrue: [^ self dispatchCommandKeyInWorld: aChar event: evt]. "It was unhandled. Remember the keystroke." self lastKeystroke: evt keyString. self triggerEvent: #keyStroke! ! !PluggableListMorph methodsFor: 'event handling' stamp: 'yo 2/6/2008 12:05'! keyStroke: event "Process keys specialKeys are things like up, down, etc. ALWAYS HANDLED modifierKeys are regular characters either 1) accompanied with ctrl, cmd or 2) any character if the list doesn't want to handle basic keys (handlesBasicKeys returns false) basicKeys are any characters" | aChar aSpecialKey ascii | (self scrollByKeyboard: event) ifTrue: [^self]. aChar _ event keyCharacter. ascii _ aChar charCode. Preferences sugarNavigator ifTrue: [((ascii = 3 or: [ascii = 13]) and: [event controlKeyPressed or: [event commandKeyPressed]]) ifTrue: [^ ActiveWorld toggleFullScreen]]. aSpecialKey _ aChar asciiValue. aSpecialKey < 32 ifTrue: [^ self specialKeyPressed: aSpecialKey]. (event anyModifierKeyPressed or: [self handlesBasicKeys not]) ifTrue: [^ self modifierKeyPressed: aChar]. ^ self basicKeyPressed: aChar! ! !SimpleHierarchicalListMorph methodsFor: 'private' stamp: 'yo 2/6/2008 12:03'! keyStroke: event "Process potential command keys" | args aCharacter ascii | aCharacter := event keyCharacter. (aCharacter = $, and: [event commandKeyPressed or: [event controlKeyPressed]]) ifTrue: [^ ActiveWorld showSourceKeyHit]. (aCharacter asciiValue = 92 and: [event commandKeyPressed]) ifTrue: ["cycle windows" ^ SystemWindow rotateWindows]. Preferences sugarNavigator ifTrue: [ ascii _ aCharacter charCode. ((ascii = 3 or: [ascii = 13]) and: [event controlKeyPressed or: [event commandKeyPressed]]) ifTrue: [ActiveWorld toggleFullScreen. ^ true]]. (self scrollByKeyboard: event) ifTrue: [^self]. (self arrowKey: aCharacter) ifTrue: [^true]. keystrokeActionSelector isNil ifTrue: [^false]. (args := keystrokeActionSelector numArgs) = 1 ifTrue: [^model perform: keystrokeActionSelector with: aCharacter]. args = 2 ifTrue: [^model perform: keystrokeActionSelector with: aCharacter with: self]. ^self error: 'The keystrokeActionSelector must be a 1- or 2-keyword symbol'! !