Skip to content

Instantly share code, notes, and snippets.

@mumez
Last active August 29, 2015 14:11
Show Gist options
  • Save mumez/8390779c2913bfec79ff to your computer and use it in GitHub Desktop.
Save mumez/8390779c2913bfec79ff to your computer and use it in GitHub Desktop.
'From MIT Squeak 0.9.4 (June 1, 2003) [No updates present.] on 23 December 2014 at 12:20:55 pm'!
!IPhoneScratchProxy methodsFor: '*PyonTalk-actions-override' stamp: 'mu 12/18/2014 23:16'!
setViewModeIndex: viewModeNumber
"[self basicSetViewModeIndex: viewModeNumber] fork"
viewModeNumber caseOf: {
[0]->[Transcript open].
[1]->[Workspace open].
[2]->[Browser openBrowser].
}! !
!IPhoneScratchProxy class methodsFor: '*PyonTalk-opening-override' stamp: 'mu 12/18/2014 23:13'!
prepareScratchFrameMorphBeforeOpen
SqueakProxy scratchMorphic: ScratchFrameMorph allInstances first.
SqueakProxy scratchMorphic setupTheLanguageOnThisDevice.
SqueakProxy scratchMorphic fillScreenOff.
Preferences useLargeFonts
! !
!MorphicEvent methodsFor: '*PyonTalk-override' stamp: 'mu 12/23/2014 11:23'!
blueButtonPressed
"Answer true if the blue mouse button is being pressed. This is the third mouse button or cmd+click on the Mac."
^ (buttons anyMask: 1) or: [self reserved = 3] ! !
!MorphicEvent methodsFor: '*PyonTalk-override' stamp: 'mu 12/23/2014 11:22'!
rightButtonPressed
"Answer true if the right mouse button is pressed. On Mac's, this is sometimes reported as the blue button or control-red-button. On Windows, this this is mapped to the yellow button. Answer true for any of these cases."
^ (buttons anyMask: 3) or:
[self redButtonPressed & self controlKeyPressed]
or: [IPhonePresentationSpaceKeyState isCommandPressed]
! !
!PluggableListMorph methodsFor: '*PyonTalk-events-keyboard-override' stamp: 'mu 12/17/2014 22:49'!
specialKeyPressed: asciiValue
| oldSelection nextSelection max howManyItemsShowing |
nextSelection _ oldSelection _ self getCurrentSelectionIndex.
max _ self maximumSelection.
asciiValue == 27 ifTrue: [
self yellowButtonActivity: false.
].
asciiValue == 31
ifTrue:
[" down arrow"
nextSelection _ oldSelection + 1.
nextSelection > max ifTrue: [nextSelection _ 1]].
asciiValue == 30
ifTrue:
[" up arrow"
nextSelection _ oldSelection - 1.
nextSelection < 1 ifTrue: [nextSelection _ max]].
asciiValue == 1 ifTrue: [" home"
nextSelection _ 1].
asciiValue == 4 ifTrue: [" end"
nextSelection _ max].
howManyItemsShowing _ self numSelectionsInView.
asciiValue == 11 ifTrue: [" page up"
nextSelection _ 1 max: oldSelection - howManyItemsShowing].
asciiValue == 12 ifTrue: [" page down"
nextSelection _ oldSelection + howManyItemsShowing min: max].
model okToChange ifFalse: [^ self].
"No change if model is locked"
oldSelection == nextSelection ifTrue: [^ self flash].
^ self changeModelSelection: nextSelection! !
!TextMorphForEditView methodsFor: '*PyonTalk-events-override' stamp: 'mu 12/20/2014 22:55'!
keyStroke: evt
| view |
evt keyValue == 27 ifTrue: [
^ editView yellowButtonActivity.
].
evt keyValue == 24 ifTrue: [
^ editView doIt.
].
evt keyValue == 25 ifTrue: [
^ editView printIt.
].
evt keyValue == 26 ifTrue: [
^ editView inspectIt.
].
(editView scrollByKeyboard: evt) ifTrue: [^self].
self editor model: editView model. "For evaluateSelection"
view _ editView. "Copy into temp for case of a self-mutating doit"
(acceptOnCR and: [evt keyCharacter = Character cr])
ifTrue: [^ self editor accept].
super keyStroke: evt.
view scrollSelectionIntoView! !
@mumez
Copy link
Author

mumez commented Dec 22, 2014

A simple .cs for uncovering Smalltalk under Pyonkee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment