'From etoys2.2 of 1 October 2007 [latest update: #1737] on 31 October 2007 at 2:57:55 am'! "Change Set: BigPaintBox-ka Date: 31 October 2007 Author: Kazuhiro Abe This patch makes a PaintBox big. (1.5X)"! !PaintBoxMorph methodsFor: 'actions' stamp: 'ka 10/31/2007 02:56'! eyedropper: aButton action: aSelector cursor: aCursor evt: evt "Take total control and pick up a color!!!!" | pt feedbackColor delay | delay _ Delay forMilliseconds: 10. aButton state: #on. tool ifNotNil: [tool state: #off]. currentCursor := aCursor. evt hand showTemporaryCursor: currentCursor hotSpotOffset: 6 negated @ 4 negated. "<<<< the form was changed a bit??" feedbackColor := Display colorAt: Sensor cursorPoint. colorMemory align: colorMemory bounds topRight with: colorMemoryThin bounds topRight. self addMorphFront: colorMemory. colorMemory changed. "Full color picker" [Sensor anyButtonPressed] whileFalse: [pt := Sensor cursorPoint. "deal with the fact that 32 bit displays may have garbage in the alpha bits" feedbackColor := Display depth = 32 ifTrue: [Color colorFromPixelValue: ((Display pixelValueAt: pt) bitOr: 4278190080) depth: 32] ifFalse: [Display colorAt: pt]. "the hand needs to be drawn" evt hand position: pt. currentColor ~= feedbackColor ifTrue: [ currentColor _ feedbackColor. self showColor ]. self world displayWorldSafely. delay wait]. "Now wait for the button to be released." [Sensor anyButtonPressed] whileTrue: [ pt := Sensor cursorPoint. "the hand needs to be drawn" evt hand position: pt. self world displayWorldSafely. delay wait]. evt hand showTemporaryCursor: nil hotSpotOffset: 0 @ 0. self currentColor: feedbackColor evt: evt. colorMemory delete. tool ifNotNil: [tool state: #on. currentCursor := tool arguments third]. aButton state: #off ! ! !PaintBoxMorph methodsFor: 'actions' stamp: 'ka 10/30/2007 22:46'! showColorPalette: evt | w box | self comeToFront. colorMemory align: colorMemory bounds topRight with: colorMemoryThin bounds topRight. "make sure color memory fits or else align with left" w _ self world. box _ self bounds: colorMemory fullBounds in: w. box left < 0 ifTrue:[ colorMemory align: colorMemory bounds topLeft with: colorMemoryThin bounds topLeft]. self addMorphFront: colorMemory. self changed! ! !PaintBoxMorph methodsFor: 'actions' stamp: 'ka 10/30/2007 22:42'! toggleShapes | tab sh stamps | "The sub panel that has the shape tools on it. Rect, line..." stamps _ self submorphNamed: 'stamps'. tab _ self submorphNamed: 'shapeTab'. (sh _ self submorphNamed: 'shapes') visible ifTrue: [sh hide. tab top: stamps bottom-1] ifFalse: [sh comeToFront. sh top: stamps bottom-9. sh show. tab top: sh bottom - tab height + 10]. self layoutChanged. self changed ! ! !PaintBoxMorph methodsFor: 'actions' stamp: 'ka 10/30/2007 22:42'! toggleStamps | tab otherTab st shapes | "The sub panel that has the stamps in it. For saving and moving parts of an image." shapes _ self submorphNamed: 'shapes'. otherTab _ self submorphNamed: 'shapeTab'. tab _ self submorphNamed: 'stampTab'. (st _ self submorphNamed: 'stamps') visible ifTrue: [st hide. st bottom: self bottom. tab top: self bottom-1. shapes top: self bottom-9. otherTab top: (shapes visible ifTrue: [shapes bottom - otherTab height + 10] ifFalse: [self bottom-1])] ifFalse: [st top: self bottom-10. st show. tab top: st bottom-0. shapes top: st bottom-9. otherTab top: (shapes visible ifTrue: [shapes bottom - otherTab height + 10] ifFalse: [st bottom-0])]. self layoutChanged. self changed! ! !PaintBoxMorph methodsFor: 'initialization' stamp: 'ka 10/31/2007 00:21'! beSupersized | scaleFactor | scaleFactor := 1.5. self isFlexed ifFalse: [self scaleFactor: scaleFactor. self position: self position / scaleFactor. self changed]! ! !PaintBoxMorph methodsFor: 'initialization' stamp: 'ka 10/30/2007 23:03'! delete "Delete the receiver." self isFlexed ifTrue: [^ owner delete]. ^ super delete! ! !SketchEditorMorph methodsFor: 'initialization' stamp: 'ka 10/31/2007 00:04'! initializeFor: aSketchMorph inBounds: boundsToUse pasteUpMorph: aPasteUpMorph paintBoxPosition: aPosition "NB: if aPosition is nil, then it's assumed that the paintbox is obtained from a flap or some such, so do nothing special regarding a palette in this case. The palette needs already to be in the world for this to work." | w | (w _ aPasteUpMorph world) addMorphInLayer: self. "in back of palette" enclosingPasteUpMorph _ aPasteUpMorph. hostView _ aSketchMorph. "may be ownerless" self bounds: boundsToUse. palette _ w paintBox focusMorph: self. palette beStatic. "give Nebraska whatever help we can" palette fixupButtons. palette addWeakDependent: self. aPosition ifNotNil: [w addMorphFront: palette. "bring to front" palette position: aPosition. palette beSupersized]. paintingForm _ Form extent: bounds extent depth: w assuredCanvas depth. self dimTheWindow. self addRotationScaleHandles. aSketchMorph ifNotNil: [aSketchMorph form displayOn: paintingForm at: (paintingForm extent - aSketchMorph form extent // 2) clippingBox: (0@0 extent: paintingForm extent) rule: Form over fillColor: nil. "assume they are the same depth". undoBuffer _ paintingForm deepCopy. rotationCenter _ aSketchMorph rotationCenter]! !