[squeak-dev] The Inbox: Morphic-ct.1634.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sat Feb 29 10:49:02 UTC 2020


[cid:1290314a-e657-4d2e-9c61-e43b9fce21ec]

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Samstag, 29. Februar 2020 11:46:56
An: squeak-dev at lists.squeakfoundation.org
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 at 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 at 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 at 240;
+                addMorphBack: hsvaMorph;
+                layoutInset: 4;
+                cellGap: 2.!
-                 color: (Color white darker) ;
-                 changeTableLayout ;
-                 hResizing: #shrinkWrap ;
-                 vResizing: #shrinkWrap ;
-                 extent: 240 at 240 ;
-                 addMorphBack: hsvaMorph ;
-                 layoutInset: 4 ;
-                 cellGap: 2.!

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200229/a9bf919d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 70416 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200229/a9bf919d/attachment-0001.png>


More information about the Squeak-dev mailing list