The Inbox: Morphic-ct.1634.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-ct.1634.mcz

commits-2
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1634.mcz

==================== Summary ====================

Name: Morphic-ct.1634
Author: ct
Time: 29 February 2020, 11:46:44.317896 am
UUID: 71271fa2-4ed1-6d4f-8f58-30ed8165c367
Ancestors: Morphic-mt.1631

Proposal: Add pick button to NewColorPickerMorph that allows to pick a color from the Display. With this enhancement, NCPM is finally superior to the old ColorPickerMorph and could now replace the latter by the default preferences.

=============== Diff against Morphic-mt.1631 ===============

Item was changed:
  Morph subclass: #NewColorPickerMorph
+ instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter isPicking'
- instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter'
  classVariableNames: 'UseIt'
  poolDictionaries: ''
  category: 'Morphic-Widgets'!
 
  !NewColorPickerMorph commentStamp: 'cmm 12/3/2010 13:36' prior: 0!
  A NewColorPickerMorph is a new widget for choosing colors in Morphic.  Instantiate a NewColorPickerMorph:
 
  (NewColorPickerMorph
  on: objectToHaveItsColorSet
  getColorSelector: itsColorGetterSymbol
  setColorSelector: itsColorSetterSymbol) openInWorld
 
  !

Item was changed:
  ----- Method: NewColorPickerMorph>>colorSelected: (in category 'model') -----
  colorSelected: aColor
+ self isPicking ifFalse: [
+ self targetColor: aColor].
- self targetColor: aColor.
  self changed: #colorExpression!

Item was changed:
  ----- Method: NewColorPickerMorph>>initialize (in category 'initialize-release') -----
  initialize
+
  super initialize.
+ isPicking := false.
+ self initializeHsvaMorph.!
- self initializeHsvaMorph!

Item was added:
+ ----- Method: NewColorPickerMorph>>isPicking (in category 'accessing') -----
+ isPicking
+
+ ^ isPicking!

Item was added:
+ ----- Method: NewColorPickerMorph>>isPicking: (in category 'picking') -----
+ isPicking: aBoolean
+
+ isPicking := aBoolean.
+ self changed: #isPicking.
+ aBoolean ifTrue: [self pickColor].!

Item was changed:
  ----- Method: NewColorPickerMorph>>newBottomRow (in category 'initialize-release') -----
  newBottomRow
  ^ Morph new
+ color: Color transparent;
+ changeTableLayout;
+ listDirection: #leftToRight;
+ hResizing: #spaceFill; vResizing: #shrinkWrap;
+ height: 20;
+ cellGap: 4;
+ addMorphBack: self newPickButton;
+ addMorphBack: (StringMorph contents: 'Current selection:' translated);
+ addMorphBack: self newColorPresenterMorph;
+ addMorphBack: self newCloseButton;
+ yourself!
- color: Color transparent ;
- changeTableLayout ;
- listDirection: #leftToRight ;
- hResizing: #spaceFill; vResizing: #shrinkWrap ;
- height: 20 ;
- cellGap: 4 ;
- addMorph: (StringMorph contents: 'Current selection:' translated) ;
- addMorphBack: self newColorPresenterMorph ;
- addMorphBack: self newCloseButton!

