<div dir="ltr">Seems to be fixed, thanks Nicolas.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 13, 2013 at 3:53 PM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/MorphicExtras-nice.138.mcz" target="_blank">http://source.squeak.org/trunk/MorphicExtras-nice.138.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: MorphicExtras-nice.138<br>
Author: nice<br>
Time: 13 December 2013, 10:52:51.312 pm<br>
UUID: 7341d071-8e59-4440-a218-079102d11bfe<br>
Ancestors: MorphicExtras-nice.137<br>
<br>
PaintBoxMorph re-engineering:<br>
1) Initialize more PaintBoxMorph newPrototype instance variables.<br>
2) Remove unused colorPatch instance variable.<br>
The two methods in which it appears are unsent, or more exactly they both have an alternate implementor which only send to self.<br>
3) Avoid highlighting the brush buttons onImage with a cyan/light blue square again and again.<br>
The Prototype is already highlighted.<br>
Move this highlighting in prototype initialization.<br>
<br>
=============== Diff against MorphicExtras-nice.137 ===============<br>
<br>
Item was changed:<br>
ImageMorph subclass: #PaintBoxMorph<br>
+ instanceVariableNames: 'action tool currentCursor thumbnail currentColor currentBrush colorMemory stampHolder rotationTabForm scaleTabForm colorMemoryThin brushes focusMorph weakDependents recentColors'<br>
- instanceVariableNames: 'action tool currentCursor thumbnail currentColor currentBrush colorMemory colorPatch stampHolder rotationTabForm scaleTabForm colorMemoryThin brushes focusMorph weakDependents recentColors'<br>
classVariableNames: 'AllOffImage AllOnImage AllPressedImage ColorChart ImageLibrary OriginalBounds Prototype RecentColors UseLargeColorPicker'<br>
poolDictionaries: ''<br>
category: 'MorphicExtras-Support'!<br>
<br>
Item was changed:<br>
----- Method: PaintBoxMorph class>>new (in category 'instance creation') -----<br>
new<br>
<br>
| pb |<br>
pb := self prototype veryDeepCopy.<br>
"Assume that the PaintBox does not contain any scripted Players!!"<br>
pb stampHolder normalize. "Get the stamps to show"<br>
"Get my own copies of the brushes so I can modify them"<br>
+ #(brush1: brush2: brush3: brush4: brush5: brush6:) do: [:sel | | dualUse button |<br>
- #(brush1: brush2: brush3: brush4: brush5: brush6:) do: [:sel | | dualUse formCanvas rect button |<br>
button := pb submorphNamed: sel.<br>
button offImage: button offImage deepCopy.<br>
dualUse := button onImage == button pressedImage. "sometimes shared"<br>
button onImage: button onImage deepCopy.<br>
dualUse<br>
ifTrue: [button pressedImage: button onImage]<br>
ifFalse: [button pressedImage: button pressedImage deepCopy].<br>
- "force color maps for later mapping"<br>
- button offImage.<br>
- button onImage.<br>
- button pressedImage.<br>
- formCanvas := button onImage getCanvas.<br>
- formCanvas := formCanvas<br>
- copyOrigin: 0@0<br>
- clipRect: (rect := 0@0 extent: button onImage extent).<br>
- (#(brush1: brush3:) includes: sel) ifTrue: [<br>
- rect := rect origin corner: rect corner - (2@2)].<br>
- (#brush2: == sel) ifTrue: [<br>
- rect := rect origin corner: rect corner - (2@4)].<br>
- formCanvas frameAndFillRectangle: rect fillColor: Color transparent<br>
- borderWidth: 2 borderColor: (Color r: 0.599 g: 0.8 b: 1.0).<br>
].<br>
pb showColor.<br>
pb fixUpRecentColors.<br>
pb addLabels.<br>
^ pb!<br>
<br>
Item was added:<br>
+ ----- Method: PaintBoxMorph>>addBrushesOffImage: (in category 'initialization') -----<br>
+ addBrushesOffImage: offImage<br>
+ | posSpec |<br>
+ posSpec := #(<br>
+ (13 37 64 13 37 64) "offset X"<br>
+ (107 107 107 124 124 124) "offset Y"<br>
+ (21 24 27 21 24 27) "width"<br>
+ (18 18 18 25 25 25) "height").<br>
+ #(brush1: brush2: brush3: brush4: brush5: brush6: ) keysAndValuesDo: [:index :name |<br>
+ | button nib rect on off |<br>
+ (self submorphNamed: name) ifNil:<br>
+ [nib := Form dotOfSize: (#(1 2 3 6 11 26) at: index).<br>
+ rect := ((posSpec at: 1) at: index) @ ((posSpec at: 2) at: index)<br>
+ extent: ((posSpec at: 3) at: index) @ ((posSpec at: 4) at: index).<br>
+ off := (offImage copy: rect) as8BitColorForm.<br>
+ "highlight a frame"<br>
+ on := off deepCopy.<br>
+ (on getCanvas copyOrigin: 0@0 clipRect: (0@0 extent: rect extent))<br>
+ frameAndFillRectangle: (0@0 extent: rect extent) fillColor: Color transparent<br>
+ borderWidth: 2 borderColor: (Color r: 0.6 g: 0.8 b: 1.0).<br>
+ (button := ThreePhaseButtonMorph new)<br>
+ onImage: on;<br>
+ offImage: off;<br>
+ pressedImage: on;<br>
+ bounds: (rect translateBy: self position);<br>
+ setNamePropertyTo: name;<br>
+ actionSelector: #brush:action:nib:evt:;<br>
+ arguments: (Array with: button with: name with: nib);<br>
+ actWhen: #buttonUp; target: self.<br>
+ self addMorph: button.]].<br>
+ brushes := #(brush1: brush2: brush3: brush4: brush5: brush6: ) collect: [:name | self submorphNamed: name].<br>
+ currentBrush := brushes last.<br>
+ currentBrush state: #on.<br>
+<br>
+ !<br>
<br>
Item was removed:<br>
- ----- Method: PaintBoxMorph>>addBrushesOffImage:onImage: (in category 'initialization') -----<br>
- addBrushesOffImage: offImage onImage: onImage<br>
- | posSpec |<br>
- posSpec := #(<br>
- (13 36 63 13 36 63) "offset X"<br>
- (107 107 107 124 124 124) "offset Y"<br>
- (21 24 27 21 24 27) "width"<br>
- (18 18 18 25 25 25) "height").<br>
- #(brush1: brush2: brush3: brush4: brush5: brush6: ) keysAndValuesDo: [:index :name |<br>
- | button nib rect |<br>
- (self submorphNamed: name) ifNil:<br>
- [nib := Form dotOfSize: (#(1 2 3 6 11 26) at: index).<br>
- rect := ((posSpec at: 1) at: index) @ ((posSpec at: 2) at: index)<br>
- extent: ((posSpec at: 3) at: index) @ ((posSpec at: 4) at: index).<br>
- (button := ThreePhaseButtonMorph new)<br>
- onImage: (onImage copy: rect) as8BitColorForm;<br>
- offImage: (offImage copy: rect) as8BitColorForm;<br>
- pressedImage: (onImage copy: rect) as8BitColorForm;<br>
- bounds: (rect translateBy: self position);<br>
- setNamePropertyTo: name;<br>
- actionSelector: #brush:action:nib:evt:;<br>
- arguments: (Array with: button with: name with: nib);<br>
- actWhen: #buttonUp; target: self.<br>
- self addMorph: button.]].<br>
- brushes := #(brush1: brush2: brush3: brush4: brush5: brush6: ) collect: [:name | self submorphNamed: name]<br>
-<br>
- !<br>
<br>
Item was changed:<br>
----- Method: PaintBoxMorph>>addToolsOffImage:onImage: (in category 'initialization') -----<br>
addToolsOffImage: offImage onImage: onImage<br>
| posSpec actionSpec iconSpec |<br>
posSpec := #(<br>
(13 53 13 53) "offset X"<br>
(13 13 61 61) "offset Y"<br>
(40 40 40 40) "width"<br>
(48 48 44 44) "height").<br>
actionSpec := #(tool:action:cursor:evt: tool:action:cursor:evt: eyedropper:action:cursor:evt: tool:action:cursor:evt:).<br>
iconSpec := #(paintIcon fillIcon eyedropperIcon eraseIcon).<br>
#(paint: fill: eyedropper: erase:) keysAndValuesDo: [:index :name |<br>
| button rect |<br>
(self submorphNamed: name) ifNil:<br>
[rect := ((posSpec at: 1) at: index) @ ((posSpec at: 2) at: index)<br>
extent: ((posSpec at: 3) at: index) @ ((posSpec at: 4) at: index).<br>
(button := ThreePhaseButtonMorph new)<br>
onImage: (onImage copy: rect);<br>
offImage: (offImage copy: rect);<br>
pressedImage: (onImage copy: rect);<br>
bounds: (rect translateBy: self position);<br>
setNamePropertyTo: name;<br>
actionSelector: (actionSpec at: index);<br>
arguments: (Array with: button with: name with: (self class perform: (iconSpec at: index)));<br>
actWhen: #buttonUp; target: self.<br>
+ index = 1<br>
+ ifTrue:<br>
+ [action := name.<br>
+ tool := button.<br>
+ currentCursor := button arguments at: 3].<br>
self addMorph: button.]].<br>
<br>
!<br>
<br>
Item was changed:<br>
----- Method: PaintBoxMorph>>buildAPrototype (in category 'initialization') -----<br>
buildAPrototype<br>
| onImage |<br>
self initialize.<br>
self image: self class paletteImage.<br>
rotationTabForm := self class rotationTabImage.<br>
scaleTabForm := self class scaleTabImage.<br>
(colorMemoryThin := self class colorMemoryThinImage asMorph)<br>
setNamePropertyTo: 'ColorPickerClosed';<br>
position: self position + (11@150);<br>
on: #mouseEnter send: #showColorPalette: to: self.<br>
self addMorph: colorMemoryThin.<br>
(colorMemory := PaintBoxColorPicker new image: self class colorMemoryImage)<br>
setNamePropertyTo: 'ColorPickerOpened';<br>
on: #mouseDown send: #takeColorEvt:from: to: self.<br>
+ currentColor := Color transparent.<br>
<br>
onImage := self class paletteOnImage.<br>
self<br>
addToolsOffImage: image onImage: onImage;<br>
+ addBrushesOffImage: image;<br>
- addBrushesOffImage: image onImage: onImage;<br>
addActionsOffImage: image onImage: onImage;<br>
addStampsAndShapes;<br>
addShapeButtonsOffImage: self class shapesImage onImage: self class shapesOnImage;<br>
addStampButtonsOffImage: self class stampsImage onImage: self class stampsOnImage.<br>
+ stampHolder := ScrollingToolHolder newPrototypeFor: self.!<br>
- stampHolder := ScrollingToolHolder newPrototypeFor: self.<br>
- currentBrush := brushes at: 1.!<br>
<br>
Item was removed:<br>
- ----- Method: PaintBoxMorph>>colorPatch (in category 'other') -----<br>
- colorPatch<br>
- ^ colorPatch!<br>
<br>
Item was removed:<br>
- ----- Method: PaintBoxMorph>>indicateColorUnderMouse (in category 'actions') -----<br>
- indicateColorUnderMouse<br>
- "Track the mouse with the special eyedropper cursor, and accept whatever color is under the mouse as the currently-chosen color; reflect that choice in the feedback box, and return that color."<br>
-<br>
- | pt feedbackColor |<br>
- pt := Sensor cursorPoint.<br>
- "deal with the fact that 32 bit displays may have garbage in the alpha bits"<br>
- feedbackColor := Display depth = 32<br>
- ifTrue: [ Color colorFromPixelValue: ((Display pixelValueAt: pt) bitOr: 16rFF000000) depth: 32] ifFalse: [Display colorAt: pt].<br>
-<br>
- self activeHand position: pt.<br>
- self world displayWorldSafely.<br>
- Display fill: colorPatch bounds fillColor: feedbackColor.<br>
- ^ feedbackColor !<br>
<br>
<br>
</blockquote></div><br></div>