It should now be more feasible to remove some hard coded gradients in widgets like windows, buttons and menus. Many of them rely on one user selected color and to hard code the other to white for example. It should now be much easier to edit a gradient with more than 2 colors
Karl
On Thu, Oct 29, 2015 at 1:10 PM, commits@source.squeak.org wrote:
Karl Ramberg uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-kfr.1022.mcz
==================== Summary ====================
Name: Morphic-kfr.1022 Author: kfr Time: 29 October 2015, 12:52:07.646 pm UUID: 64c8e8d1-462d-48e5-af29-706bd470f767 Ancestors: Morphic-kfr.1021
More look enhancements
=============== Diff against Morphic-kfr.1021 ===============
Item was changed: RectangleMorph subclass: #GradientEditor
instanceVariableNames: 'gradientDisplay rampMorphs selectedSketch
row text target selector morph'
instanceVariableNames: 'gradientDisplay rampMorphs selectedSketch
gradientMorph row text target selector morph' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Widgets'!
Item was changed: ----- Method: GradientEditor>>addButtonRow (in category 'initialization') ----- addButtonRow | button button2 buttonRow button3 | buttonRow := RectangleMorph new borderWidth: 0; color: Color transparent; layoutPolicy: TableLayout new;
hResizing: #spaceFil;
vResizing: #spaceFill;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap; cellPositioning: #center; listCentering: #topLeft; listDirection: #LeftToRight; reverseTableCells: true;
cellInset: 4.
cellInset: 20 @ 20. button := PluggableButtonMorph on: self getState: nil action: #addHandle label: #addColorButtonLabel.
button hResizing: #spaceFill;
vResizing: #spaceFill. buttonRow addMorph: button. button2 := PluggableButtonMorph on: self getState: nil action: #deleteHandle label: #removeColorButtonLabel.
button2 hResizing: #spaceFill;
vResizing: #spaceFill. buttonRow addMorph: button2. button3 := PluggableButtonMorph on: self getState: nil action: #delete label: #closeButtonLabel.
button3 hResizing: #spaceFill;
vResizing: #spaceFill. buttonRow addMorph: button3. self addMorph: buttonRow!
Item was changed:
----- Method: GradientEditor>>initialize (in category 'initialization')
initialize
super initialize. self myLayout. self extent: 600 @ 150. row := RectangleMorph new extent: self width @ 100; color: Color
transparent; borderColor: #inset.
row addMorph: (gradientDisplay := GradientDisplayMorph new
position: 20 @ 20; extent: self width - 40 @ 40). gradientDisplay fillStyle direction: gradientDisplay width @ 0.
self addMorph: row. self addButtonRow.
"text := PluggableTextMorph
text := PluggableTextMorph on: self text: #colorRamp accept: nil readSelection: nil menu: nil. text color: Color white; width: self width; height: 50.
self addMorph: text."
self addMorph: text. !
Item was changed:
----- Method: GradientEditor>>myLayout (in category 'initialization')
myLayout self color: (Color white darker) ; cornerStyle: #rounded ; borderWidth: 0; layoutPolicy: TableLayout new; hResizing: #shrinkWrap; vResizing: #shrinkWrap; cellPositioning: #center; listCentering: #topLeft; layoutInset: 4; listDirection: #topToBottom; reverseTableCells: true; wrapCentering: #topLeft;
cellInset: 4!
cellInset: 19 @ 10!
Item was changed: ----- Method: GradientEditor>>updateColorRamp (in category 'change reporting') ----- updateColorRamp | newAssociation newKey newColor sketch colorRamp |
self updateRampMorphs. colorRamp := OrderedCollection new. rampMorphs do: [:i | newKey := ((i position x - gradientDisplay left /
gradientDisplay width) asFloat roundUpTo: 0.01) min: 1.0 max: 0.0. sketch := i findA: SketchMorph. newColor := sketch rotatedForm colorAt: sketch rotatedForm center. newAssociation := newKey -> newColor. colorRamp addLast: newAssociation]. colorRamp := colorRamp sorted. gradientDisplay colorRamp: colorRamp. gradientDisplay fillStyle direction: gradientDisplay extent x @ 0. self changed. target ifNotNil:[ target perform: selector with: colorRamp with: morph].
"text setText: self colorRamp"!
text setText: self colorRamp!