The Inbox: EToys-kfr.127.mcz

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

The Inbox: EToys-kfr.127.mcz

commits-2
A new version of EToys was added to project The Inbox:
http://source.squeak.org/inbox/EToys-kfr.127.mcz

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

Name: EToys-kfr.127
Author: kfr
Time: 6 May 2015, 8:58:58.372 pm
UUID: 78d9ce0c-9ee9-0c40-85cf-3fc29198913c
Ancestors: EToys-kfr.126

Enhance color settings in PreferenceBrowser towards using more fillstyles for color and borders than just solid fill.

=============== Diff against EToys-kfr.126 ===============

Item was changed:
  PBPreferenceView subclass: #PBColorPreferenceView
+ instanceVariableNames: 'button'
- instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Etoys-PreferenceBrowser'!

Item was added:
+ ----- Method: PBColorPreferenceView>>adjustLabelColor (in category 'user interface') -----
+ adjustLabelColor
+ | textColor |
+ (self preference preferenceValue luminance < 0.5)
+ ifTrue:[ textColor := Color white]
+ ifFalse:[ textColor := Color black].
+ button allMorphsDo: [:m | (m isKindOf: StringMorph) ifTrue: [ m color: textColor]]. !

Item was added:
+ ----- Method: PBColorPreferenceView>>borderStyleMenu (in category 'user interface') -----
+ borderStyleMenu
+ "Add border-style menu items"
+
+ |  aMenu |
+ aMenu := MenuMorph new defaultTarget: self.
+
+ aMenu addStayUpItemSpecial.
+ aMenu add: 'border color...' translated target: self selector:#changeColor: argument: button.
+ aMenu addLine.
+ BorderStyle borderStyleChoices do:
+ [:sym | (aMenu borderStyleForSymbol: sym)
+ ifNotNil:
+ [aMenu add: sym translated target: self selector: #setBorderStyle: argument: sym]].
+ ^aMenu openNear: ActiveHand bounds.
+ !

Item was added:
+ ----- Method: PBColorPreferenceView>>changeColor: (in category 'user interface') -----
+ changeColor: aButton
+ aButton changeColor.
+ self preference preferenceValue: aButton fillStyle.
+ button label: self preference preferenceValue asString.
+ self adjustLabelColor !

Item was added:
+ ----- Method: PBColorPreferenceView>>colorMenuButton (in category 'user interface') -----
+ colorMenuButton
+ | selector name |
+ name := self preference name.
+ (name includesSubstring: 'border' caseSensitive: false)
+ ifTrue: [ selector := #borderStyleMenu]
+ ifFalse:[ selector := #fillStyleMenu].
+ button := SimpleButtonMorph new
+ label: self preference preferenceValue asString;
+ actionSelector: selector;
+ target: self.
+ name = #menuBorderColor
+ ifTrue:[ ^button borderColor: MenuMorph menuBorderColor; borderWidth: MenuMorph menuBorderWidth].
+ name = #menuTitleBorderColor
+ ifTrue:[ ^button borderColor: MenuMorph menuTitleBorderColor; borderWidth: MenuMorph menuTitleBorderWidth].
+ self adjustLabelColor.
+ ^button color: (self preference provider perform: (self preference selectors first)).
+
+
+ "UpdatingRectangleMorph new
+ target: self preference;
+ getSelector: #preferenceValue;
+ putSelector: #preferenceValue:;
+ extent: 22@22;
+ setBalloonText: 'click here to change the color' translated;
+ yourself."!

Item was added:
+ ----- Method: PBColorPreferenceView>>fillStyleMenu (in category 'user interface') -----
+ fillStyleMenu
+ "Add the items for changing the current fill style of the Morph"
+ |  aMenu |
+ "self canHaveFillStyles ifFalse:[^aMenu add: 'change color...' translated target: self action: #changeColor]."
+ aMenu := MenuMorph new defaultTarget: self.
+ "self preference preferenceValue addFillStyleMenuItems: aMenu hand: nil from: self."
+ aMenu add: 'change color...' translated target: self selector:#changeColor: argument: button.
+ aMenu addLine.
+ aMenu add: 'solid fill' translated action: #useSolidFill.
+ "aMenu add: 'gradient fill' translated action: #useGradientFill.
+ aMenu add: 'bitmap fill' translated action: #useBitmapFill.
+ aMenu add: 'default fill' translated action: #useDefaultFill."
+ ^aMenu openNear: ActiveHand bounds.
+ !

Item was changed:
  ----- Method: PBColorPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') -----
  representativeButtonWithColor: aColor inPanel: aPreferenceBrowser
  ^self horizontalPanel
  layoutInset: 2;
  color: aColor;
  cellInset: 20;
  cellPositioning: #center;
  addMorphBack: (StringMorph contents: self preference name);
  addMorphBack: self horizontalFiller;
+ addMorphBack: self colorMenuButton;
- addMorphBack: self colorSwatch;
  yourself!

Item was added:
+ ----- Method: PBColorPreferenceView>>setBorderStyle: (in category 'user interface') -----
+ setBorderStyle: aBorderStyle
+ self preference name = #menuBorderColor
+ ifTrue: [button color: MenuMorph menuColor;
+ borderWidth: MenuMorph menuBorderWidth].
+ self preference name = #menuTitleBorderColor
+ ifTrue: [button color: MenuMorph menuTitleColor;
+ borderWidth: MenuMorph menuTitleBorderWidth].
+ self preference preferenceValue: aBorderStyle.
+ button label: self preference preferenceValue asString;
+ borderColor: aBorderStyle.
+ !

Item was added:
+ ----- Method: PBColorPreferenceView>>useGradientFill (in category 'user interface') -----
+ useGradientFill
+
+ "Make receiver use a solid fill style (e.g., a simple color)"
+
+
+ | color1 color2 fill |
+ self preference preferenceValue isGradientFill ifTrue:[^self]. "Already done"
+ color1 := Color white darker.
+ color2 := self preference preferenceValue asColor.
+ fill := GradientFillStyle ramp: {0.0 -> color1. 1.0 -> color2}.
+ fill origin: ActiveWorld topLeft.
+ fill direction: 0 @ ActiveWorld bounds extent y.
+ fill normal: ActiveWorld bounds extent x @ 0.
+ fill radial: false.
+ self preference preferenceValue: fill.
+ button label: self preference preferenceValue asString;
+ color: self preference preferenceValue!

Item was added:
+ ----- Method: PBColorPreferenceView>>useSolidFill (in category 'user interface') -----
+ useSolidFill
+ "Make receiver use a solid fill style (e.g., a simple color)"
+ self preference preferenceValue isSolidFill ifTrue:[^self]. "Already done"
+ self preference preferenceValue: self preference preferenceValue asColor. "Try minimizing changes"
+
+ button label: self preference preferenceValue asString;
+ color: self preference preferenceValue
+ !