'From etoys2.1 of 26 July 2007 [latest update: #1596] on 10 September 2007 at 3:50:44 pm'! "Change Set: QuickGuide4-yo Date: 10 September 2007 Author: Yoshiki Ohshima Compress guide data."! !BookMorph methodsFor: 'fileIn/out' stamp: 'yo 9/10/2007 15:13'! storeAsDataStream self storeAsDataStreamNamed: Project current name, '.sexp.data.gz'.! ! !BookMorph methodsFor: 'fileIn/out' stamp: 'yo 9/10/2007 15:44'! storeAsDataStreamNamed: zippedFileName | f d bytes zipped | bytes _ WriteStream on: ByteArray new. d _ DataStream on: bytes. d nextPut: self pagesAndColorInSISSFormat. d close. f _ FileStream newFileNamed: zippedFileName. f binary; setFileTypeToObject. zipped _ GZipWriteStream on: f. zipped nextPutAll: bytes contents. zipped close. f close ! ! !QuickGuideHolderMorph methodsFor: 'file in/file out' stamp: 'yo 9/10/2007 15:44'! load | dir m fileName f unzipped zipped | self submorphs size > 0 ifTrue: [^ self]. dir _ (FileDirectory on: (Smalltalk imagePath)) directoryNamed: 'QuickGuides'. fileName _ guideName, '.sexp.data.gz'. (dir fileNames includes: fileName) ifFalse: [ ^ self ]. unzipped _ WriteStream on: ByteArray new. f _ dir readOnlyFileNamed: fileName. zipped _ GZipReadStream on: f. unzipped nextPutAll: zipped contents. m _ BookMorph bookFromPagesInSISSFormat: (DataStream on: (ReadStream on: (unzipped contents))) next. m position: 0@0. self position: 0@0. self extent: m extent. m setNamePropertyTo: guideName. m beSticky. self addMorph: m. ! ! !QuickGuideMorph class methodsFor: 'initialization' stamp: 'yo 9/10/2007 15:34'! convertProjectsWithBooksToSISSIn: dir to: outDir | p book texts desc | Thumbnails _ Dictionary new. Descriptions _ Dictionary new. Colors _ Dictionary new. dir fileNames do: [:f | (f endsWith: '.pr') ifTrue: [ p _ ProjectLoading loadName: f stream: (dir readOnlyFileNamed: f) fromDirectory: dir withProjectView: nil. book _ p world submorphs detect: [:b | b isMemberOf: BookMorph] ifNone: [nil]. book ifNotNil: [ texts _ book currentPage submorphs select: [:e | e isKindOf: TextMorph]. desc _ texts isEmpty ifTrue: ['A Guide' translated] ifFalse: [(texts asSortedCollection: [:x :y | x top < y top]) first contents asString]. Descriptions at: p name put: desc. Thumbnails at: p name put: (book imageForm magnifyBy: 0.25). Colors at: p name put: book color. book storeAsDataStreamNamed: (outDir fullNameFor: p name, '.sexp.data.gz'). ]. p okToChangeSilently. ]. ]. ! ! !QuickGuideMorph class methodsFor: 'defaults' stamp: 'yo 9/10/2007 15:38'! defaultOrder | dir | dir _ (FileDirectory on: (Smalltalk imagePath)) directoryNamed: 'QuickGuides'. ^ (dir fileNames select: [:f | f endsWith: '.sexp.data.gz']) collect: [:f | f copyFrom: 1 to: f size - '.sexp.data.gz' size].! !