[ENH] backgrounds and numbers with commas

Lex Spoon lex at cc.gatech.edu
Wed Dec 8 21:23:05 UTC 1999


Two quick ideas.  How about having new projects pick up a background
image or color from their current project?  I tend to have 5-7 projects
hanging around, and they are mostly plain white just because I don't
want to go decorate them individually.  Here's a small tweak to make
this work for morphic projects; I'm sure it's not *too* hard to expand
this to to work for a mixture of MVC and Morphic:

PasteUpMorph>>initForProject: aWorldState 
	worldState _ aWorldState.
	color _ Color
				r: 0.937
				g: 0.937
				b: 0.937.
	fillColor2 _ color.
	self currentWorld ifNotNil: [ color _ self currentWorld color ].
	self addHand: HandMorph new.
	self setProperty: #automaticPhraseExpansion toValue: true.
	model _ nil

Heck, best of all would be to be able to mark certain projects as taking
the "default" background color/image, and to have a way to set that
color/image somewhere and propogate it.


Second, how about allowing embedded commas inside of numbers?  This
would allow people to write "1,000,000" instead of "1000000".  The
former seems much easier to me to read.  Does anyone need to be sending
the comma message to a number??  An ideal fix would actually check that
people put three digits between each number (avoiding things like
'10,3188'), but here's a patch which allows commas at all:


readFrom: aStream base: base 
	"Answer an instance of one of my concrete subclasses. Initial minus
sign 
	accepted, and bases > 10 use letters A-Z. Embedded radix specifiers not

	allowed--use Number readFrom: for that. Answer zero (not an error) if 
	there are no digits."

	| digit value neg startPos char |
	neg _ aStream peekFor: $-.
	neg ifFalse: [aStream peekFor: $+].
	value _ 0.
	startPos _ aStream position.
	[aStream atEnd]
		whileFalse: 
			[
			char _ aStream next.
			char = $, ifFalse: [
				digit _char digitValue.
				(digit < 0 or: [digit >= base])
					ifTrue: 
						[aStream skip: -1.
						aStream position = startPos ifTrue: [self error: 'At least one
digit expected here'].
						neg ifTrue: [^ value negated].
						^ value]
					ifFalse: [value _ value * base + digit]]].
	neg ifTrue: [^ value negated].
	^ value





-Lex





More information about the Squeak-dev mailing list