The Trunk: Morphic-mt.758.mcz

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

The Trunk: Morphic-mt.758.mcz

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

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

Name: Morphic-mt.758
Author: mt
Time: 24 February 2015, 9:12:34.081 am
UUID: ff6992c3-f93d-a444-a7c4-c04be3fd34af
Ancestors: Morphic-mt.757

Preferences for gradient* fixed or implemented: Windows, buttons, scrollbars, menus. The gradient fill-styles can now be fully disabled in all standard tools. Default is still "enabled".

=============== Diff against Morphic-mt.757 ===============

Item was changed:
  AlignmentMorph subclass: #PluggableButtonMorph
  instanceVariableNames: 'model label getStateSelector actionSelector getLabelSelector getMenuSelector shortcutCharacter askBeforeChanging triggerOnMouseDown offColor onColor feedbackColor showSelectionFeedback allButtons arguments argumentsProvider argumentsSelector style'
+ classVariableNames: 'GradientButton RoundedButtonCorners'
- classVariableNames: '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 added:
+ ----- Method: PluggableButtonMorph class>>gradientButton (in category 'preferences') -----
+ gradientButton
+ <preference: 'gradientButton'
+ category: 'windows'
+ description: 'If true, buttons will have a gradient look.'
+ type: #Boolean>
+ ^ GradientButton ifNil: [ true ]!

Item was added:
+ ----- Method: PluggableButtonMorph class>>gradientButton: (in category 'preferences') -----
+ gradientButton: aBoolean
+
+ GradientButton := aBoolean.!

Item was changed:
  ----- Method: PluggableButtonMorph>>drawOn: (in category 'drawing') -----
  drawOn: aCanvas
+ | cc gradient borderColor fill |
- | cc gradient borderColor |
  cc := self color.
  cc isTransparent ifTrue:[cc := Color gray: 0.9].
  self enabled ifFalse:[cc := Color lightGray].
  cc brightness > 0.9 ifTrue:[cc := cc adjustBrightness: 0.9 - cc brightness].
  showSelectionFeedback ifTrue:[
  borderColor := cc 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}.
+ cc := cc muchDarker.
- 1 -> cc muchDarker.
- }.
  ] ifFalse:[
  borderColor := Color lightGray.
  gradient := GradientFillStyle ramp: {
  0.0 -> Color white.
  0.1-> (cc adjustBrightness: 0.05).
+ 0.6 -> (cc darker)}.
- 0.6 -> (cc darker).
- }
  ].
  gradient origin: bounds topLeft.
  gradient direction: 0@self height.
+
+ PluggableButtonMorph gradientButton
+ ifFalse: [fill := SolidFillStyle color: cc]
+ ifTrue: [fill := gradient].
+
  ^ self roundedButtonCorners
  ifTrue: [aCanvas
  frameAndFillRoundRect: bounds
  radius: 8
+ fillStyle: fill
- fillStyle: gradient
  borderWidth: 1
  borderColor: borderColor]
  ifFalse: [aCanvas
  frameAndFillRectangle: self innerBounds
+ fillColor: fill asColor
- fillColor: gradient asColor
  borderWidth: 1
  borderColor: borderColor darker;
  fillRectangle: (self innerBounds insetBy: 1)
+ fillStyle: fill]!
- fillStyle: gradient]!

Item was changed:
  ----- Method: ScrollBar class>>createArrowOfDirection:size:color: (in category 'images') -----
  createArrowOfDirection: aSymbolDirection size: finalSizeInteger color: aColor
  "PRIVATE - create an arrow with aSymbolDirectionDirection,  
  finalSizeInteger and aColor  
 
  aSymbolDirectionDirection = #top, #bottom. #left or #right  
 
  Try with:  
  (ScrollBar createArrowOfDirection: #top size: 32 color: Color  
  lightGreen) asMorph openInHand.  
  "
  | resizeFactor outerBox arrow resizedForm gradient |
  resizeFactor := 4.
