[Pkg] The Trunk: Morphic-nice.735.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jul 20 20:38:20 UTC 2014
Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-nice.735.mcz
==================== Summary ====================
Name: Morphic-nice.735
Author: nice
Time: 20 July 2014, 10:36:28.157 pm
UUID: add43698-a89f-480a-9bc6-9f8bac49558a
Ancestors: Morphic-cmm.734
Don't use RWBinaryOrTextStream where a simple WriteStream would perfectly do the job.
=============== Diff against Morphic-cmm.734 ===============
Item was changed:
----- Method: MorphicProject class>>compileNewDefaultBackgroundFrom: (in category 'utilities') -----
compileNewDefaultBackgroundFrom: aForm
"Compile a new #defaultBackgroundForm method in this class-side which uses aForm as the background."
+ | formStream base64 |
+ formStream := ByteArray new writeStream.
- | formStream base64Stream |
- formStream := RWBinaryOrTextStream on: ByteArray new.
PNGReadWriter
putForm: aForm
onStream: formStream.
+ base64 := formStream base64Encoded.
- base64Stream := Base64MimeConverter mimeEncode: formStream.
self class
compile:
(String streamContents:
[ : stream | stream
nextPutAll: 'defaultBackgroundForm
^ Form fromBinaryStream: ' ;
nextPut: $' ;
+ nextPutAll: base64 ;
- nextPutAll: base64Stream contents ;
nextPut: $' ;
nextPutAll: ' base64Decoded asByteArray readStream' ])
classified: 'class initialization'!
Item was changed:
----- Method: TextMorph>>getAllButFirstCharacter (in category 'scripting access') -----
getAllButFirstCharacter
"Obtain all but the first character from the receiver; if that would be empty, return a black dot"
| aString |
+ ^ (aString := text string) size > 1 ifTrue: [aString copyFrom: 2 to: aString size] ifFalse: ['·']!
- ^ (aString := text string) size > 1 ifTrue: [aString copyFrom: 2 to: aString size] ifFalse: ['·']!
Item was changed:
----- Method: TextMorph>>getFirstCharacter (in category 'accessing') -----
getFirstCharacter
"obtain the first character from the receiver if it is empty, return a
black dot"
| aString |
^ (aString := text string) isEmpty
+ ifTrue: ['·']
- ifTrue: ['·']
ifFalse: [aString first asString] !
Item was changed:
----- Method: TextMorph>>getLastCharacter (in category 'accessing') -----
getLastCharacter
"obtain the last character from the receiver if it is empty, return a black dot"
| aString |
+ ^ (aString := text string) size > 0 ifTrue: [aString last asString] ifFalse: ['·']!
- ^ (aString := text string) size > 0 ifTrue: [aString last asString] ifFalse: ['·']!
Item was changed:
----- Method: TextMorph>>setAllButFirstCharacter: (in category 'scripting access') -----
setAllButFirstCharacter: source
"Set all but the first char of the receiver to the source"
| aChar chars |
aChar := source asCharacter.
(chars := self getCharacters) isEmpty
+ ifTrue: [self newContents: '·' , source asString]
- ifTrue: [self newContents: '·' , source asString]
ifFalse: [chars first = aChar
ifFalse: [""
self
newContents: (String
streamContents: [:aStream |
aStream nextPut: chars first.
aStream nextPutAll: source])]] !
Item was changed:
----- Method: TheWorldMenu class>>loadSqueakMap (in category 'open-menu registry') -----
loadSqueakMap
+ "Load the externally-maintained SqueakMap package if it is not already loaded. Based on code by Göran Hultgren"
- "Load the externally-maintained SqueakMap package if it is not already loaded. Based on code by Göran Hultgren"
| server |
Socket initializeNetwork.
server := #('map1.squeakfoundation.org' 'map2.squeakfoundation.org' 'map.squeak.org' 'map.bluefish.se' 'marvin.bluefish.se:8000')
detect: [:srv | | addr answer |
addr := NetNameResolver addressForName: (srv upTo: $:) timeout: 5.
addr notNil and: [
answer := HTTPSocket httpGet: ('http://', srv, '/sm/ping').
answer isString not and: [answer contents = 'pong']]]
ifNone: [^ self inform: 'Sorry, no SqueakMap master server responding.'].
server ifNotNil: ["Ok, found an SqueakMap server"
ChangeSet newChangesFromStream:
((('http://', server, '/sm/packagebyname/squeakmap/downloadurl')
asUrl retrieveContents content) asUrl retrieveContents content unzipped
readStream)
named: 'SqueakMap']!
More information about the Packages
mailing list