[etoys-dev] Etoys Inbox: GSoC-Utils-Richo.1.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Aug 7 12:31:03 EDT 2010


A new version of GSoC-Utils was added to project Etoys Inbox:
http://source.squeak.org/etoysinbox/GSoC-Utils-Richo.1.mcz

==================== Summary ====================

Name: GSoC-Utils-Richo.1
Author: Richo
Time: 6 July 2010, 12:06:48 pm
UUID: 04cd4198-0d2c-594f-809b-69ff652ecae3
Ancestors: 

* Splitting GSoC package

==================== Snapshot ====================

SystemOrganization addCategory: #'GSoC-Utils'!

TextMorph subclass: #GSoCTextMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'GSoC-Utils'!

!GSoCTextMorph commentStamp: '<historical>' prior: 0!
TextMorph that changes the focus to the next object when pressing <Enter>. It also changes the border color when has focus.
I know a whole new class for these purposes only it's ugly but I don't know how to do this easily using just TextMorph.!

----- Method: GSoCTextMorph>>getNumericValue (in category 'as yet unclassified') -----
getNumericValue
 | result |
^[result := Compiler evaluate: text string notifying: SyntaxErrorOmission new logged: false.
	result isNumber ifTrue: [result] ifFalse: [0]] on: Error do: [0]!

----- Method: GSoCTextMorph>>handleKeystroke: (in category 'as yet unclassified') -----
handleKeystroke: anEvent
	"System level event handling."

	| pasteUp |
	anEvent wasHandled ifTrue:[^self].
	(self handlesKeyboard: anEvent) ifFalse:	[^ self].
	anEvent wasHandled: true.
	((anEvent keyCharacter = Character tab) or: [anEvent keyCharacter = Character cr]) ifTrue:
		["Allow passing through text morph inside pasteups"
		(self wouldAcceptKeyboardFocusUponTab and:
				[(pasteUp _ self pasteUpMorphHandlingTabAmongFields) notNil])
			ifTrue:[^ pasteUp tabHitWithEvent: anEvent]].
	self keyStroke: anEvent!

----- Method: GSoCTextMorph>>initialize (in category 'as yet unclassified') -----
initialize
super initialize.!

----- Method: GSoCTextMorph>>keyboardFocusChange: (in category 'as yet unclassified') -----
keyboardFocusChange: aBoolean 
super keyboardFocusChange: aBoolean.
aBoolean ifTrue: [self borderColor: Color red]  ifFalse: [self borderColor: Color black]!

----- Method: GSoCTextMorph>>setExtentFromHalo: (in category 'as yet unclassified') -----
setExtentFromHalo: aPoint
	super setExtentFromHalo: aPoint.
	(owner respondsTo: #notifyExtentChange:) ifTrue: [owner notifyExtentChange: self]!

Object subclass: #SyntaxErrorOmission
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'GSoC-Utils'!

!SyntaxErrorOmission commentStamp: 'Richo 5/16/2010 13:41' prior: 0!
This object is only used to avoid a SyntaxError dialog when doing Compiler>>#evaluate:notifying:logged:. It simply omits the message.
The Compiler stuff is done in the table morphs to get a number from the text. I know it should be easy to simply sent #asNumber to the string, but I did it this way because it allows to write stuff like:

'Float pi'
'(11/9)'
'15 * 6'!

----- Method: SyntaxErrorOmission>>notify:at:in: (in category 'as yet unclassified') -----
notify: aByteString at: aSmallInteger in: aReadStream 
!

----- Method: SyntaxErrorOmission>>selectionInterval (in category 'as yet unclassified') -----
selectionInterval
^(0 to: 0)!

----- Method: SyntaxErrorOmission>>text (in category 'as yet unclassified') -----
text
^Text new!

ScrollPane subclass: #GSoCScrollPane
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'GSoC-Utils'!

!GSoCScrollPane commentStamp: '<historical>' prior: 0!
A ScrollPane that defers its halo to interior!

----- Method: GSoCScrollPane>>defersHaloToInteriorMorph: (in category 'as yet unclassified') -----
defersHaloToInteriorMorph: aMorph
^true!



More information about the etoys-dev mailing list