[MorphicWrappers] First fix for 3.7

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Tue Oct 4 11:01:25 UTC 2005


For the few MorphicWrappers enthusiasts.
Here the first fix for 3.7 to last port by Francisco Garau labelled 3.6
compatible.
With this you could copy text external to image (in my case I copy the text
from another running image) and pressing TAB (what start "aerial mode") you
could paste via Clipboard and work as designed by Luciano and Gerardo (I
hope)

If someone have a copy of any Mac video recording software what I could use
for doing the tutorials, send email to me off list.

Edgar

-------------- next part --------------
'From Squeak3.7 of ''4 September 2004'' [latest update: #5988] on 4 October 2005 at 7:47:23 am'!
"Change Set:		MorphicWrappersFixesFor3.7
Date:			4 October 2005
Author:			Edgar J. De Cleene

This is a little fix for when you copy some text external to image and whish do paste in aerial mode via Clipboard"!


!Morph methodsFor: 'morphic wrappers' stamp: 'edc 10/4/2005 07:28'!
acceptBalloon: aCodeBalloon 
	| fail result hnd |
	hnd := aCodeBalloon target.
	aCodeBalloon delete.
	fail := Object new.
	result := Compiler new
				evaluate: aCodeBalloon string intendedMessage
				in: nil
				to: self receiver
				notifying: aCodeBalloon string
				ifFail: [fail].
	result == fail
		ifTrue: [hnd attachMorph: aCodeBalloon;
			 newKeyboardFocus: aCodeBalloon]
		ifFalse: 
			[result := result asMorph.
			aCodeBalloon target newKeyboardFocus: nil.
			aCodeBalloon contents asString withBlanksTrimmed last = $.
				ifFalse: [result == self
						ifTrue: [self shake]
						ifFalse: [result runAndAttachTo: hnd]]]! !


!EditableStringMorph methodsFor: 'editing' stamp: 'edc 10/4/2005 07:24'!
paste
	self contents: (contents insert: Clipboard clipboardText at: self cursor)! !


!CodeStringMorph methodsFor: 'private' stamp: 'edc 10/4/2005 07:25'!
intendedMessage
	"Should we add 'self' or not?"
	| aString string first beginning strm var index receiver |
	aString := self contents.
	string := aString asString withBlanksTrimmed.
	string isEmpty ifTrue: [^ aString].
	first := string first.
	beginning := string firstAlphaNumericSubstring.

	"Globals"
	(Smalltalk includesKey: beginning asSymbol)
		ifTrue: [^ aString].

	"Uppercases"
	first isUppercase ifTrue: [^ aString].

	"Reserved names"
	"ClassBuilder new reservedNames"
	(#('true' 'false' 'nil' 'thisContext') includes: beginning) ifTrue: [^ string].

	"numbers"
	first isDigit ifTrue: [^ aString].

	"self"
	string = 'self' ifTrue: [^ aString].
	(string beginsWith: 'self ')
		ifTrue: [^ aString].

	"super"
	string = 'super' ifTrue: [^ aString].
	(string beginsWith: 'super ')
		ifTrue: [^ aString].

	"special symbols"
	(#($( $' $# $$ ${ $[) includes: first)
		ifTrue: [^ aString].

	"$_ assignemts"
	strm := ReadStream on: aString.
	var := (strm nextDelimited: $_) withBlanksTrimmed.
	((var includes: $ )
		or: [strm atEnd])
		ifFalse: [^ aString].

	"':=' asignments"
	index := string findString: ':='.
	strm reset; upTo: $ ; skipSeparators.
	(strm position >= (index - 1) and: [index > 0])
		ifTrue: [^ aString].

	"bindings"
	(World bindings includesKey: beginning)
		ifTrue: [^ string].

	receiver := target receiver.
	"inst var names"
	((receiver class allInstVarNames includes: string)
		and: [(receiver respondsTo: string asSymbol) not]) ifTrue: [^ string].

	"Parser conflicts"
	(first = $- and: [(receiver respondsTo: #-) not])
		ifTrue: [^ string].

	^ 'self ' , aString
! !



More information about the Squeak-dev mailing list