[squeak-dev] The Trunk: MorphicExtras-nice.138.mcz

Chris Muller asqueaker at gmail.com
Fri Dec 13 22:11:01 UTC 2013


Seems to be fixed, thanks Nicolas.


On Fri, Dec 13, 2013 at 3:53 PM, <commits at source.squeak.org> wrote:

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


More information about the Squeak-dev mailing list