[Pkg] The Trunk: MorphicExtras-nice.98.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Dec 29 15:18:44 UTC 2010
Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-nice.98.mcz
==================== Summary ====================
Name: MorphicExtras-nice.98
Author: nice
Time: 29 December 2010, 4:18:13.421 pm
UUID: a61e9f05-6a6f-4590-a274-18423b8336f5
Ancestors: MorphicExtras-cmm.97
Add a few spaces in order to avoid Transcript warnings about @- ambiguity when recompiling.
=============== Diff against MorphicExtras-cmm.97 ===============
Item was changed:
----- Method: FlapTab>>fitContents (in category 'misc') -----
fitContents
self isCurrentlyTextual ifFalse: [^ super fitContents].
self ifVertical:
+ [self extent: submorphs first extent + (2 * self borderWidth) + (0 @ 4).
+ submorphs first position: self position + self borderWidth + (1 @ 4)]
- [self extent: submorphs first extent + (2 * self borderWidth) + (0 at 4).
- submorphs first position: self position + self borderWidth + (1 at 4)]
ifHorizontal:
+ [self extent: submorphs first extent + (2 * self borderWidth) + (8 @ -1).
+ submorphs first position: self position + self borderWidth + (5 @ 1)]!
- [self extent: submorphs first extent + (2 * self borderWidth) + (8 at -1).
- submorphs first position: self position + self borderWidth + (5 at 1)]!
Item was changed:
----- Method: PaintBoxMorph>>fixUpColorPicker (in category 'recent colors') -----
fixUpColorPicker
| chart picker |
+ chart := ColorChart ifNil: [ColorChart := Cursor wait showWhile: [(ColorPickerMorph colorPaletteForDepth: 16 extent: 120 @ 89)]].
- chart := ColorChart ifNil:[Cursor wait showWhile:[ColorChart := (ColorPickerMorph colorPaletteForDepth: 16 extent: 120 at 89)]].
chart getCanvas frameRectangle: chart boundingBox color: Color black.
+ picker := Form extent: (chart extent + (14 @ 12)) depth: 16.
- picker := Form extent: (chart extent + (14 at 12)) depth: 16.
picker fillWhite.
"top"
+ picker copy: (0 @ 0 extent: picker width @ 6)
+ from: (colorMemory image width - picker width) @ 0
- picker copy: (0 at 0 extent: picker width at 6)
- from: (colorMemory image width - picker width)@0
in: colorMemory image rule: Form over.
"bottom"
+ picker copy: (0 @ (picker height - 6) extent: picker width @ 6)
+ from: (colorMemory image width - picker width) @ (colorMemory image height - 7)
- picker copy: (0@ (picker height-6) extent: picker width at 6)
- from: (colorMemory image width - picker width)@(colorMemory image height - 7)
in: colorMemory image rule: Form over.
"left"
+ picker copy: (0 @ 6 corner: 8 @ (picker height - 6))
+ from: (colorMemory image boundingBox topLeft + (0 @ 6))
- picker copy: (0 at 6 corner: 8@(picker height - 6))
- from: (colorMemory image boundingBox topLeft + (0 at 6))
in: colorMemory image rule: Form over.
"right"
+ picker copy: (picker width-6 @ 6 corner: picker width @ (picker height - 6))
+ from: (colorMemory image boundingBox topRight - (6 @ -6))
- picker copy: (picker width-6 at 6 corner: picker width@(picker height - 6))
- from: (colorMemory image boundingBox topRight - (6 at -6))
in: colorMemory image rule: Form over.
+ chart displayOn: picker at: 8 @ 6.
- chart displayOn: picker at: 8 at 6.
picker getCanvas frameRectangle: picker boundingBox color: Color black.
colorMemory image: picker.
!
Item was changed:
----- Method: PaintBoxMorph>>init4 (in category 'initialization') -----
init4
"Just a record of how Ted loaded in the paintbox button images, Feb 98"
+ | bb im pp newImage pic24Bit picNewBit blt |
- | bb im pp newImage pic24Bit picNewBit blt |
+ "self loadoffImage: 'roundedPalette3.bmp'."
+ pic24Bit := GIFReadWriter formFromServerFile: 'updates/137roundedPalette3.bmp'.
+ picNewBit := Form extent: pic24Bit extent depth: 16.
+ pic24Bit displayOn: picNewBit.
+ OriginalBounds := picNewBit boundingBox.
+ AllOffImage := Form extent: OriginalBounds extent depth: 16.
+ blt := BitBlt current toForm: AllOffImage.
+ blt sourceForm: picNewBit; combinationRule: Form over;
+ sourceRect: OriginalBounds; destOrigin: 0 @ 0; copyBits.
- "self loadoffImage: 'roundedPalette3.bmp'."
- pic24Bit := GIFReadWriter formFromServerFile: 'updates/137roundedPalette3.bmp'.
- picNewBit := Form extent: pic24Bit extent depth: 16.
- pic24Bit displayOn: picNewBit.
- OriginalBounds := picNewBit boundingBox.
- AllOffImage := Form extent: OriginalBounds extent depth: 16.
- blt := BitBlt current toForm: AllOffImage.
- blt sourceForm: picNewBit; combinationRule: Form over;
- sourceRect: OriginalBounds; destOrigin: 0 at 0; copyBits.
+ AllOffImage mapColor: Color transparent to: Color black.
+ self image: AllOffImage.
+ self invalidRect: bounds.
- AllOffImage mapColor: Color transparent to: Color black.
- self image: AllOffImage.
- self invalidRect: bounds.
+ self submorphsDo: [:button | button position: button position + (10 @ 10)].
+ (im := submorphs at: 28) class == ImageMorph ifTrue: [
+ im position: im position + (2 @ 0)]. "color picker"
+ "exercise it once"
- self submorphsDo: [:button | button position: button position + (10 at 10)].
- (im := submorphs at: 28) class == ImageMorph ifTrue: [
- im position: im position + (2 at 0)]. "color picker"
- "exercise it once"
+ (bb := self submorphNamed: #keep:) position: bb position + (0 @ 25).
+ (bb := self submorphNamed: #toss:) position: bb position + (0 @ 25).
+ (bb := self submorphNamed: #undo:) position: bb position + (0 @ -25).
+ (bb := self submorphNamed: #clear:) position: bb position + (0 @ -25).
+ (bb := self submorphNamed: #undo:) position: bb position + (0 @ -69).
+ (bb := self submorphNamed: #clear:) position: bb position + (0 @ -69).
+ self submorphsDo: [:button |
+ button class == AlignmentMorph ifTrue: [
+ button position: button position + (0 @ 25)].
+ (button printString includesSubString: 'stamp:') ifTrue: [
+ button position: button position + (0 @ 25)]].
+ (bb := self submorphNamed: #prevStamp:) position: bb position + (0 @ 25).
+ (bb := self submorphNamed: #nextStamp:) position: bb position + (0 @ 25).
- (bb := self submorphNamed: #keep:) position: bb position + (0 at 25).
- (bb := self submorphNamed: #toss:) position: bb position + (0 at 25).
- (bb := self submorphNamed: #undo:) position: bb position + (0 at -25).
- (bb := self submorphNamed: #clear:) position: bb position + (0 at -25).
- (bb := self submorphNamed: #undo:) position: bb position + (0 at -69).
- (bb := self submorphNamed: #clear:) position: bb position + (0 at -69).
- self submorphsDo: [:button |
- button class == AlignmentMorph ifTrue: [
- button position: button position + (0 at 25)].
- (button printString includesSubString: 'stamp:') ifTrue: [
- button position: button position + (0 at 25)]].
- (bb := self submorphNamed: #prevStamp:) position: bb position + (0 at 25).
- (bb := self submorphNamed: #nextStamp:) position: bb position + (0 at 25).
+ bb := self submorphNamed: #keep:.
+ newImage := bb pressedImage copy: (0 @ 4 corner: (bb pressedImage boundingBox extent)).
+ bb onImage: newImage. bb pressedImage: newImage. bb extent: newImage extent.
+ bb position: bb position + (4 @ 1).
- bb := self submorphNamed: #keep:.
- newImage := bb pressedImage copy: (0 at 4 corner: (bb pressedImage boundingBox extent)).
- bb onImage: newImage. bb pressedImage: newImage. bb extent: newImage extent.
- bb position: bb position + (4 at 1).
+ pp := (bb := self submorphNamed: #toss:) pressedImage.
+ newImage := pp copy: (0 @ 4 corner: (bb pressedImage extent - (3 @ 0))).
+ bb onImage: newImage. bb pressedImage: newImage.
+ bb extent: newImage extent.
+ bb position: bb position + (3 @ 1).
- pp := (bb := self submorphNamed: #toss:) pressedImage.
- newImage := pp copy: (0 at 4 corner: (bb pressedImage extent - (3 at 0))).
- bb onImage: newImage. bb pressedImage: newImage.
- bb extent: newImage extent.
- bb position: bb position + (3 at 1).
+ pp := (bb := self submorphNamed: #undo:) pressedImage.
+ newImage := pp copy: (0 @ 0 corner: (bb pressedImage extent - (3 @ 5))).
+ bb onImage: newImage. bb pressedImage: newImage.
+ bb extent: newImage extent.
+ bb position: bb position + (3 @ -1).
- pp := (bb := self submorphNamed: #undo:) pressedImage.
- newImage := pp copy: (0 at 0 corner: (bb pressedImage extent - (3 at 5))).
- bb onImage: newImage. bb pressedImage: newImage.
- bb extent: newImage extent.
- bb position: bb position + (3 at -1).
+ pp := (bb := self submorphNamed: #clear:) pressedImage.
+ newImage := pp copy: (0 @ 0 corner: (bb pressedImage extent - (0 @ 5))).
+ bb onImage: newImage. bb pressedImage: newImage.
+ bb extent: newImage extent.
+ bb position: bb position + (3 @ -1).
- pp := (bb := self submorphNamed: #clear:) pressedImage.
- newImage := pp copy: (0 at 0 corner: (bb pressedImage extent - (0 at 5))).
- bb onImage: newImage. bb pressedImage: newImage.
- bb extent: newImage extent.
- bb position: bb position + (3 at -1).
+ pic24Bit := GIFReadWriter formFromServerFile: 'updates/137pencil.bmp'.
+ picNewBit := Form extent: pic24Bit extent depth: 16.
+ pic24Bit displayOn: picNewBit.
+ newImage := picNewBit as8BitColorForm.
+ newImage transparentColor: (Color r: 0 g: 0 b: 0).
+ (bb := self submorphNamed: #erase:) pressedImage: newImage; onImage: newImage;
+ extent: newImage extent.
- pic24Bit := GIFReadWriter formFromServerFile: 'updates/137pencil.bmp'.
- picNewBit := Form extent: pic24Bit extent depth: 16.
- pic24Bit displayOn: picNewBit.
- newImage := picNewBit as8BitColorForm.
- newImage transparentColor: (Color r: 0 g: 0 b: 0).
- (bb := self submorphNamed: #erase:) pressedImage: newImage; onImage: newImage;
- extent: newImage extent.
+ bb position: bb position + (-11 @ -1).
- bb position: bb position + (-11 at -1).
!
Item was changed:
----- Method: PianoKeyboardMorph>>buildKeyboard (in category 'simple keyboard') -----
buildKeyboard
| wtWid bkWid keyRect octavePt nWhite nBlack |
self removeAllMorphs.
wtWid := 8. bkWid := 5.
+ self extent: 10 @ 10.
+ 1 to: nOctaves + 1 do:
- self extent: 10 at 10.
- 1 to: nOctaves+1 do:
[:i | i <= nOctaves ifTrue: [nWhite := 7. nBlack := 5]
ifFalse: [nWhite := 1. nBlack := 0 "High C"].
+ octavePt := self innerBounds topLeft + ((7 * wtWid * (i - 1) - 1) @ -1).
- octavePt := self innerBounds topLeft + ((7*wtWid*(i-1)-1)@-1).
1 to: nWhite do:
+ [:j | keyRect := octavePt + (j - 1 * wtWid @ 0) extent: (wtWid + 1) @ 36.
- [:j | keyRect := octavePt + (j-1*wtWid at 0) extent: (wtWid+1)@36.
self addMorph: ((RectangleMorph newBounds: keyRect color: whiteKeyColor)
borderWidth: 1;
on: #mouseDown send: #mouseDownPitch:event:noteMorph: to: self
+ withValue: i - 1 * 12 + (#(1 3 5 6 8 10 12) at: j))].
- withValue: i-1*12 + (#(1 3 5 6 8 10 12) at: j))].
1 to: nBlack do:
+ [:j | keyRect := octavePt + ((#(6 15 29 38 47) at: j) @ 1) extent: bkWid @ 21.
- [:j | keyRect := octavePt + ((#(6 15 29 38 47) at: j)@1) extent: bkWid at 21.
self addMorph: ((Morph newBounds: keyRect color: blackKeyColor)
on: #mouseDown send: #mouseDownPitch:event:noteMorph: to: self
+ withValue: i - 1 * 12 + (#(2 4 7 9 11) at: j))]].
- withValue: i-1*12 + (#(2 4 7 9 11) at: j))]].
self submorphsDo:
[:m | m on: #mouseMove send: #mouseMovePitch:event:noteMorph: to: self;
on: #mouseUp send: #mouseUpPitch:event:noteMorph: to: self;
on: #mouseEnterDragging send: #mouseDownPitch:event:noteMorph: to: self;
on: #mouseLeaveDragging send: #mouseUpPitch:event:noteMorph: to: self].
self extent: (self fullBounds extent + borderWidth - 1)!
Item was changed:
----- Method: PostscriptDummyWarp>>subCanvas: (in category 'dummy') -----
subCanvas:patchRect
subCanvas ifNil:
+ [ subCanvas := PostscriptCanvas new reset setOrigin:patchRect topLeft clipRect: (-10000 @ -10000 extent: 20000 @ 20000)].
- [ subCanvas := PostscriptCanvas new reset setOrigin:patchRect topLeft clipRect:(-10000 at -10000 extent:20000 at 20000)].
^subCanvas.
!
More information about the Packages
mailing list