+ outerBox := RectangleMorph new
+ extent: finalSizeInteger asPoint * resizeFactor;
+ borderWidth: 0;
+ color: aColor.
+
+ Preferences gradientScrollBars ifTrue: [
+ gradient := GradientFillStyle ramp: {
+ 0 -> (Color gray: 0.95).
+ 0.49 -> (Color gray: 0.9).
+ 0.5 -> (Color gray: 0.87).
+ 1 -> (Color gray: 0.93).
+ }.
+ gradient origin: outerBox topLeft.
+ (aSymbolDirection == #left or:[aSymbolDirection == #right])
+ ifTrue:[gradient direction: 0@ outerBox height]
+ ifFalse:[gradient direction: outerBox width @ 0].
+ outerBox fillStyle: gradient].
- outerBox := RectangleMorph new.
- outerBox extent: finalSizeInteger asPoint * resizeFactor;
- borderWidth: 0;
- color: aColor.
- gradient := GradientFillStyle ramp: {
- 0 -> (Color gray: 0.95).
- 0.49 -> (Color gray: 0.9).
- 0.5 -> (Color gray: 0.87).
- 1 -> (Color gray: 0.93).
- }.
- gradient origin: outerBox topLeft.
- (aSymbolDirection == #left or:[aSymbolDirection == #right])
- ifTrue:[gradient direction: 0@ outerBox height]
- ifFalse:[gradient direction: outerBox width @ 0].
- outerBox fillStyle: gradient.
  outerBox borderStyle: (BorderStyle width: 4 color: Color lightGray).
 
  ""
  arrow := self createArrowOfDirection: aSymbolDirection in: (outerBox bounds expandBy: -4).
  self updateScrollBarButtonAspect: arrow color: aColor muchDarker.
  outerBox addMorphCentered: arrow.
  ""
  resizedForm := outerBox imageForm
  magnify: outerBox imageForm boundingBox
  by: 1 / resizeFactor
  smoothing: 4.
  ""
  ^ (resizedForm replaceColor: aColor withColor: Color transparent)
  trimBordersOfColor: Color transparent!

Item was changed:
  ----- Method: ScrollBar class>>createBoxOfSize:color: (in category 'images') -----
  createBoxOfSize: finalSizeInteger color: aColor
  "PRIVATE - create a box with finalSizeInteger and aColor  
 
  Try with:  
  (ScrollBar createBoxOfSize: 32 color: Color lightGreen) asMorph  
  openInHand.  
  "
  | resizeFactor outerBox innerBox resizedForm gradient |
  resizeFactor := 4.
+ outerBox := RectangleMorph new
+ extent: finalSizeInteger asPoint * resizeFactor;
+ borderWidth: 0;
+ color: aColor.
+ Preferences gradientScrollBars ifTrue: [
+ gradient := GradientFillStyle ramp: {
+ 0 -> (Color gray: 0.95).
+ 0.49 -> (Color gray: 0.9).
+ 0.5 -> (Color gray: 0.87).
+ 1 -> (Color gray: 0.93).
+ }.
+ gradient origin: outerBox topLeft.
+ gradient direction: outerBox width @ 0.
+ outerBox fillStyle: gradient].
- outerBox := RectangleMorph new.
- outerBox extent: finalSizeInteger asPoint * resizeFactor;
- borderWidth: 0;
- color: aColor.
- gradient := GradientFillStyle ramp: {
- 0 -> (Color gray: 0.95).
- 0.49 -> (Color gray: 0.9).
- 0.5 -> (Color gray: 0.87).
- 1 -> (Color gray: 0.93).
- }.
- gradient origin: outerBox topLeft.
- gradient direction: outerBox width @ 0.
- outerBox fillStyle: gradient.
  outerBox borderStyle: (BorderStyle width: 4 color: Color lightGray).
  ""
  innerBox := self createBoxIn: (outerBox bounds expandBy: -4).
  self updateScrollBarButtonAspect: innerBox color: aColor muchDarker.
  outerBox addMorphCentered: innerBox.
  ""
  resizedForm := outerBox imageForm
  magnify: outerBox imageForm boundingBox
  by: 1 / resizeFactor
  smoothing: 4.
  ""
  ^ (resizedForm replaceColor: aColor withColor: Color transparent)
  trimBordersOfColor: Color transparent!

Item was changed:
  ----- Method: ScrollBar class>>updateScrollBarButtonAspect:color: (in category 'coloring morphs') -----
  updateScrollBarButtonAspect: aMorph color: aColor
  "update aMorph with aColor"
  | fill direction |
  aMorph isNil
  ifTrue: [^ self].
  ""
+ aMorph color: aColor.
- aMorph color: aColor.
  Preferences gradientScrollBars
  ifFalse: [^ self].
  ""
+ fill := GradientFillStyle ramp: {
+ 0.0 -> aColor twiceLighter twiceLighter.
+ 1.0 -> aColor twiceDarker}.
- fill := GradientFillStyle ramp: {0.0 -> aColor twiceLighter twiceLighter. 1.0 -> aColor twiceDarker}.
  ""
  direction := ((aMorph width min: aMorph height)
  + ((aMorph width - aMorph height) abs * 0.3)) rounded.
  ""
  fill origin: aMorph topLeft + (direction // 8).
  fill direction: direction @ direction.
  fill radial: true.
  ""
  aMorph fillStyle: fill!

Item was changed:
  ----- Method: ScrollBar>>updateSliderColor: (in category 'access') -----
  updateSliderColor: aColor
  | gradient |
+
+ slider borderStyle: (BorderStyle width: 1 color: Color lightGray).
+ self borderWidth: 0.
+
+ Preferences gradientScrollBars ifFalse: [
+ slider color: aColor.
+ pagingArea color: aColor darker darker.
+ ^ self].
+
+ "Fill the slider."
  gradient := GradientFillStyle ramp: {
  0 -> (Color gray: 0.95).
  0.49 -> (Color gray: 0.9).
  0.5 -> (Color gray: 0.87).
  1 -> (Color gray: 0.93).
  }.
  gradient origin: slider topLeft.
  gradient direction: (self bounds isWide
  ifTrue:[0@slider height]
  ifFalse:[slider width@0]).
  slider fillStyle: gradient.
+
+ "Fill the paging area."
- slider borderStyle: (BorderStyle width: 1 color: Color lightGray).
-
  gradient := GradientFillStyle ramp: {
  0 -> (Color gray: 0.65).
  0.6 -> (Color gray: 0.82).
  1 -> (Color gray: 0.88).
  }.
  gradient origin: self topLeft.
  gradient direction: (self bounds isWide
  ifTrue:[0@self height]
  ifFalse:[self width@0]).
- self borderWidth: 0.
  pagingArea fillStyle: gradient.!

Item was changed:
  MorphicModel subclass: #SystemWindow
  instanceVariableNames: 'labelString stripes label closeBox collapseBox activeOnlyOnTop paneMorphs paneRects collapsedFrame fullFrame isCollapsed menuBox mustNotClose labelWidgetAllowance updatablePanes allowReframeHandles labelArea expandBox'
+ classVariableNames: 'ClickOnLabelToEdit CloseBoxFrame CloseBoxImage CollapseBoxImage DoubleClickOnLabelToExpand ExpandBoxFrame ExpandBoxImage GradientWindow HideExpandButton MenuBoxFrame MenuBoxImage ResizeAlongEdges ReuseWindows TopWindow'
- classVariableNames: 'ClickOnLabelToEdit CloseBoxFrame CloseBoxImage CollapseBoxImage DoubleClickOnLabelToExpand ExpandBoxFrame ExpandBoxImage HideExpandButton MenuBoxFrame MenuBoxImage ResizeAlongEdges ReuseWindows TopWindow'
  poolDictionaries: ''
  category: 'Morphic-Windows'!
 
  !SystemWindow commentStamp: '<historical>' prior: 0!
  SystemWindow is the Morphic equivalent of StandardSystemView -- a labelled container for rectangular views, with iconic facilities for close, collapse/expand, and resizing.
 
  The attribute onlyActiveOnTop, if set to true (and any call to activate will set this), determines that only the top member of a collection of such windows on the screen shall be active.  To be not active means that a mouse click in any region will only result in bringing the window to the top and then making it active.!

Item was added:
+ ----- Method: SystemWindow class>>gradientWindow (in category 'preferences') -----
+ gradientWindow
+
+ <preference: 'gradientWindow'
+ category: 'windows'
+ description: 'If true, windows will have a gradient look.'
+ type: #Boolean>
+ ^ GradientWindow ifNil: [true]
+ !

Item was added:
+ ----- Method: SystemWindow class>>gradientWindow: (in category 'preferences') -----
+ gradientWindow: aBoolean
+
+ GradientWindow := aBoolean.!

Item was changed:
  ----- Method: SystemWindow>>setStripeColorsFrom: (in category 'label') -----
  setStripeColorsFrom: paneColor
  "Set the stripe color based on the given paneColor"
 
  labelArea ifNotNil: [labelArea color: Color transparent].
  self updateBoxesColor: (self isActive
  ifTrue: [paneColor]
  ifFalse: [paneColor muchDarker]).
  stripes ifNil: [^self].
+
+ SystemWindow gradientWindow
+ ifTrue: [
+ self fillStyle: (self isActive
+ ifTrue: [self gradientWithColor: paneColor duller "lighter lighter lighter"]
+ ifFalse: [self gradientWithColor: paneColor duller darker])]
+ ifFalse: [
+ self color: (self isActive
+ ifTrue: [paneColor]
+ ifFalse: [paneColor duller])].!
- self isActive
- ifTrue: [self fillStyle: (self gradientWithColor: paneColor duller "lighter lighter lighter")]
- ifFalse: ["This could be much faster"
- self fillStyle: (self gradientWithColor: paneColor duller)].!

Item was changed:
  ----- Method: SystemWindow>>updateBox:color: (in category 'panes') -----
  updateBox: anIconMorph color: aColor
+
  | fill |
  anIconMorph isNil
  ifTrue: [^ self].
  anIconMorph
  extent: self boxExtent;
  useRoundedCorners.
- fill := GradientFillStyle ramp: {0.0 -> aColor muchLighter muchLighter. 1.0 -> aColor twiceDarker}.
-
- fill origin: anIconMorph topLeft + (5 @ 5).
- fill direction: anIconMorph extent.
 
+ SystemWindow gradientWindow
+ ifFalse: [anIconMorph color: aColor]
+ ifTrue: [
+ fill := GradientFillStyle ramp: {
+ 0.0 -> aColor muchLighter muchLighter.
+ 1.0 -> aColor twiceDarker}.
+ fill origin: anIconMorph topLeft + (5 @ 5).
+ fill direction: anIconMorph extent.
+ anIconMorph fillStyle: fill].
+
+ anIconMorph
+ borderWidth: (Preferences alternativeWindowBoxesLook
+ ifTrue: [1]
+ ifFalse: [0]);
+ borderColor: aColor darker.!
- anIconMorph fillStyle: fill.
- anIconMorph borderWidth: (Preferences alternativeWindowBoxesLook
- ifTrue: [1]
- ifFalse: [0]);
- borderColor: aColor darker!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.758.mcz

David T. Lewis
On Tue, Feb 24, 2015 at 08:12:39AM +0000, [hidden email] wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.758.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.758
> Author: mt
> Time: 24 February 2015, 9:12:34.081 am
> UUID: ff6992c3-f93d-a444-a7c4-c04be3fd34af
> Ancestors: Morphic-mt.757
>
> Preferences for gradient* fixed or implemented: Windows, buttons, scrollbars, menus. The gradient fill-styles can now be fully disabled in all standard tools. Default is still "enabled".
>


Nice. I expect that this will be helpful on slower machines.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.758.mcz

marcel.taeumel (old)
no-gradients.png

Here a picture for the visual impression. :)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.758.mcz

Bert Freudenberg

> On 24.02.2015, at 07:49, Marcel Taeumel <[hidden email]> wrote:
>
> no-gradients.png <http://forum.world.st/file/n4807312/no-gradients.png>  
>
> Here a picture for the visual impression. :)

Nice. Now you just need to make it fall back to that automatically if the VM does not have the balloon rendering plugin :)

- Bert -




smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.758.mcz

Tobias Pape

On 24.02.2015, at 20:03, Bert Freudenberg <[hidden email]> wrote:

>
>> On 24.02.2015, at 07:49, Marcel Taeumel <[hidden email]> wrote:
>>
>> no-gradients.png <http://forum.world.st/file/n4807312/no-gradients.png>  
>>
>> Here a picture for the visual impression. :)
>
> Nice. Now you just need to make it fall back to that automatically if the VM does not have the balloon rendering plugin :)


\o/

yes please :)





signature.asc (1K) Download Attachment