Item was changed:
  ----- Method: NewColorPickerMorph>>newCloseButton (in category 'initialize-release') -----
  newCloseButton
  ^ (PluggableButtonMorph
  on: self
  getState: nil
  action: #delete
  label: #closeButtonLabel)
+ vResizing: #spaceFill;
- vResizing: #spaceFill ;
  hResizing: #spaceFill;
+ balloonText: self closeButtonLabel;
+ yourself!
- yourself!

Item was added:
+ ----- Method: NewColorPickerMorph>>newPickButton (in category 'initialize-release') -----
+ newPickButton
+ ^ (PluggableButtonMorph
+ on: self
+ getState: #isPicking
+ action: #togglePicking
+ label: #pickingButtonLabel)
+ vResizing: #spaceFill;
+ hResizing: #spaceFill;
+ balloonText: self pickingButtonLabel;
+ yourself!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickColor (in category 'picking') -----
+ pickColor
+
+ | selectedColor |
+ [
+ | previousColor |
+ previousColor := self selectedColor.
+ selectedColor := self pickColorFromDisplay.
+ selectedColor ifNil: [^ self selectedColor: previousColor].
+ ] ensure: [
+ self isPicking: false].
+ self selectedColor: selectedColor.!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickColorFromDisplay (in category 'picking') -----
+ pickColorFromDisplay
+
+ [Sensor anyButtonPressed]
+ whileTrue;
+ whileFalse: [
+ Sensor peekKeyboard = Character escape ifTrue: [
+ Sensor flushKeyboard.
+ ^ nil].
+ ((ActiveHand world morphsAt: Sensor cursorPoint) includes: self) ifFalse: [
+ self selectedColor: (Display colorAt: Sensor cursorPoint)].
+ self world displayWorldSafely; runStepMethods].
+ Sensor yellowButtonPressed
+ ifTrue: [^ nil].
+ ((ActiveHand world morphsAt: Sensor cursorPoint) includes: self)
+ ifTrue: [^ nil].
+ ^ self selectedColor!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickingButtonLabel (in category 'initialize-release') -----
+ pickingButtonLabel
+ ^ 'Picking' translated!

Item was changed:
  ----- Method: NewColorPickerMorph>>setup (in category 'initialize-release') -----
  setup
+
  self
+ color: Color white darker;
+ cornerStyle: #rounded;
+ changeTableLayout;
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ extent: 240@240;
+ addMorphBack: hsvaMorph;
+ addMorphBack: self newColorExpressionMorph;
+ addMorphBack: self newBottomRow;
+ layoutInset: 4;
+ cellGap: 2.
+
+ Preferences menuAppearance3d
+ ifTrue: [self addDropShadow].!
- color: (Color white darker) ;
- cornerStyle: #rounded ;
- changeTableLayout ;
- hResizing: #shrinkWrap ;
- vResizing: #shrinkWrap ;
- extent: 240@240 ;
- addMorphBack: hsvaMorph ;
- addMorphBack: self newColorExpressionMorph ;
- addMorphBack: self newBottomRow ;
- layoutInset: 4 ;
- cellGap: 2.
-
- Preferences menuAppearance3d
- ifTrue: [self addDropShadow].
- !

Item was changed:
  ----- Method: NewColorPickerMorph>>setupForProperties (in category 'initialize-release') -----
  setupForProperties
+
  self
+ color: Color white darker;
+ changeTableLayout;
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ extent: 240@240;
+ addMorphBack: hsvaMorph;
+ layoutInset: 4;
+ cellGap: 2.!
- color: (Color white darker) ;
- changeTableLayout ;
- hResizing: #shrinkWrap ;
- vResizing: #shrinkWrap ;
- extent: 240@240 ;
- addMorphBack: hsvaMorph ;
- layoutInset: 4 ;
- cellGap: 2.!

Item was added:
+ ----- Method: NewColorPickerMorph>>togglePicking (in category 'picking') -----
+ togglePicking
+ self isPicking: self isPicking not!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Christoph Thiede



Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 11:46:56
An: [hidden email]
Betreff: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1634.mcz

==================== Summary ====================

Name: Morphic-ct.1634
Author: ct
Time: 29 February 2020, 11:46:44.317896 am
UUID: 71271fa2-4ed1-6d4f-8f58-30ed8165c367
Ancestors: Morphic-mt.1631

Proposal: Add pick button to NewColorPickerMorph that allows to pick a color from the Display. With this enhancement, NCPM is finally superior to the old ColorPickerMorph and could now replace the latter by the default preferences.

=============== Diff against Morphic-mt.1631 ===============

Item was changed:
  Morph subclass: #NewColorPickerMorph
+        instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter isPicking'
-        instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter'
         classVariableNames: 'UseIt'
         poolDictionaries: ''
         category: 'Morphic-Widgets'!
 
  !NewColorPickerMorph commentStamp: 'cmm 12/3/2010 13:36' prior: 0!
  A NewColorPickerMorph is a new widget for choosing colors in Morphic.  Instantiate a NewColorPickerMorph:
 
         (NewColorPickerMorph
                 on: objectToHaveItsColorSet
                 getColorSelector: itsColorGetterSymbol
                 setColorSelector: itsColorSetterSymbol) openInWorld
 
  !

Item was changed:
  ----- Method: NewColorPickerMorph>>colorSelected: (in category 'model') -----
  colorSelected: aColor
+        self isPicking ifFalse: [
+                self targetColor: aColor].
-        self targetColor: aColor.
         self changed: #colorExpression!

Item was changed:
  ----- Method: NewColorPickerMorph>>initialize (in category 'initialize-release') -----
  initialize
+
         super initialize.
+        isPicking := false.
+        self initializeHsvaMorph.!
-        self initializeHsvaMorph!

Item was added:
+ ----- Method: NewColorPickerMorph>>isPicking (in category 'accessing') -----
+ isPicking
+
+        ^ isPicking!

Item was added:
+ ----- Method: NewColorPickerMorph>>isPicking: (in category 'picking') -----
+ isPicking: aBoolean
+
+        isPicking := aBoolean.
+        self changed: #isPicking.
+        aBoolean ifTrue: [self pickColor].!

Item was changed:
  ----- Method: NewColorPickerMorph>>newBottomRow (in category 'initialize-release') -----
  newBottomRow
         ^ Morph new
+                color: Color transparent;
+                changeTableLayout;
+                listDirection: #leftToRight;
+                hResizing: #spaceFill; vResizing: #shrinkWrap;
+                height: 20;
+                cellGap: 4;
+                addMorphBack: self newPickButton;
+                addMorphBack: (StringMorph contents: 'Current selection:' translated);
+                addMorphBack: self newColorPresenterMorph;
+                addMorphBack: self newCloseButton;
+                yourself!
-                 color: Color transparent ;
-                 changeTableLayout ;
-                 listDirection: #leftToRight ;
-                 hResizing: #spaceFill; vResizing: #shrinkWrap ;
-                 height: 20 ;
-                 cellGap: 4 ;
-                 addMorph: (StringMorph contents: 'Current selection:' translated) ;
-                 addMorphBack: self newColorPresenterMorph ;
-                 addMorphBack: self newCloseButton!

Item was changed:
  ----- Method: NewColorPickerMorph>>newCloseButton (in category 'initialize-release') -----
  newCloseButton
         ^ (PluggableButtonMorph
                 on: self
                 getState: nil
                 action: #delete
                 label: #closeButtonLabel)
+                vResizing: #spaceFill;
-                 vResizing: #spaceFill ;
                 hResizing: #spaceFill;
+                balloonText: self closeButtonLabel;
+                yourself!
-                 yourself!

Item was added:
+ ----- Method: NewColorPickerMorph>>newPickButton (in category 'initialize-release') -----
+ newPickButton
+        ^ (PluggableButtonMorph
+                on: self
+                getState: #isPicking
+                action: #togglePicking
+                label: #pickingButtonLabel)
+                vResizing: #spaceFill;
+                hResizing: #spaceFill;
+                balloonText: self pickingButtonLabel;
+                yourself!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickColor (in category 'picking') -----
+ pickColor
+       
+        | selectedColor |
+        [
+                | previousColor |
+                previousColor := self selectedColor.
+                selectedColor := self pickColorFromDisplay.
+                selectedColor ifNil: [^ self selectedColor: previousColor].
+        ] ensure: [
+                self isPicking: false].
+        self selectedColor: selectedColor.!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickColorFromDisplay (in category 'picking') -----
+ pickColorFromDisplay
+
+        [Sensor anyButtonPressed]
+                whileTrue;
+                whileFalse: [
+                        Sensor peekKeyboard = Character escape ifTrue: [
+                                Sensor flushKeyboard.
+                                ^ nil].
+                        ((ActiveHand world morphsAt: Sensor cursorPoint) includes: self) ifFalse: [
+                                self selectedColor: (Display colorAt: Sensor cursorPoint)].
+                        self world displayWorldSafely; runStepMethods].
+        Sensor yellowButtonPressed
+                ifTrue: [^ nil].
+        ((ActiveHand world morphsAt: Sensor cursorPoint) includes: self)
+                ifTrue: [^ nil].
+        ^ self selectedColor!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickingButtonLabel (in category 'initialize-release') -----
+ pickingButtonLabel
+        ^ 'Picking' translated!

Item was changed:
  ----- Method: NewColorPickerMorph>>setup (in category 'initialize-release') -----
  setup
+
         self
+                color: Color white darker;
+                cornerStyle: #rounded;
+                changeTableLayout;
+                hResizing: #shrinkWrap;
+                vResizing: #shrinkWrap;
+                extent: 240@240;
+                addMorphBack: hsvaMorph;
+                addMorphBack: self newColorExpressionMorph;
+                addMorphBack: self newBottomRow;
+                layoutInset: 4;
+                cellGap: 2.
+       
+        Preferences menuAppearance3d
+                ifTrue: [self addDropShadow].!
-                 color: (Color white darker) ;
-                 cornerStyle: #rounded ;
-                 changeTableLayout ;
-                 hResizing: #shrinkWrap ;
-                 vResizing: #shrinkWrap ;
-                 extent: 240@240 ;
-                 addMorphBack: hsvaMorph ;
-                 addMorphBack: self newColorExpressionMorph ;
-                 addMorphBack: self newBottomRow ;
-                 layoutInset: 4 ;
-                 cellGap: 2.
-               
-                Preferences menuAppearance3d
-                ifTrue: [self addDropShadow].
-        !

Item was changed:
  ----- Method: NewColorPickerMorph>>setupForProperties (in category 'initialize-release') -----
  setupForProperties
+
         self
+                color: Color white darker;
+                changeTableLayout;
+                hResizing: #shrinkWrap;
+                vResizing: #shrinkWrap;
+                extent: 240@240;
+                addMorphBack: hsvaMorph;
+                layoutInset: 4;
+                cellGap: 2.!
-                 color: (Color white darker) ;
-                 changeTableLayout ;
-                 hResizing: #shrinkWrap ;
-                 vResizing: #shrinkWrap ;
-                 extent: 240@240 ;
-                 addMorphBack: hsvaMorph ;
-                 layoutInset: 4 ;
-                 cellGap: 2.!

Item was added:
+ ----- Method: NewColorPickerMorph>>togglePicking (in category 'picking') -----
+ togglePicking
+        self isPicking: self isPicking not!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

K K Subbu
In reply to this post by commits-2
On 29/02/20 10:46 AM, [hidden email] wrote:
>    Morph subclass: #NewColorPickerMorph
> + instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter isPicking'
> - instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter'

is isPicking really required? Why introduce a mode?

>    ----- Method: NewColorPickerMorph>>colorSelected: (in category 'model') -----
>    colorSelected: aColor
> + self isPicking ifFalse: [
> + self targetColor: aColor].
> - self targetColor: aColor.

targetColor is getting set regardless of isPicking here.

> + ----- Method: NewColorPickerMorph>>pickColor (in category 'picking') -----
> + pickColor
> +
> + | selectedColor |
> + [
> + | previousColor |
> + previousColor := self selectedColor.
> + selectedColor := self pickColorFromDisplay.
> + selectedColor ifNil: [^ self selectedColor: previousColor].
> + ] ensure: [
> + self isPicking: false].
> + self selectedColor: selectedColor.!

Could this be simplified to :

  self pickColorFromDisplay ifNotNil: [:pickedColor | self
selectedColor: pickedColor ].

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Christoph Thiede

Hi Subbu, thanks for your fast review!


is isPicking really required? Why introduce a mode?


If we don't introduce a mode, the target's color will be updated about 50 times per second (depending on your image's speed). This can be really slow ... Using #isPicking allows deferring the color update until the user really clicks at any point. Still, the currently hovered color is displayed in the picker.

targetColor is getting set regardless of isPicking here.

I do not understand you?

Could this be simplified to :
>   self pickColorFromDisplay ifNotNil: [:pickedColor | self
> selectedColor: pickedColor ].

Actually not, because #isPicking is enabled until the #ensure: block has been passed. But you probably have identified a code smell in my current approach here :-)
Alternatively, we could also say:

pickColor
     [
             | previousColor selectedColor |
             previousColor := self selectedColor.
             selectedColor := self pickColorFromDisplay.
             selectedColor
                 ifNil: [self selectedColor: previousColor]
                 ifNotNil: [self targetColor: selectorColor].
     ] ensure: [
             self isPicking: false].

Would this be more intuitive?

Best,
Christoph




Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 12:39 Uhr
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 10:46 AM, [hidden email] wrote:
>    Morph subclass: #NewColorPickerMorph
> +      instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter isPicking'
> -      instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter'

is isPicking really required? Why introduce a mode?

>    ----- Method: NewColorPickerMorph>>colorSelected: (in category 'model') -----
>    colorSelected: aColor
> +      self isPicking ifFalse: [
> +              self targetColor: aColor].
> -      self targetColor: aColor.

targetColor is getting set regardless of isPicking here.

> + ----- Method: NewColorPickerMorph>>pickColor (in category 'picking') -----
> + pickColor
> +     
> +      | selectedColor |
> +      [
> +              | previousColor |
> +              previousColor := self selectedColor.
> +              selectedColor := self pickColorFromDisplay.
> +              selectedColor ifNil: [^ self selectedColor: previousColor].
> +      ] ensure: [
> +              self isPicking: false].
> +      self selectedColor: selectedColor.!

Could this be simplified to :

  self pickColorFromDisplay ifNotNil: [:pickedColor | self
selectedColor: pickedColor ].

Regards .. Subbu



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

K K Subbu
On 29/02/20 5:21 PM, Thiede, Christoph wrote:
>  > is isPicking really required? Why introduce a mode?
>
>
> If we don't introduce a mode, the target's color will be updated about
> 50 times per second (depending on your image's speed). This can be
> really slow ... Using #isPicking allows deferring the color update until
> the user really clicks at any point. Still, the currently hovered color
> is displayed in the picker.
>

Liveness support in Morphic is designed to handle situations like this.

ColorPickerMorph already has a step method every 50ms to handle live
feedback. Also see

  ColorPickerMorph>>indicateColorUnderMouse

and COlorPickerMorph>>pickColorAt:

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Christoph Thiede
Liveness support in Morphic is designed to handle situations like this.

Fair point, liveness is a great good! However ...
The current approach makes it possible to click the picking button, move your mouse and then click the picking button again without affecting the target's color. It's like typing something into an inspector pane without accepting it. Is this an important behavior? Otherwise, we could drop that #isPicking conditional.

ColorPickerMorph already has a step method every 50ms to handle live feedback.

(But ColorPickerMorph does not push each picking change to the target morph.)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 13:34:19
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 5:21 PM, Thiede, Christoph wrote:
>  > is isPicking really required? Why introduce a mode?
>
>
> If we don't introduce a mode, the target's color will be updated about
> 50 times per second (depending on your image's speed). This can be
> really slow ... Using #isPicking allows deferring the color update until
> the user really clicks at any point. Still, the currently hovered color
> is displayed in the picker.
>

Liveness support in Morphic is designed to handle situations like this.

ColorPickerMorph already has a step method every 50ms to handle live
feedback. Also see

  ColorPickerMorph>>indicateColorUnderMouse

and COlorPickerMorph>>pickColorAt:

Regards .. Subbu



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Karl Ramberg
In reply to this post by Christoph Thiede
Nice addition.
Would like that the text on the buttons did not abbreviate down.

One nice feature of old color picker is that it is modal and goes away on mouse up, but I guess I will get used to the new one.
Nice to have access to all the shades of colors more easily. Not just the full saturated ones.

Best,
Karl



On Sat, Feb 29, 2020 at 11:49 AM Thiede, Christoph <[hidden email]> wrote:



Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 11:46:56
An: [hidden email]
Betreff: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1634.mcz

==================== Summary ====================

Name: Morphic-ct.1634
Author: ct
Time: 29 February 2020, 11:46:44.317896 am
UUID: 71271fa2-4ed1-6d4f-8f58-30ed8165c367
Ancestors: Morphic-mt.1631

Proposal: Add pick button to NewColorPickerMorph that allows to pick a color from the Display. With this enhancement, NCPM is finally superior to the old ColorPickerMorph and could now replace the latter by the default preferences.

=============== Diff against Morphic-mt.1631 ===============

Item was changed:
  Morph subclass: #NewColorPickerMorph
+        instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter isPicking'
-        instanceVariableNames: 'target setColorSelector hsvaMorph colorPresenter'
         classVariableNames: 'UseIt'
         poolDictionaries: ''
         category: 'Morphic-Widgets'!
 
  !NewColorPickerMorph commentStamp: 'cmm 12/3/2010 13:36' prior: 0!
  A NewColorPickerMorph is a new widget for choosing colors in Morphic.  Instantiate a NewColorPickerMorph:
 
         (NewColorPickerMorph
                 on: objectToHaveItsColorSet
                 getColorSelector: itsColorGetterSymbol
                 setColorSelector: itsColorSetterSymbol) openInWorld
 
  !

Item was changed:
  ----- Method: NewColorPickerMorph>>colorSelected: (in category 'model') -----
  colorSelected: aColor
+        self isPicking ifFalse: [
+                self targetColor: aColor].
-        self targetColor: aColor.
         self changed: #colorExpression!

Item was changed:
  ----- Method: NewColorPickerMorph>>initialize (in category 'initialize-release') -----
  initialize
+
         super initialize.
+        isPicking := false.
+        self initializeHsvaMorph.!
-        self initializeHsvaMorph!

Item was added:
+ ----- Method: NewColorPickerMorph>>isPicking (in category 'accessing') -----
+ isPicking
+
+        ^ isPicking!

Item was added:
+ ----- Method: NewColorPickerMorph>>isPicking: (in category 'picking') -----
+ isPicking: aBoolean
+
+        isPicking := aBoolean.
+        self changed: #isPicking.
+        aBoolean ifTrue: [self pickColor].!

Item was changed:
  ----- Method: NewColorPickerMorph>>newBottomRow (in category 'initialize-release') -----
  newBottomRow
         ^ Morph new
+                color: Color transparent;
+                changeTableLayout;
+                listDirection: #leftToRight;
+                hResizing: #spaceFill; vResizing: #shrinkWrap;
+                height: 20;
+                cellGap: 4;
+                addMorphBack: self newPickButton;
+                addMorphBack: (StringMorph contents: 'Current selection:' translated);
+                addMorphBack: self newColorPresenterMorph;
+                addMorphBack: self newCloseButton;
+                yourself!
-                 color: Color transparent ;
-                 changeTableLayout ;
-                 listDirection: #leftToRight ;
-                 hResizing: #spaceFill; vResizing: #shrinkWrap ;
-                 height: 20 ;
-                 cellGap: 4 ;
-                 addMorph: (StringMorph contents: 'Current selection:' translated) ;
-                 addMorphBack: self newColorPresenterMorph ;
-                 addMorphBack: self newCloseButton!

Item was changed:
  ----- Method: NewColorPickerMorph>>newCloseButton (in category 'initialize-release') -----
  newCloseButton
         ^ (PluggableButtonMorph
                 on: self
                 getState: nil
                 action: #delete
                 label: #closeButtonLabel)
+                vResizing: #spaceFill;
-                 vResizing: #spaceFill ;
                 hResizing: #spaceFill;
+                balloonText: self closeButtonLabel;
+                yourself!
-                 yourself!

Item was added:
+ ----- Method: NewColorPickerMorph>>newPickButton (in category 'initialize-release') -----
+ newPickButton
+        ^ (PluggableButtonMorph
+                on: self
+                getState: #isPicking
+                action: #togglePicking
+                label: #pickingButtonLabel)
+                vResizing: #spaceFill;
+                hResizing: #spaceFill;
+                balloonText: self pickingButtonLabel;
+                yourself!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickColor (in category 'picking') -----
+ pickColor
+       
+        | selectedColor |
+        [
+                | previousColor |
+                previousColor := self selectedColor.
+                selectedColor := self pickColorFromDisplay.
+                selectedColor ifNil: [^ self selectedColor: previousColor].
+        ] ensure: [
+                self isPicking: false].
+        self selectedColor: selectedColor.!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickColorFromDisplay (in category 'picking') -----
+ pickColorFromDisplay
+
+        [Sensor anyButtonPressed]
+                whileTrue;
+                whileFalse: [
+                        Sensor peekKeyboard = Character escape ifTrue: [
+                                Sensor flushKeyboard.
+                                ^ nil].
+                        ((ActiveHand world morphsAt: Sensor cursorPoint) includes: self) ifFalse: [
+                                self selectedColor: (Display colorAt: Sensor cursorPoint)].
+                        self world displayWorldSafely; runStepMethods].
+        Sensor yellowButtonPressed
+                ifTrue: [^ nil].
+        ((ActiveHand world morphsAt: Sensor cursorPoint) includes: self)
+                ifTrue: [^ nil].
+        ^ self selectedColor!

Item was added:
+ ----- Method: NewColorPickerMorph>>pickingButtonLabel (in category 'initialize-release') -----
+ pickingButtonLabel
+        ^ 'Picking' translated!

Item was changed:
  ----- Method: NewColorPickerMorph>>setup (in category 'initialize-release') -----
  setup
+
         self
+                color: Color white darker;
+                cornerStyle: #rounded;
+                changeTableLayout;
+                hResizing: #shrinkWrap;
+                vResizing: #shrinkWrap;
+                extent: 240@240;
+                addMorphBack: hsvaMorph;
+                addMorphBack: self newColorExpressionMorph;
+                addMorphBack: self newBottomRow;
+                layoutInset: 4;
+                cellGap: 2.
+       
+        Preferences menuAppearance3d
+                ifTrue: [self addDropShadow].!
-                 color: (Color white darker) ;
-                 cornerStyle: #rounded ;
-                 changeTableLayout ;
-                 hResizing: #shrinkWrap ;
-                 vResizing: #shrinkWrap ;
-                 extent: 240@240 ;
-                 addMorphBack: hsvaMorph ;
-                 addMorphBack: self newColorExpressionMorph ;
-                 addMorphBack: self newBottomRow ;
-                 layoutInset: 4 ;
-                 cellGap: 2.
-               
-                Preferences menuAppearance3d
-                ifTrue: [self addDropShadow].
-        !

Item was changed:
  ----- Method: NewColorPickerMorph>>setupForProperties (in category 'initialize-release') -----
  setupForProperties
+
         self
+                color: Color white darker;
+                changeTableLayout;
+                hResizing: #shrinkWrap;
+                vResizing: #shrinkWrap;
+                extent: 240@240;
+                addMorphBack: hsvaMorph;
+                layoutInset: 4;
+                cellGap: 2.!
-                 color: (Color white darker) ;
-                 changeTableLayout ;
-                 hResizing: #shrinkWrap ;
-                 vResizing: #shrinkWrap ;
-                 extent: 240@240 ;
-                 addMorphBack: hsvaMorph ;
-                 layoutInset: 4 ;
-                 cellGap: 2.!

Item was added:
+ ----- Method: NewColorPickerMorph>>togglePicking (in category 'picking') -----
+ togglePicking
+        self isPicking: self isPicking not!





Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

K K Subbu
In reply to this post by Christoph Thiede
On 29/02/20 6:23 PM, Thiede, Christoph wrote:
>  > Liveness support in Morphic is designed to handle situations like this.
>
> Fair point, liveness is a great good! However ...
> The current approach makes it possible to click the picking button, move
> your mouse and then click the picking button again without affecting the
> target's color. It's like typing something into an inspector pane
> without accepting it. Is this an important behavior? Otherwise, we could
> drop that #isPicking conditional.
Morphic is designed for live and direct interaction instead of modal
interactions. When selecting a color, you either copy from another Morph
(picking) or choose a new shade from a color pane. The color pane is
quite dense, so a preview pane is useful while we click and drag over
the pane. Morphic logic is quite compact and simple to implement. Using
mode flags disrupts this flow and introduces unnecessary complexity.

This is just my opinion. I will let others with more experience in
Morphic pitch in their views.

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Christoph Thiede

Would like that the text on the buttons did not abbreviate down.


I think this is a space problem. If you expand it a little bit, you can read the full text:




However, I added balloons for the buttons.
Hm, should the default balloon text for each button in Squeak be its content if abbreviated?

One nice feature of old color picker is that it is modal and goes away on mouse up, but I guess I will get used to the new one.

The advantage of the new one is that no modality is enforced. You can open multiple pickers side-by-side, even on the same target (though I'm afraid they are not synced).

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 14:33:13
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 6:23 PM, Thiede, Christoph wrote:
>  > Liveness support in Morphic is designed to handle situations like this.
>
> Fair point, liveness is a great good! However ...
> The current approach makes it possible to click the picking button, move
> your mouse and then click the picking button again without affecting the
> target's color. It's like typing something into an inspector pane
> without accepting it. Is this an important behavior? Otherwise, we could
> drop that #isPicking conditional.
Morphic is designed for live and direct interaction instead of modal
interactions. When selecting a color, you either copy from another Morph
(picking) or choose a new shade from a color pane. The color pane is
quite dense, so a preview pane is useful while we click and drag over
the pane. Morphic logic is quite compact and simple to implement. Using
mode flags disrupts this flow and introduces unnecessary complexity.

This is just my opinion. I will let others with more experience in
Morphic pitch in their views.

Regards .. Subbu



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Karl Ramberg
More nit picking about layout.
The buttons are more important than the text: Current selection:
Maybe remove that text all together.


Best,
Karl



On Sat, Feb 29, 2020 at 4:46 PM Thiede, Christoph <[hidden email]> wrote:

Would like that the text on the buttons did not abbreviate down.


I think this is a space problem. If you expand it a little bit, you can read the full text:




However, I added balloons for the buttons.
Hm, should the default balloon text for each button in Squeak be its content if abbreviated?

One nice feature of old color picker is that it is modal and goes away on mouse up, but I guess I will get used to the new one.

The advantage of the new one is that no modality is enforced. You can open multiple pickers side-by-side, even on the same target (though I'm afraid they are not synced).

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 14:33:13
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 6:23 PM, Thiede, Christoph wrote:
>  > Liveness support in Morphic is designed to handle situations like this.
>
> Fair point, liveness is a great good! However ...
> The current approach makes it possible to click the picking button, move
> your mouse and then click the picking button again without affecting the
> target's color. It's like typing something into an inspector pane
> without accepting it. Is this an important behavior? Otherwise, we could
> drop that #isPicking conditional.
Morphic is designed for live and direct interaction instead of modal
interactions. When selecting a color, you either copy from another Morph
(picking) or choose a new shade from a color pane. The color pane is
quite dense, so a preview pane is useful while we click and drag over
the pane. Morphic logic is quite compact and simple to implement. Using
mode flags disrupts this flow and introduces unnecessary complexity.

This is just my opinion. I will let others with more experience in
Morphic pitch in their views.

Regards .. Subbu




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Karl Ramberg
And what about having buttons 'cancel' and 'ok' instead of 'close'
'cancel' when you don't want to change the color and 'ok' to confirm your choice.

Best,
Karl


On Sat, Feb 29, 2020 at 5:55 PM karl ramberg <[hidden email]> wrote:
More nit picking about layout.
The buttons are more important than the text: Current selection:
Maybe remove that text all together.


Best,
Karl



On Sat, Feb 29, 2020 at 4:46 PM Thiede, Christoph <[hidden email]> wrote:

Would like that the text on the buttons did not abbreviate down.


I think this is a space problem. If you expand it a little bit, you can read the full text:




However, I added balloons for the buttons.
Hm, should the default balloon text for each button in Squeak be its content if abbreviated?

One nice feature of old color picker is that it is modal and goes away on mouse up, but I guess I will get used to the new one.

The advantage of the new one is that no modality is enforced. You can open multiple pickers side-by-side, even on the same target (though I'm afraid they are not synced).

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 14:33:13
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 6:23 PM, Thiede, Christoph wrote:
>  > Liveness support in Morphic is designed to handle situations like this.
>
> Fair point, liveness is a great good! However ...
> The current approach makes it possible to click the picking button, move
> your mouse and then click the picking button again without affecting the
> target's color. It's like typing something into an inspector pane
> without accepting it. Is this an important behavior? Otherwise, we could
> drop that #isPicking conditional.
Morphic is designed for live and direct interaction instead of modal
interactions. When selecting a color, you either copy from another Morph
(picking) or choose a new shade from a color pane. The color pane is
quite dense, so a preview pane is useful while we click and drag over
the pane. Morphic logic is quite compact and simple to implement. Using
mode flags disrupts this flow and introduces unnecessary complexity.

This is just my opinion. I will let others with more experience in
Morphic pitch in their views.

Regards .. Subbu




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Christoph Thiede

The buttons are more important than the text: Current selection:

> Maybe remove that text all together.

Fair point :-)




And what about having buttons 'cancel' and 'ok' instead of 'close'

> 'cancel' when you don't want to change the color and 'ok' to confirm your choice.

You're assuming modality. NCPM is not modal. It's live :-)

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von karl ramberg <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 19:06:30
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
And what about having buttons 'cancel' and 'ok' instead of 'close'
'cancel' when you don't want to change the color and 'ok' to confirm your choice.

Best,
Karl


On Sat, Feb 29, 2020 at 5:55 PM karl ramberg <[hidden email]> wrote:
More nit picking about layout.
The buttons are more important than the text: Current selection:
Maybe remove that text all together.


Best,
Karl



On Sat, Feb 29, 2020 at 4:46 PM Thiede, Christoph <[hidden email]> wrote:

Would like that the text on the buttons did not abbreviate down.


I think this is a space problem. If you expand it a little bit, you can read the full text:




However, I added balloons for the buttons.
Hm, should the default balloon text for each button in Squeak be its content if abbreviated?

One nice feature of old color picker is that it is modal and goes away on mouse up, but I guess I will get used to the new one.

The advantage of the new one is that no modality is enforced. You can open multiple pickers side-by-side, even on the same target (though I'm afraid they are not synced).

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 14:33:13
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 6:23 PM, Thiede, Christoph wrote:
>  > Liveness support in Morphic is designed to handle situations like this.
>
> Fair point, liveness is a great good! However ...
> The current approach makes it possible to click the picking button, move
> your mouse and then click the picking button again without affecting the
> target's color. It's like typing something into an inspector pane
> without accepting it. Is this an important behavior? Otherwise, we could
> drop that #isPicking conditional.
Morphic is designed for live and direct interaction instead of modal
interactions. When selecting a color, you either copy from another Morph
(picking) or choose a new shade from a color pane. The color pane is
quite dense, so a preview pane is useful while we click and drag over
the pane. Morphic logic is quite compact and simple to implement. Using
mode flags disrupts this flow and introduces unnecessary complexity.

This is just my opinion. I will let others with more experience in
Morphic pitch in their views.

Regards .. Subbu




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

K K Subbu
In reply to this post by Christoph Thiede
On 29/02/20 9:16 PM, Thiede, Christoph wrote:
> @Subbu: I value your argument, it's just the morph being recolored not
> really looking nice during moving your cursor when picking is enabled.

It could be because ColorPickerMorph lets Morphic handle live stepping
during drag over the whole display while the new one doesn't; Drag works
only over the SVColorSelector and a new pick mode is introduced to move
outside this selector. I do like the new picker's size. It is much
easier on my aging vision than the old one.

ColorPickerMorph has its faults. Its buildChartForm/initialize uses
hard-coded box extents that are too small for modern displays and its
hover help strings are shown under the pane :-(. But its live stepping
while moving the mouse over the whole display in its pickUpColorFor: and
its automatic dismissal on mouseUp are definite plusses. They make
changing color a quick and smooth experience.

> Let's wait some time for others' opinions :)
+1.

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Chris Muller-3
In reply to this post by Karl Ramberg
When choosing colors, it's a process of selection and refinement -- the user will almost always make multiple selections before settling on one.  So you need to be able to keep the color picker open while operating whatever is being affected.  Ok and Cancel imply a modal color picker, I'd rather keep it non-modal with multiple 'Undo' as the preferred way to "cancel" prior selections.  I don't want to "Close" it until I'm ready to, and a Close is just right for that.

 - Chris

On Sat, Feb 29, 2020 at 12:06 PM karl ramberg <[hidden email]> wrote:
And what about having buttons 'cancel' and 'ok' instead of 'close'
'cancel' when you don't want to change the color and 'ok' to confirm your choice.

Best,
Karl


On Sat, Feb 29, 2020 at 5:55 PM karl ramberg <[hidden email]> wrote:
More nit picking about layout.
The buttons are more important than the text: Current selection:
Maybe remove that text all together.


Best,
Karl



On Sat, Feb 29, 2020 at 4:46 PM Thiede, Christoph <[hidden email]> wrote:

Would like that the text on the buttons did not abbreviate down.


I think this is a space problem. If you expand it a little bit, you can read the full text:




However, I added balloons for the buttons.
Hm, should the default balloon text for each button in Squeak be its content if abbreviated?

One nice feature of old color picker is that it is modal and goes away on mouse up, but I guess I will get used to the new one.

The advantage of the new one is that no modality is enforced. You can open multiple pickers side-by-side, even on the same target (though I'm afraid they are not synced).

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Samstag, 29. Februar 2020 14:33:13
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
On 29/02/20 6:23 PM, Thiede, Christoph wrote:
>  > Liveness support in Morphic is designed to handle situations like this.
>
> Fair point, liveness is a great good! However ...
> The current approach makes it possible to click the picking button, move
> your mouse and then click the picking button again without affecting the
> target's color. It's like typing something into an inspector pane
> without accepting it. Is this an important behavior? Otherwise, we could
> drop that #isPicking conditional.
Morphic is designed for live and direct interaction instead of modal
interactions. When selecting a color, you either copy from another Morph
(picking) or choose a new shade from a color pane. The color pane is
quite dense, so a preview pane is useful while we click and drag over
the pane. Morphic logic is quite compact and simple to implement. Using
mode flags disrupts this flow and introduces unnecessary complexity.

This is just my opinion. I will let others with more experience in
Morphic pitch in their views.

Regards .. Subbu





Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Chris Muller-3
In reply to this post by Christoph Thiede
Hi Christoph,

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

I agree with you about the usability aspect, and with Subbu about the implementation of a new instVar if the same could be accomplished by simply telling it to #stopStepping entirely once Pick is clicked.  Then #startStepping again after pickage or whenever appropriate..

I didn't look at the code in detail, so don't know if there's some practical limitation which disrupts that, if so, please ignore and pardon me.  :)

Best,
  Chris

 


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Karl Ramberg
So maybe an explicit undo button then ?

Best,
Karl


On Sun, Mar 1, 2020 at 11:00 PM Chris Muller <[hidden email]> wrote:
Hi Christoph,

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

I agree with you about the usability aspect, and with Subbu about the implementation of a new instVar if the same could be accomplished by simply telling it to #stopStepping entirely once Pick is clicked.  Then #startStepping again after pickage or whenever appropriate..

I didn't look at the code in detail, so don't know if there's some practical limitation which disrupts that, if so, please ignore and pardon me.  :)

Best,
  Chris

 



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Chris Muller-4
I was thinking a list of "prior selections" in a slide-out drawer (or, wherever).  It would be preloaded with the first one which would be the original "from" color (Cancel functionality)...

On Mon, Mar 2, 2020 at 3:04 PM karl ramberg <[hidden email]> wrote:
So maybe an explicit undo button then ?

Best,
Karl


On Sun, Mar 1, 2020 at 11:00 PM Chris Muller <[hidden email]> wrote:
Hi Christoph,

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

I agree with you about the usability aspect, and with Subbu about the implementation of a new instVar if the same could be accomplished by simply telling it to #stopStepping entirely once Pick is clicked.  Then #startStepping again after pickage or whenever appropriate..

I didn't look at the code in detail, so don't know if there's some practical limitation which disrupts that, if so, please ignore and pardon me.  :)

Best,
  Chris

 



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1634.mcz

Christoph Thiede

Ok and Cancel imply a modal color picker, I'd rather keep it non-modal with multiple 'Undo' as the preferred way to "cancel" prior selections.  I don't want to "Close" it until I'm ready to, and a Close is just right for that.


+1


I didn't look at the code in detail, so don't know if there's some practical limitation which disrupts that, if so, please ignore and pardon me.  :)


The NCPM does not use stepping. It uses an observer pattern - see #selectedColor:, #colorSelected:, and #targetColor: :)

I was thinking a list of "prior selections" in a slide-out drawer (or, wherever).  It would be preloaded with the first one which would be the original "from" color (Cancel functionality)...

Wow-wow! This proposal sounds indeed interesting as a general concept (one might use it as well for editors or morph operations, for example), but a few numbers larger than the current change. I will be excited to study your changesets/commits about it! But I would not make this commit - the picking button - dependent on such a history slider :-)

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Chris Muller <[hidden email]>
Gesendet: Montag, 2. März 2020 22:10:35
An: karl ramberg
Cc: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1634.mcz
 
I was thinking a list of "prior selections" in a slide-out drawer (or, wherever).  It would be preloaded with the first one which would be the original "from" color (Cancel functionality)...

On Mon, Mar 2, 2020 at 3:04 PM karl ramberg <[hidden email]> wrote:
So maybe an explicit undo button then ?

Best,
Karl


On Sun, Mar 1, 2020 at 11:00 PM Chris Muller <[hidden email]> wrote:
Hi Christoph,

@Subbu: I value your argument, it's just the morph being recolored not really looking nice during moving your cursor when picking is enabled. Let's wait some time for others' opinions :)

I agree with you about the usability aspect, and with Subbu about the implementation of a new instVar if the same could be accomplished by simply telling it to #stopStepping entirely once Pick is clicked.  Then #startStepping again after pickage or whenever appropriate..

I didn't look at the code in detail, so don't know if there's some practical limitation which disrupts that, if so, please ignore and pardon me.  :)

Best,
  Chris

 



Carpe Squeak!