The Trunk: Morphic-mt.1288.mcz

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

The Trunk: Morphic-mt.1288.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1288.mcz

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

Name: Morphic-mt.1288
Author: mt
Time: 17 August 2016, 2:48:55.896125 pm
UUID: 9537c911-8b66-fb41-8b55-64717908dd01
Ancestors: Morphic-mt.1287

There is a toolbuilder test that fails if all buttons in the system have gradients. Make it possible to turn off gradients for certain (test) buttons.

=============== Diff against Morphic-mt.1287 ===============

Item was changed:
  Morph subclass: #PluggableButtonMorph
+ instanceVariableNames: 'model label font getStateSelector actionSelector getLabelSelector getMenuSelector shortcutCharacter askBeforeChanging triggerOnMouseDown offColor onColor feedbackColor showSelectionFeedback allButtons arguments argumentsProvider argumentsSelector style hoverColor borderColor textColor labelOffset wantsGradient'
- instanceVariableNames: 'model label font getStateSelector actionSelector getLabelSelector getMenuSelector shortcutCharacter askBeforeChanging triggerOnMouseDown offColor onColor feedbackColor showSelectionFeedback allButtons arguments argumentsProvider argumentsSelector style hoverColor borderColor textColor labelOffset'
  classVariableNames: 'GradientButton RoundedButtonCorners'
  poolDictionaries: ''
  category: 'Morphic-Pluggable Widgets'!
 
  !PluggableButtonMorph commentStamp: '<historical>' prior: 0!
  A PluggableButtonMorph is a combination of an indicator for a boolean value stored in its model and an action button. The action of a button is often, but not always, to toggle the boolean value that it shows. Its pluggable selectors are:
 
  getStateSelector fetch a boolean value from the model
  actionSelector invoke this button's action on the model
  getLabelSelector fetch this button's lable from the model
  getMenuSelector fetch a pop-up menu for this button from the model
 
  Any of the above selectors can be nil, meaning that the model does not supply behavior for the given action, and the default behavior should be used. For example, if getStateSelector is nil, then this button shows the state of a read-only boolean that is always false.
 
  The model informs its view(s) of changes by sending #changed: to itself with getStateSelector as a parameter. The view tells the model when the button is pressed by sending actionSelector.
 
  If the actionSelector takes one or more arguments, then the following are relevant:
  arguments A list of arguments to provide when the actionSelector is called.
  argumentsProvider The object that is sent the argumentSelector to obtain arguments, if dynamic
  argumentsSelector The message sent to the argumentProvider to obtain the arguments.
 
  Options:
  askBeforeChanging have model ask user before allowing a change that could lose edits
  triggerOnMouseDown do this button's action on mouse down (vs. up) transition
  shortcutCharacter a place to record an optional shortcut key
  !

Item was changed:
  ----- Method: PluggableButtonMorph>>updateFillStylePressing:hovering: (in category 'updating') -----
  updateFillStylePressing: isPressing hovering: isHovering
 
  | gradient cc |
  "Migrate old instances."
  hoverColor ifNil: [hoverColor := onColor darker].
 
  self labelOffset: (isPressing ifTrue: [1@1] ifFalse: [0@0]).
 
  self getModelState
  ifTrue: [self color: onColor]
  ifFalse: [self color: offColor].
  self borderStyle color: borderColor.
 
+ self wantsGradient ifFalse: [
- self class gradientButton ifFalse: [
  isPressing ifTrue: [
  self color: feedbackColor.
  self borderStyle color: feedbackColor muchDarker].
  isHovering ifTrue: [
  self color: hoverColor.
  self borderStyle color: borderColor].
  ^ self].
 
  isPressing ifTrue: [
  cc := feedbackColor.
  self borderColor: feedbackColor muchDarker.
  gradient := GradientFillStyle ramp: {
  0.0 -> cc muchDarker.
  0.1-> (cc adjustBrightness: -0.2).
  0.5 -> cc.
  0.9-> (cc adjustBrightness: -0.1).
  1 -> cc muchDarker}].
  isHovering ifTrue: [
  cc := hoverColor.
  gradient := GradientFillStyle ramp: {
  0.0 -> Color white.
  0.1-> (cc adjustBrightness: 0.05).
  0.6 -> (cc darker)}].
  gradient ifNil: [
  cc := self color.
  gradient := GradientFillStyle ramp: {
  0.0 -> Color white.
  0.1-> (cc adjustBrightness: 0.05).
  0.6 -> (cc darker)}].
 
  gradient origin: bounds topLeft.
  gradient direction: 0@self height.
 
  self fillStyle: gradient.!

Item was added:
+ ----- Method: PluggableButtonMorph>>wantsGradient (in category 'accessing') -----
+ wantsGradient
+ ^ wantsGradient ifNil: [self class gradientButton]!

Item was added:
+ ----- Method: PluggableButtonMorph>>wantsGradient: (in category 'accessing') -----
+ wantsGradient: aBoolean
+ wantsGradient := aBoolean.
+ self changed.!