The Trunk: Morphic-mt.1210.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.1210.mcz

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

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

Name: Morphic-mt.1210
Author: mt
Time: 31 July 2016, 11:01:49.38749 am
UUID: 885974ef-35e1-cd4f-8c9e-858dcd73e15b
Ancestors: Morphic-mt.1209

*** Widget Refactorings and UI Themes (Part 4 of 11) ***

Some fixes and refactorings in menus and docking bars. Prepare both for UI themeing.

=============== Diff against Morphic-mt.1209 ===============

Item was changed:
  ----- Method: DockingBarItemMorph>>adjacentTo (in category 'selecting') -----
  adjacentTo
 
+ | roundedCornersOffset verticalOffset |
- | roundedCornersOffset |
  roundedCornersOffset := MenuMorph roundedMenuCorners
  ifTrue: [Morph preferredCornerRadius negated]
  ifFalse: [0].
+ verticalOffset := 2.
 
  owner isFloating
+ ifTrue: [^ {self bounds bottomLeft + (roundedCornersOffset @ verticalOffset)}].
- ifTrue: [^ {self bounds bottomLeft + (roundedCornersOffset @ 4)}].
  owner isAdheringToTop
+ ifTrue: [^ {self bounds bottomLeft + (roundedCornersOffset @ verticalOffset)}].
- ifTrue: [^ {self bounds bottomLeft + (roundedCornersOffset @ 4)}].
  owner isAdheringToLeft
+ ifTrue: [^ {self bounds topRight + (roundedCornersOffset @ verticalOffset)}].
- ifTrue: [^ {self bounds topRight + (roundedCornersOffset @ 4)}].
  owner isAdheringToBottom
+ ifTrue: [^ {self bounds topLeft + (roundedCornersOffset @ verticalOffset)}].
- ifTrue: [^ {self bounds topLeft + (roundedCornersOffset @ 4)}].
  owner isAdheringToRight
+ ifTrue: [^ {self bounds topLeft + (roundedCornersOffset @ verticalOffset negated)}].
- ifTrue: [^ {self bounds topLeft + (roundedCornersOffset @ -4)}].
  ^ {self bounds bottomLeft + (roundedCornersOffset @ 5)}!

Item was added:
+ ----- Method: DockingBarItemMorph>>drawIconOn: (in category 'drawing') -----
+ drawIconOn: aCanvas
+
+ | pos |
+ self hasIcon ifTrue: [
+ | iconForm |
+ iconForm := self iconForm.
+
+ pos := (contents
+ ifEmpty: [self left + (self width - iconForm width // 2)]
+ ifNotEmpty: [self left])
+ @ (self top + (self height - iconForm height // 2)).
+
+ aCanvas
+ translucentImage: iconForm
+ at: pos].!

Item was added:
+ ----- Method: DockingBarItemMorph>>drawLabelOn: (in category 'drawing') -----
+ drawLabelOn: aCanvas
+
+ | stringBounds |
+ self contents ifEmpty: [^ self].
+
+ stringBounds := bounds.
+
+ self hasIcon ifTrue: [
+ stringBounds := stringBounds left: stringBounds left + self iconForm width + 2 ].
+
+ "Vertical centering."
+ stringBounds := stringBounds top: stringBounds top + stringBounds bottom - self fontToUse height // 2.
+ "Horizontal centering."
+ stringBounds := stringBounds left: stringBounds left + (stringBounds width - (self fontToUse widthOfString: contents) // 2) abs.
+
+ aCanvas
+ drawString: contents
+ in: stringBounds
+ font: self fontToUse
+ color: self colorToUse.!

Item was removed:
- ----- Method: DockingBarItemMorph>>drawOn: (in category 'drawing') -----
- drawOn: aCanvas
- | stringColor stringBounds |
- (isSelected and: [ isEnabled ])
- ifTrue: [
- aCanvas fillRectangle: self bounds fillStyle: self selectionFillStyle.
- stringColor := color negated ]
- ifFalse: [ stringColor := color ].
- stringBounds := bounds.
- stringBounds := stringBounds left: stringBounds left + self stringMargin.
- self hasIcon ifTrue: [
- | iconForm |
- iconForm := self iconForm.
- aCanvas
- translucentImage: iconForm
- at: stringBounds left @ (self top + (self height - iconForm height // 2)).
- stringBounds := stringBounds left: stringBounds left + iconForm width + 2 ].
- stringBounds := stringBounds top: stringBounds top + stringBounds bottom - self fontToUse height // 2.
- aCanvas
- drawString: contents
- in: stringBounds
- font: self fontToUse
- color: stringColor!

Item was added:
+ ----- Method: DockingBarItemMorph>>drawSubMenuMarkerOn: (in category 'drawing') -----
+ drawSubMenuMarkerOn: aCanvas
+ "Ignore."!

Item was removed:
- ----- Method: DockingBarItemMorph>>minWidth (in category 'layout') -----
- minWidth
-
- | iconWidth |
- iconWidth := self hasIcon
- ifTrue: [ self icon width + 2 ]
- ifFalse: [ 0 ].
- ^ (self fontToUse widthOfString: contents) + iconWidth + (2 * self stringMargin)!

Item was removed:
- ----- Method: DockingBarItemMorph>>stringMargin (in category 'layout') -----
- stringMargin
-
- ^Preferences tinyDisplay
- ifTrue: [ 1 ]
- ifFalse: [ 6 ]!

Item was removed:
- ----- Method: DockingBarItemMorph>>subMenuMarker (in category 'private') -----
- subMenuMarker
-
- self shouldNotImplement!

Item was changed:
+ Morph subclass: #DockingBarMorph
- AlignmentMorph subclass: #DockingBarMorph
  instanceVariableNames: 'originalColor gradientRamp fillsOwner avoidVisibleBordersAtEdge autoGradient selectedItem activeSubMenu oldKeyboardFocus oldMouseFocus'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Morphic-Menus-DockingBar'!

Item was added:
+ ----- Method: DockingBarMorph class>>themeProperties (in category 'preferences') -----
+ themeProperties
+
+ ^ super themeProperties, {
+ { #borderColor. 'Colors'. 'Color of the menu''s border.' }.
+ { #borderWidth. 'Geometry'. 'Width of the menu''s border.' }.
+ { #borderStyle. 'Borders'. 'Whether to use a plain border, inset, or outset.' }.
+ { #color. 'Colors'. 'Background color of the menu.' }.
+
+ { #lineColor. 'Colors'. 'Color of the separators between menu items.' }.
+ { #lineStyle. 'Colors'. 'Use border-style to change appearance.' }.
+ { #lineWidth. 'Geometry'. 'How big the separators should be.' }.
+ }!

Item was changed:
  ----- Method: DockingBarMorph>>addLine (in category 'construction') -----
  addLine
  "Append a divider line to this menu. Suppress duplicate lines."
 
+ | colorToUse |
  submorphs isEmpty ifTrue: [^ self].
+ self lastSubmorph knownName = #line ifTrue: [^ self].
+
+ colorToUse := self userInterfaceTheme lineColor ifNil: [Color gray: 0.9].
+ self addMorphBack: (Morph new
+ color: colorToUse;
+ extent: (self userInterfaceTheme lineWidth ifNil: [2]) asPoint;
+ borderStyle: (self userInterfaceTheme lineStyle ifNil: [BorderStyle inset]);
+ borderColor: colorToUse;
+ borderWidth: 1;
+ name: #line; "see above"
+ yourself).!
- (self lastSubmorph isKindOf: MenuLineMorph)
- ifFalse: [self addMorphBack: MenuLineMorph new].
- !

Item was added:
+ ----- Method: DockingBarMorph>>applyUserInterfaceTheme (in category 'update') -----
+ applyUserInterfaceTheme
+
+ | colorToUse |
+ gradientRamp := nil.
+
+ super applyUserInterfaceTheme.
+
+ self setDefaultParameters.
+
+ "Update properties of separating lines."
+ colorToUse := self userInterfaceTheme lineColor ifNil: [Color gray: 0.9].
+ self submorphs
+ select: [:ea | ea knownName = #line]
+ thenDo: [:line |
+ line
+ color: colorToUse;
+ extent: (self userInterfaceTheme lineWidth ifNil: [2]) asPoint;
+ borderStyle: (self userInterfaceTheme lineStyle ifNil: [BorderStyle inset]);
+ borderColor: colorToUse].!

Item was changed:
  ----- Method: DockingBarMorph>>color: (in category 'accessing') -----
  color: aColor
  "Set the receiver's color."
+
  super color: aColor.
  originalColor := aColor asColor.
+ gradientRamp := nil.
  ""
  self updateColor!

Item was changed:
  ----- Method: DockingBarMorph>>gradientRamp (in category 'private - layout') -----
  gradientRamp
+ | cc |
+ cc := originalColor adjustSaturation: -0.08 brightness: 0.4.
+ ^ gradientRamp ifNil:[gradientRamp := {
+ 0.0 -> cc.
+ 0.25 -> (originalColor mixed: 0.5 with: cc).
+ 0.9 -> originalColor.
+ 1.0 -> originalColor darker.}]!
- ^ gradientRamp ifNil:[{0.0 -> originalColor muchLighter. 1.0 -> originalColor twiceDarker}]!

Item was changed:
  ----- Method: DockingBarMorph>>initialize (in category 'initialize-release') -----
  initialize
  "initialize the receiver"
  super initialize.
+ self changeTableLayout.
+
  selectedItem := nil.
  activeSubMenu := nil.
  fillsOwner := true.
  avoidVisibleBordersAtEdge := true.
  autoGradient := MenuMorph gradientMenu.
  self
  setDefaultParameters ;
  beFloating ;
  beSticky ;
  layoutInset: 0 ;
  dropEnabled: true!

Item was changed:
  ----- Method: DockingBarMorph>>setDefaultParameters (in category 'initialize-release') -----
  setDefaultParameters
  "private - set the default parameter using Preferences as the inspiration source"
+
- | colorFromMenu worldColor menuColor menuBorderColor |
- colorFromMenu := Preferences menuColorFromWorld
- and: [Display depth > 4
- and: [(worldColor := self currentWorld color) isColor]].
- ""
- menuColor := colorFromMenu
- ifTrue: [worldColor luminance > 0.7
- ifTrue: [worldColor mixed: 0.85 with: Color black]
- ifFalse: [worldColor mixed: 0.4 with: Color white]]
- ifFalse: [MenuMorph menuColor].
- ""
- menuBorderColor := Preferences menuAppearance3d
- ifTrue: [#raised]
- ifFalse: [colorFromMenu
- ifTrue: [worldColor muchDarker]
- ifFalse: [MenuMorph menuBorderColor]].
- ""
  self
+ color: (self userInterfaceTheme color ifNil: [Color r: 0.9 g: 0.9 b: 0.9]);
+ borderStyle: (self userInterfaceTheme borderStyle ifNil: [BorderStyle default]);
+ borderColor: (self userInterfaceTheme borderColor ifNil: [Color gray]);
+ borderWidth: (self userInterfaceTheme borderWidth ifNil: [0]).
+
+ self extent: (Preferences standardMenuFont height asPoint).!
- setColor: menuColor
- borderWidth: MenuMorph menuBorderWidth
- borderColor: menuBorderColor!

Item was changed:
  ----- Method: DockingBarMorph>>updateColor (in category 'private - layout') -----
  updateColor
  "private - update the receiver's color"
  | fill |
+ MenuMorph gradientMenu ifFalse: [
- self autoGradient ifFalse: [
  self color ~= originalColor ifTrue: [self color: originalColor].
  ^ self].
  ""
  fill := GradientFillStyle ramp: self gradientRamp.
  ""
  fill origin: self topLeft.
  self isVertical
  ifTrue: [fill direction: self width @ 0]
  ifFalse: [fill direction: 0 @ self height].
  ""
  self fillStyle: fill!

Item was changed:
  ----- Method: DockingBarMorph>>updateLayoutProperties (in category 'private - layout') -----
  updateLayoutProperties
  "private - update the layout properties based on adhering,  
  fillsOwner and avoidVisibleBordersAtEdge preferencs"
  ""
  (self isHorizontal
  or: [self isFloating])
  ifTrue: [self listDirection: #leftToRight]
  ifFalse: [self listDirection: #topToBottom].
  ""
  self hResizing: #shrinkWrap.
  self vResizing: #shrinkWrap.
  self fillsOwner
  ifTrue: [""
  self isHorizontal
  ifTrue: [self hResizing: #spaceFill].
  self isVertical
  ifTrue: [self vResizing: #spaceFill]].
+ ""
+ self isHorizontal ifTrue: [
+ self submorphsDo: [:m | m hResizing: #shrinkWrap; vResizing: #spaceFill]].
+ self isVertical ifTrue: [
+ self submorphsDo: [:m | m vResizing: #shrinkWrap; hResizing: #spaceFill]].
+ !
- !

Item was changed:
  ----- Method: MenuIcons class>>squeakLogoIcon (in category 'accessing - icons') -----
  squeakLogoIcon
  ^ Icons
  at: #squeakLogoIcon ifAbsentPut: [(Form
  extent: 24@16
  depth: 32
+ fromArray: #( 0 0 67108865 2063597569 1778384897 889192449 0 0 0 0 0 0 0 0 0 0 0 0 1610612737 1811939329 1610612737 0 0 0 0 0 905969665 889192449 0 1442840577 788529153 0 0 0 0 0 0 0 0 0 0 1711276033 469762049 0 1728053249 0 0 0 0 0 1006632961 704643073 0 0 1895825409 234881025 0 0 0 0 0 0 0 0 1207959553 838860801 0 0 1728053249 0 0 0 0 0 738197505 989855745 0 0 167772161 1862270977 0 0 0 0 0 0 0 83886081 1879048193 0 0 0 1744830465 0 0 0 0 0 469762049 1258291201 0 0 0 1543503873 520093697 0 0 0 0 0 0 1543503873 335544321 0 0 0 1761607681 0 0 0 0 0 16777217 1644167169 0 0 0 33554433 67108865 0 0 0 0 0 0 33554433 0 0 0 0 1795162113 0 0 0 0 0 0 1711276033 0 0 0 0 0 117440513 0 0 0 0 0 0 0 0 0 100663297 1677721601 0 0 0 0 0 0 1744830465 0 0 0 0 3019898881 4009754625 1056964609 0 0 1090519041 3204448257 1325400065 0 0 0 889192449 889192449 0 0 0 0 0 0 1392508929 352321537 0 0 637534209 4278190081 4278190081 2650800129 0 0 3372220417 4278190081 3758096385 0 0 0 1560281089 117440513 0 0 0 0 0 0 0 0 0 0 134217729 4060086273 4278190081 1929379841 0 0 3187671041 4278190081 3590324225 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 704643073 1577058305 83886081 0 0 771751937 2667577345 956301313 0 0 0 0 0 0 0 0 0 0 369098753 973078529 1577058305 1728053249 1711276033 1325400065 805306369 218103809 0 855638017 922746881 16777217 0 268435457 788529153 1308622849 1593835521 1056964609 436207617 16777217 0 0 1442840577 1761607681 1409286145 788529153 301989889 872415233 1124073473 1627389953 1929379841 973078529 2030043137 4278190081 4278190081 2164260865 1040187393 1946157057 1577058305 939524097 452984833 687865857 1325400065 1778384897 1795162113 1392508929 0 0 855638017 1795162113 1677721601 855638017 620756993 436207617 486539265 285212673 2030043137 4278190081 4278190081 2164260865 486539265 1023410177 922746881 1157627905 1392508929 1845493761 1744830465 486539265 0 0 201326593 2013265921 1006632961 0 553648129 1694498817 1778384897 1694498817 1728053249 738197505 0 855638017 922746881 16777217 738197505 1728053249 1744830465 1778384897 1476395009 251658241 117440513 1476395009 1879048193 150994945 0 16777217 0 486539265 1426063361 16777217 0 0 0 0 0 0 0 0 0 0 0 0 234881025 1728053249 486539265 0 167772161 50331649)
- fromArray: #( 16777215 16777215 67108864 2063597568 1778384896 889192448 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 1610612736 1811939328 1610612736 16777215 16777215 16777215 16777215 16777215 905969664 889192448 16777215 1442840576 788529152 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 1711276032 469762048 16777215 1728053248 16777215 16777215 16777215 16777215 16777215 1006632960 704643072 16777215 16777215 1895825408 234881024 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 1207959552 838860800 16777215 16777215 1728053248 16777215 16777215 16777215 16777215 16777215 738197504 989855744 16777215 16777215 167772160 1862270976 16777215 16777215 16777215 16777215 16777215 16777215 16777215 83886080 1879048192 16777215 16777215 16777215 1744830464 16777215 16777215 16777215 16777215 16777215 469762048 1258291200 16777215 16777215 16777215 1543503872 520093696 16777215 16777215 16777215 16777215 16777215 16777215 1543503872 335544320 16777215 16777215 16777215 1761607680 16777215 16777215 16777215 16777215 16777215 16777216 1644167168 16777215 16777215 16777215 33554432 67108864 16777215 16777215 16777215 16777215 16777215 16777215 33554432 16777215 16777215 16777215 16777215 1795162112 16777215 16777215 16777215 16777215 16777215 16777215 1711276032 16777215 16777215 16777215 16777215 16777215 117440512 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 100663296 1677721600 16777215 16777215 16777215 16777215 16777215 16777215 1744830464 16777215 16777215 16777215 16777215 3019898880 4009754624 1056964608 16777215 16777215 1090519040 3204448256 1325400064 16777215 16777215 16777215 889192448 889192448 16777215 16777215 16777215 16777215 16777215 16777215 1392508928 352321536 16777215 16777215 637534208 4278190080 4278190080 2650800128 16777215 16777215 3372220416 4278190080 3758096384 16777215 16777215 16777215 1560281088 117440512 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 134217728 4060086272 4278190080 1929379840 16777215 16777215 3187671040 4278190080 3590324224 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 704643072 1577058304 83886080 16777215 16777215 771751936 2667577344 956301312 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 369098752 973078528 1577058304 1728053248 1711276032 1325400064 805306368 218103808 16777215 858262026 925501705 16777216 16777215 268435456 788529152 1308622848 1593835520 1056964608 436207616 16777216 16777215 16777215 1442840576 1761607680 1409286144 788529152 301989888 872415232 1124073472 1627389952 1929379840 973078528 2032667403 4280814347 4280814347 2166885388 1040187392 1946157056 1577058304 939524096 452984832 687865856 1325400064 1778384896 1795162112 1392508928 16777215 16777215 855638016 1795162112 1677721600 855638016 620756992 436207616 486539264 285212672 2032667403 4280814347 4280814347 2166885388 486539264 1023410176 922746880 1157627904 1392508928 1845493760 1744830464 486539264 16777215 16777215 201326592 2013265920 1006632960 16777215 553648128 1694498816 1778384896 1694498816 1728053248 738197504 16777215 858262026 925501705 16777216 738197504 1728053248 1744830464 1778384896 1476395008 251658240 117440512 1476395008 1879048192 150994944 16777215 16777216 16777215 486539264 1426063360 16777216 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 234881024 1728053248 486539264 16777215 167772160 50331648)
  offset: 0@0)]!

Item was added:
+ ----- Method: MenuIcons class>>squeakLogoIconColorized: (in category 'accessing - icons') -----
+ squeakLogoIconColorized: aColor
+
+ ^ self squeakLogoIcon
+ collectColors: [:c | aColor alpha: c alpha]!

Item was removed:
- ----- Method: MenuIcons class>>squeakLogoInvertedIcon (in category 'accessing - icons') -----
- squeakLogoInvertedIcon
- ^ Icons
- at: #squeakLogoInvertedIcon ifAbsentPut: [(Form
- extent: 24@16
- depth: 32
- fromArray: #( 16777215 16777215 83886079 2080374783 1795162111 905969663 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 1627389951 1828716543 1627389951 16777215 16777215 16777215 16777215 16777215 922746879 905969663 16777215 1459617791 805306367 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 1728053247 486539263 16777215 1744830463 16777215 16777215 16777215 16777215 16777215 1023410175 721420287 16777215 16777215 1912602623 251658239 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 1224736767 855638015 16777215 16777215 1744830463 16777215 16777215 16777215 16777215 16777215 754974719 1006632959 16777215 16777215 184549375 1879048191 16777215 16777215 16777215 16777215 16777215 16777215 16777215 100663295 1895825407 16777215 16777215 16777215 1761607679 16777215 16777215 16777215 16777215 16777215 486539263 1275068415 16777215 16777215 16777215 1560281087 536870911 16777215 16777215 16777215 16777215 16777215 16777215 1560281087 352321535 16777215 16777215 16777215 1778384895 16777215 16777215 16777215 16777215 16777215 33554431 1660944383 16777215 16777215 16777215 50331647 83886079 16777215 16777215 16777215 16777215 16777215 16777215 50331647 16777215 16777215 16777215 16777215 1811939327 16777215 16777215 16777215 16777215 16777215 16777215 1728053247 16777215 16777215 16777215 16777215 16777215 134217727 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 117440511 1694498815 16777215 16777215 16777215 16777215 16777215 16777215 1761607679 16777215 16777215 16777215 16777215 3036676095 4026531839 1073741823 16777215 16777215 1107296255 3221225471 1342177279 16777215 16777215 16777215 905969663 905969663 16777215 16777215 16777215 16777215 16777215 16777215 1409286143 369098751 16777215 16777215 654311423 4294967295 4294967295 2667577343 16777215 16777215 3388997631 4294967295 3774873599 16777215 16777215 16777215 1577058303 134217727 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 150994943 4076863487 4294967295 1946157055 16777215 16777215 3204448255 4294967295 3607101439 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 721420287 1593835519 100663295 16777215 16777215 788529151 2684354559 973078527 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 385875967 989855743 1593835519 1744830463 1728053247 1342177279 822083583 234881023 16777215 869791221 936769270 33554431 16777215 285212671 805306367 1325400063 1610612735 1073741823 452984831 33554431 16777215 16777215 1459617791 1778384895 1426063359 805306367 318767103 889192447 1140850687 1644167167 1946157055 989855743 2044196084 4292343028 4292343028 2178413555 1056964607 1962934271 1593835519 956301311 469762047 704643071 1342177279 1795162111 1811939327 1409286143 16777215 16777215 872415231 1811939327 1694498815 872415231 637534207 452984831 503316479 301989887 2044196084 4292343028 4292343028 2178413555 503316479 1040187391 939524095 1174405119 1409286143 1862270975 1761607679 503316479 16777215 16777215 218103807 2030043135 1023410175 16777215 570425343 1711276031 1795162111 1711276031 1744830463 754974719 16777215 869791221 936769270 33554431 754974719 1744830463 1761607679 1795162111 1493172223 268435455 134217727 1493172223 1895825407 167772159 16777215 33554431 16777215 503316479 1442840575 33554431 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 251658239 1744830463 503316479 16777215 184549375 67108863)
- offset: 0@0)]!

Item was added:
+ ----- Method: MenuItemMorph class>>applyUserInterfaceTheme (in category 'preferences') -----
+ applyUserInterfaceTheme
+
+ SubMenuMarker := (UserInterfaceTheme current get: #subMenuMarker for: self)
+ ifNil: [self defaultSubMenuMarker].!

Item was added:
+ ----- Method: MenuItemMorph class>>defaultSubMenuMarker (in category 'defaults') -----
+ defaultSubMenuMarker
+
+ | f |
+ f := Form
+ extent: 5@9
+ fromArray: #(2147483648 3221225472 3758096384 4026531840 4160749568 4026531840 3758096384 3221225472 2147483648)
+ offset: 0@0.
+ ^ ColorForm mappingWhiteToTransparentFrom: f!

Item was changed:
  ----- Method: MenuItemMorph class>>initialize (in category 'class initialization') -----
  initialize
  "MenuItemMorph initialize"
 
+ SubMenuMarker := self defaultSubMenuMarker.
- | f |
- f := Form
- extent: 5@9
- fromArray: #(2147483648 3221225472 3758096384 4026531840 4160749568 4026531840 3758096384 3221225472 2147483648)
- offset: 0@0.
- SubMenuMarker := ColorForm mappingWhiteToTransparentFrom: f.
  !

Item was added:
+ ----- Method: MenuItemMorph class>>themeProperties (in category 'preferences') -----
+ themeProperties
+
+ ^ super themeProperties, {
+ { #font. 'Fonts'. 'Font for menu items.' }.
+ { #textColor. 'Colors'. 'Color for the menu item''s labels.' }.
+ { #selectionColor. 'Colors'. 'Color used for items when hovering or selecting them.' }.
+ { #selectionTextColor. 'Colors'. 'Color used for label when hovering or selecting them.' }.
+ { #subMenuMarker. 'Forms'. 'The form to be used to indicate a submenu.' }.
+ }!

Item was added:
+ ----- Method: MenuItemMorph>>applyUserInterfaceTheme (in category 'updating') -----
+ applyUserInterfaceTheme
+
+ super applyUserInterfaceTheme.
+
+ self
+ color: (self userInterfaceTheme textColor ifNil: [Color black]);
+ font: (self userInterfaceTheme font ifNil: [TextStyle defaultFont]).
+ !

Item was added:
+ ----- Method: MenuItemMorph>>colorToUse (in category 'accessing') -----
+ colorToUse
+
+ ^ isSelected & isEnabled
+ ifTrue: [ self userInterfaceTheme selectionTextColor ifNil: [Color white] ]
+ ifFalse: [ color ]!

Item was added:
+ ----- Method: MenuItemMorph>>drawBackgroundOn: (in category 'drawing') -----
+ drawBackgroundOn: aCanvas
+
+ isSelected & isEnabled
+ ifTrue: [aCanvas fillRectangle: self bounds fillStyle: self selectionFillStyle].!

Item was added:
+ ----- Method: MenuItemMorph>>drawIconOn: (in category 'drawing') -----
+ drawIconOn: aCanvas
+
+ self hasIcon ifTrue: [
+ | iconForm |
+ iconForm := self iconForm.
+ aCanvas
+ translucentImage: iconForm
+ at: self bounds left @ (self top + (self height - iconForm height // 2)).].!

Item was added:
+ ----- Method: MenuItemMorph>>drawLabelOn: (in category 'drawing') -----
+ drawLabelOn: aCanvas
+
+ | stringBounds |
+ stringBounds := bounds.
+
+ self hasIcon ifTrue: [
+ stringBounds := stringBounds left: stringBounds left + self iconForm width + 2 ].
+ self hasMarker ifTrue: [
+ stringBounds := stringBounds left: stringBounds left + self submorphBounds width + 8 ].
+
+ stringBounds := stringBounds top: stringBounds top + stringBounds bottom - self fontToUse height // 2.
+
+ aCanvas
+ drawString: contents
+ in: stringBounds
+ font: self fontToUse
+ color: self colorToUse.!

Item was changed:
  ----- Method: MenuItemMorph>>drawOn: (in category 'drawing') -----
  drawOn: aCanvas
+
+ self
+ drawBackgroundOn: aCanvas;
+ drawIconOn: aCanvas;
+ drawLabelOn: aCanvas;
+ drawSubMenuMarkerOn: aCanvas.!
- | stringColor stringBounds |
- isSelected & isEnabled
- ifTrue: [
- aCanvas fillRectangle: self bounds fillStyle: self selectionFillStyle.
- stringColor := color negated ]
- ifFalse: [ stringColor := color ].
- stringBounds := bounds.
- self hasIcon ifTrue: [
- | iconForm |
- iconForm := self iconForm.
- aCanvas
- translucentImage: iconForm
- at: stringBounds left @ (self top + (self height - iconForm height // 2)).
- stringBounds := stringBounds left: stringBounds left + iconForm width + 2 ].
- self hasMarker ifTrue: [
- stringBounds := stringBounds left: stringBounds left + self submorphBounds width + 8 ].
- stringBounds := stringBounds top: stringBounds top + stringBounds bottom - self fontToUse height // 2.
- aCanvas
- drawString: contents
- in: stringBounds
- font: self fontToUse
- color: stringColor.
- self hasSubMenu
- ifTrue: [| subMenuMarker subMenuMarkerPosition |
- subMenuMarker := self subMenuMarker.
- subMenuMarkerPosition := self right - subMenuMarker width @ (self top + self bottom - subMenuMarker height // 2).
- aCanvas paintImage: subMenuMarker at: subMenuMarkerPosition ]!

Item was added:
+ ----- Method: MenuItemMorph>>drawSubMenuMarkerOn: (in category 'drawing') -----
+ drawSubMenuMarkerOn: aCanvas
+
+ self hasSubMenu ifTrue: [
+ | subMenuMarker subMenuMarkerPosition |
+ subMenuMarker := self subMenuMarker.
+ subMenuMarkerPosition := self right - subMenuMarker width @ (self top + self bottom - subMenuMarker height // 2).
+ aCanvas paintImage: subMenuMarker at: subMenuMarkerPosition ]!

Item was changed:
  ----- Method: MenuItemMorph>>initialize (in category 'initialization') -----
  initialize
  "initialize the state of the receiver"
  super initialize.
  ""
 
  contents := ''.
  hasFocus := false.
  isEnabled := true.
  subMenu := nil.
  isSelected := false.
  target := nil.
  selector := nil.
  arguments := nil.
+ font := self userInterfaceTheme font ifNil: [TextStyle defaultFont].
+ self
+ color: (self userInterfaceTheme textColor ifNil: [Color black]);
+ hResizing: #spaceFill;
+ vResizing: #shrinkWrap!
- font := Preferences standardMenuFont.
- self hResizing: #spaceFill;
- vResizing: #shrinkWrap!

Item was changed:
  ----- Method: MenuItemMorph>>minWidth (in category 'layout') -----
  minWidth
 
  | subMenuWidth iconWidth markerWidth |
  subMenuWidth := self hasSubMenu
  ifTrue: [ 10 ]
  ifFalse: [ 0 ].
  iconWidth := self hasIcon
  ifTrue: [ self icon width + 2 ]
  ifFalse: [ 0 ].
  markerWidth := self hasMarker
  ifTrue: [ self submorphBounds width + 8 ]
  ifFalse: [ 0 ].
  ^(self fontToUse widthOfString: contents)
+ + subMenuWidth + iconWidth + markerWidth + self stringMargin!
- + subMenuWidth + iconWidth + markerWidth!

Item was changed:
  ----- Method: MenuItemMorph>>selectionFillStyle (in category 'private') -----
  selectionFillStyle
+ " Answer the fill style to use with the receiver is the selected element "
- " Answer the fill style to use with the receiver is the selected  
- element "
 
+ | fill baseColor |
+ baseColor := self userInterfaceTheme selectionColor ifNil: [Color r: 0.4 g: 0.5 b: 0.7].
- | fill baseColor preferenced |
- Display depth <= 2 ifTrue: [
- ^Color gray ].
- preferenced := MenuMorph menuSelectionColor.
- preferenced notNil ifTrue: [ ^preferenced ].
- baseColor := owner color negated.
  MenuMorph gradientMenu ifFalse: [ ^baseColor ].
+
  fill := GradientFillStyle ramp: {
  0.0 -> baseColor twiceLighter.
  1 -> baseColor twiceDarker }.
  fill origin: self topLeft.
+ fill direction: 0 @ self height.
  ^ fill!

Item was added:
+ ----- Method: MenuItemMorph>>stringMargin (in category 'layout') -----
+ stringMargin
+
+ ^Preferences tinyDisplay
+ ifTrue: [ 1 ]
+ ifFalse: [ 6 ]!

Item was changed:
+ Morph subclass: #MenuMorph
- AlignmentMorph subclass: #MenuMorph
  instanceVariableNames: 'defaultTarget selectedItem stayUp popUpOwner activeSubMenu'
  classVariableNames: 'CloseBoxImage CloseBoxImageFlat CloseBoxImageGradient GradientMenu MenuBorderColor MenuBorderWidth MenuColor MenuLineColor MenuSelectionColor MenuTitleBorderColor MenuTitleBorderWidth MenuTitleColor PushPinImage RoundedMenuCorners'
  poolDictionaries: ''
  category: 'Morphic-Menus'!
 
  !MenuMorph commentStamp: '<historical>' prior: 0!
  Instance variables:
  defaultTarget <Object> The default target for creating menu items
  selectedItem <MenuItemMorph> The currently selected item in the receiver
  stayUp <Boolean> True if the receiver should stay up after clicks
  popUpOwner <MenuItemMorph> The menu item that automatically invoked the receiver, if any.
  activeSubMenu <MenuMorph> The currently active submenu.!

Item was removed:
- ----- Method: MenuMorph class>>menuBorderColor (in category 'preferences') -----
- menuBorderColor
-
- <preference: 'menuBorderColor'
- category: #menus
- description: 'Menus border color'
- type: #Color>
- Display depth <= 2 ifTrue: [^ Color black].
- ^MenuBorderColor ifNil: [(Color r: 0.2 g: 0.3 b: 0.9)]!

Item was removed:
- ----- Method: MenuMorph class>>menuBorderColor: (in category 'preferences') -----
- menuBorderColor: aColor
- MenuBorderColor := aColor!

Item was removed:
- ----- Method: MenuMorph class>>menuBorderWidth (in category 'preferences') -----
- menuBorderWidth
- <preference: 'menuBorderWidth'
- category: #menus
- description: 'Menus border width'
- type: #Number>
- ^MenuBorderWidth ifNil: [2]!

Item was removed:
- ----- Method: MenuMorph class>>menuBorderWidth: (in category 'preferences') -----
- menuBorderWidth: anInteger
- MenuBorderWidth := anInteger!

Item was removed:
- ----- Method: MenuMorph class>>menuColor (in category 'preferences') -----
- menuColor
- <preference: 'menuColor'
- category: #menus
- description: 'Menus color'
- type: #Color>
- Display depth <= 2 ifTrue: [^ Color black].
- ^MenuColor ifNil: [(Color r: 0.9 g: 0.9 b: 0.9)]!

Item was removed:
- ----- Method: MenuMorph class>>menuColor: (in category 'preferences') -----
- menuColor: aColor
- MenuColor := aColor!

Item was removed:
- ----- Method: MenuMorph class>>menuLineColor (in category 'preferences') -----
- menuLineColor
- <preference: 'menuLineColor'
- category: #menus
- description: 'Menus color of separating lines'
- type: #Color>
- ^MenuLineColor ifNil: [(Color r: 0.6 g: 0.7 b: 1)]!

Item was removed:
- ----- Method: MenuMorph class>>menuLineColor: (in category 'preferences') -----
- menuLineColor: aColor
- MenuLineColor := aColor!

Item was removed:
- ----- Method: MenuMorph class>>menuSelectionColor (in category 'preferences') -----
- menuSelectionColor
- <preference: 'menuSelectionColor'
- category: #menus
- description: 'Color of selected item in menu'
- type: #Color>
- Display depth <= 2 ifTrue: [^ Color black].
- ^MenuSelectionColor ifNil: [(Color r: 0.4 g: 0.5 b: 0.7)]!

Item was removed:
- ----- Method: MenuMorph class>>menuSelectionColor: (in category 'preferences') -----
- menuSelectionColor: aColor
- MenuSelectionColor := aColor!

Item was removed:
- ----- Method: MenuMorph class>>menuTitleBorderColor (in category 'preferences') -----
- menuTitleBorderColor
- <preference: 'menuTitleBorderColor'
- category: #menus
- description: 'Border color of frame around menu title'
- type: #Color>
- Display depth <= 2 ifTrue: [^ Color black].
- ^MenuTitleBorderColor ifNil: [(Color r: 0.6 g: 0.7 b: 1)]!

Item was removed:
- ----- Method: MenuMorph class>>menuTitleBorderColor: (in category 'preferences') -----
- menuTitleBorderColor: aColor
- MenuTitleBorderColor := aColor!

Item was removed:
- ----- Method: MenuMorph class>>menuTitleBorderWidth (in category 'preferences') -----
- menuTitleBorderWidth
- <preference: 'menuTitleBorderWidth'
- category: #menus
- description: 'Width of frame around menus title'
- type: #Number>
- ^MenuTitleBorderWidth ifNil: [0]!

Item was removed:
- ----- Method: MenuMorph class>>menuTitleBorderWidth: (in category 'preferences') -----
- menuTitleBorderWidth: anInteger
- MenuTitleBorderWidth := anInteger!

Item was removed:
- ----- Method: MenuMorph class>>menuTitleColor (in category 'preferences') -----
- menuTitleColor
- <preference: 'menuTitleColor'
- category: #menus
- description: 'Color of background of menus title'
- type: #Color>
- Display depth = 1 ifTrue: [^ Color white].
- Display depth = 2 ifTrue: [^ Color gray].
- ^MenuTitleColor ifNil: [ Color transparent]!

Item was removed:
- ----- Method: MenuMorph class>>menuTitleColor: (in category 'preferences') -----
- menuTitleColor: aColor
- MenuTitleColor := aColor!

Item was added:
+ ----- Method: MenuMorph class>>themeProperties (in category 'preferences') -----
+ themeProperties
+
+ ^ super themeProperties, {
+ { #borderColor. 'Colors'. 'Color of the menu''s border.' }.
+ { #borderWidth. 'Borders'. 'Width of the menu''s border.' }.
+ { #borderStyle. 'Borders'. 'Whether to use a plain border, inset, or outset.' }.
+ { #color. 'Colors'. 'Background color of the menu.' }.
+
+ { #titleBorderColor. 'Colors'. 'Color of the menu title border.' }.
+ { #titleBorderWidth. 'Geometry'. 'Width of the menu title border.' }.
+ { #titleBorderStyle. 'Borders'. 'Whether to use a plain border, inset, or outset for the title.' }.
+ { #titleColor. 'Colors'. 'Background color of the menu'' title.' }.
+ { #titleFont. 'Fonts'. 'Font for menu title.' }.
+ { #titleTextColor. 'Colors'. 'Color for the menu title label.' }.
+
+ { #lineColor. 'Colors'. 'Color of the separators between menu items.' }.
+ { #lineStyle. 'Colors'. 'Use border-style to change appearance.' }.
+ { #lineWidth. 'Geometry'. 'How big the separators should be.' }.
+ }!

Item was changed:
  ----- Method: MenuMorph>>addLine (in category 'construction') -----
  addLine
  "Append a divider line to this menu. Suppress duplicate lines."
+
+ | colorToUse |
+ self hasItems ifFalse: [^ self].
+ self lastSubmorph knownName = #line ifTrue: [^ self].
+
+ colorToUse := self userInterfaceTheme lineColor ifNil: [Color gray: 0.9].
+ self addMorphBack: (Morph new
+ color: colorToUse;
+ hResizing: #spaceFill;
+ height: (self userInterfaceTheme lineWidth ifNil: [2]);
+ borderStyle: (self userInterfaceTheme lineStyle ifNil: [BorderStyle inset]);
+ borderColor: colorToUse;
+ borderWidth: 1;
+ name: #line; "see above"
+ yourself).!
- self hasItems
- ifFalse: [^ self].
- (self lastSubmorph isKindOf: MenuLineMorph)
- ifFalse: [self addMorphBack: MenuLineMorph new] !

Item was changed:
  ----- Method: MenuMorph>>addStayUpIcons (in category 'construction') -----
  addStayUpIcons
+ | title closeBox pinBox |
- | title closeBox pinBox titleBarArea titleString |
  title := submorphs
  detect: [:ea | ea hasProperty: #titleString]
+ ifNone: [
+ "Called too soon. Will add stay-up icons when title is added."
+ self setProperty: #needsTitlebarWidgets toValue: true.
- ifNone: [self setProperty: #needsTitlebarWidgets toValue: true.
  ^ self].
  closeBox := SystemWindowButton new target: self;
  actionSelector: #delete;
  labelGraphic: self class closeBoxImage;
  color: Color transparent;
  extent: self class closeBoxImage extent;
  borderWidth: 0.
  pinBox := SystemWindowButton new target: self;
  actionSelector: #stayUp:;
  arguments: {true};
  labelGraphic: self class pushPinImage;
  color: Color transparent;
  extent: self class pushPinImage extent;
  borderWidth: 0.
+ Preferences noviceMode ifTrue: [
+ closeBox setBalloonText: 'close this menu'.
+ pinBox setBalloonText: 'keep this menu up'].
+
+ title
+ addMorphFront: closeBox;
+ addMorphBack: pinBox.
+
- Preferences noviceMode
- ifTrue: [closeBox setBalloonText: 'close this menu'.
- pinBox setBalloonText: 'keep this menu up'].
- titleBarArea :=  AlignmentMorph newRow vResizing: #shrinkWrap;
- layoutInset: 3;
- color: MenuMorph menuTitleColor;
- addMorphBack: closeBox;
- addMorphBack: title;
- addMorphBack: pinBox.
-
- title color: Color transparent.
-
- titleString := title
- findDeepSubmorphThat: [:each | each respondsTo: #font: ]
- ifAbsent: [StringMorph contents: String empty].
- titleString font: Preferences windowTitleFont.
- self wantsRoundedCorners
- ifTrue: [titleBarArea useRoundedCorners].
-
- self addMorphFront: titleBarArea.
- titleBarArea setProperty: #titleString toValue: (title valueOfProperty: #titleString).
- title removeProperty: #titleString.
  self setProperty: #hasTitlebarWidgets toValue: true.
  self removeProperty: #needsTitlebarWidgets.
  self removeStayUpItems!

Item was changed:
  ----- Method: MenuMorph>>addTitle:icon:updatingSelector:updateTarget: (in category 'construction') -----
  addTitle: aString icon: aForm updatingSelector: aSelector updateTarget: aTarget
+ "Add a title line at the top of this menu Make aString its initial contents. If aSelector is not nil, then periodically obtain fresh values for its contents by sending aSelector to aTarget."
+
+ | container fontToUse colorToUse labelArea |
+
+ container := AlignmentMorph newRow.
+ self setTitleParametersFor: container.
+
+ aForm ifNotNil: [:form | container addMorphBack: form asMorph].
- "Add a title line at the top of this menu Make aString its initial  
- contents.  
- If aSelector is not nil, then periodically obtain fresh values for  
- its  
- contents by sending aSelector to aTarget.."
- | title titleContainer |
- title := AlignmentMorph newColumn.
- self setTitleParametersFor: title.
- ""
- aForm isNil
- ifTrue: [titleContainer := title]
- ifFalse: [| pair |
- pair := AlignmentMorph newRow.
 
+ fontToUse := self userInterfaceTheme titleFont ifNil: [TextStyle defaultFont].
+ colorToUse := self userInterfaceTheme titleTextColor ifNil: [Color black].
+
+ "Build the label."
- pair color: Color transparent.
- pair hResizing: #shrinkWrap.
- pair layoutInset: 0.
- pair addMorphBack:  (Morph new extent: 5@5; color: Color transparent). "padding"
- pair addMorphBack: aForm asMorph.
- pair addMorphBack:  (Morph new extent: 5@5; color: Color transparent). "padding"
- titleContainer := AlignmentMorph newColumn.
- titleContainer color: Color transparent.
- titleContainer vResizing: #shrinkWrap.
- titleContainer wrapCentering: #center.
- titleContainer cellPositioning: #topCenter.
- titleContainer layoutInset: 0.
- pair addMorphBack: titleContainer.
- ""
- title addMorphBack: pair].
- ""
  aSelector
+ ifNil: [
+ labelArea := AlignmentMorph newColumn
+ color: Color transparent;
+ vResizing: #shrinkWrap;
+ wrapCentering: #center;
+ cellPositioning: #topCenter.
+ aString asString linesDo: [:line | labelArea
+ addMorphBack: ((StringMorph contents: line
+ font: fontToUse)
+ color: colorToUse;
- ifNil: [""
- aString asString
- linesDo: [:line | titleContainer
- addMorphBack: ((StringMorph
- contents: line
- font: Preferences standardMenuFont)
- color: (Color black);
  yourself)]]
+ ifNotNil: [
+ labelArea := UpdatingStringMorph on: aTarget selector: aSelector.
+ labelArea font: fontToUse.
+ labelArea color: colorToUse.
+ labelArea useStringFormat.
+ labelArea lock].
+
+ container addMorphBack: labelArea.
- ifNotNil: [| usm |
- usm := UpdatingStringMorph on: aTarget selector: aSelector.
- usm font: Preferences standardMenuFont.
- usm useStringFormat.
- usm lock.
- titleContainer addMorphBack: usm].
  ""
+ container setProperty: #titleString toValue: aString.
+ self addMorphFront: container.
- title setProperty: #titleString toValue: aString.
- self addMorphFront: title.
  ""
- title useSquareCorners.
  (self hasProperty: #needsTitlebarWidgets)
  ifTrue: [self addStayUpIcons]!

Item was added:
+ ----- Method: MenuMorph>>applyUserInterfaceTheme (in category 'update') -----
+ applyUserInterfaceTheme
+
+ | colorToUse |
+ super applyUserInterfaceTheme.
+
+ self setDefaultParameters.
+
+ "Update properties of separating lines."
+ colorToUse := self userInterfaceTheme lineColor ifNil: [Color gray: 0.9].
+ self submorphs
+ select: [:ea | ea knownName = #line]
+ thenDo: [:line |
+ line
+ color: colorToUse;
+ height: (self userInterfaceTheme lineWidth ifNil: [2]);
+ borderStyle: (self userInterfaceTheme lineStyle ifNil: [BorderStyle inset]);
+ borderColor: colorToUse].!

Item was changed:
  ----- Method: MenuMorph>>initialize (in category 'initialization') -----
  initialize
  super initialize.
 
  bounds := 0 @ 0 corner: 40 @ 10.
 
  self setDefaultParameters.
 
+ self changeTableLayout.
  self listDirection: #topToBottom.
  self hResizing: #shrinkWrap.
  self vResizing: #shrinkWrap.
  defaultTarget := nil.
  selectedItem := nil.
  stayUp := false.
  popUpOwner := nil.!

Item was changed:
  ----- Method: MenuMorph>>setDefaultParameters (in category 'initialization') -----
  setDefaultParameters
  "change the receiver's appareance parameters"
 
+ self
+ color: (self userInterfaceTheme color ifNil: [Color r: 0.9 g: 0.9 b: 0.9]);
+ borderStyle: (self userInterfaceTheme borderStyle ifNil: [BorderStyle default]);
+ borderColor: (self userInterfaceTheme borderColor ifNil: [Color gray]);
+ borderWidth: (self userInterfaceTheme borderWidth ifNil: [1]).
- | colorFromMenu worldColor menuColor |
-
- colorFromMenu := Preferences menuColorFromWorld
- and: [Display depth > 4
- and: [(worldColor := self currentWorld color) isColor]].
 
+ Preferences menuAppearance3d ifTrue: [self addDropShadow].
+
- menuColor := colorFromMenu
- ifTrue: [worldColor luminance > 0.7
- ifTrue: [worldColor mixed: 0.85 with: Color black]
- ifFalse: [worldColor mixed: 0.4 with: Color white]]
- ifFalse: [self class menuColor].
-
- self color: menuColor.
- self borderWidth: self class menuBorderWidth.
-
- Preferences menuAppearance3d ifTrue: [
- self borderStyle: BorderStyle thinGray.
- self hasDropShadow: true.
-
- self useSoftDropShadow
- ifFalse: [
- self
- shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666);
- shadowOffset: 1 @ 1]
- ifTrue: [
- self
- shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.01);
- shadowOffset: (10@8 corner: 10@12) ]
- ]
- ifFalse: [
- | menuBorderColor |
- menuBorderColor := colorFromMenu
- ifTrue: [worldColor muchDarker]
- ifFalse: [self class menuBorderColor].
- self borderColor: menuBorderColor.
- ].
-
-
  self layoutInset: 3.
  !

Item was added:
+ ----- Method: MenuMorph>>setTitleParameters (in category 'initialization') -----
+ setTitleParameters
+
+ self setTitleParametersFor: (self allMorphs
+ detect: [:each | each hasProperty: #titleString]
+ ifNone: [^ self]).!

Item was changed:
  ----- Method: MenuMorph>>setTitleParametersFor: (in category 'initialization') -----
  setTitleParametersFor: aMenuTitle
- | menuTitleColor menuTitleBorderColor |
- self wantsRoundedCorners
- ifTrue: [aMenuTitle useRoundedCorners].
 
- menuTitleColor := Preferences menuColorFromWorld
- ifTrue: [self color darker]
- ifFalse: [MenuMorph menuTitleColor].
-
- menuTitleBorderColor := Preferences menuAppearance3d
- ifTrue: [#inset]
- ifFalse: [Preferences menuColorFromWorld
- ifTrue: [self color darker muchDarker]
- ifFalse: [MenuMorph menuTitleBorderColor]].
-
  aMenuTitle
+ color: (self userInterfaceTheme titleColor ifNil: [Color transparent]);
+ borderStyle: (self userInterfaceTheme titleBorderStyle ifNil: [BorderStyle default]);
+ borderColor: (self userInterfaceTheme titleBorderColor ifNil: [Color r: 0.6 g: 0.7 b: 1]);
+ borderWidth: (self userInterfaceTheme titleBorderWidth ifNil: [0]);
+ cornerStyle: (self wantsRoundedCorners ifTrue: [#rounded] ifFalse: [#square]);
- setColor: menuTitleColor
- borderWidth: MenuMorph menuTitleBorderWidth
- borderColor: menuTitleBorderColor;
  vResizing: #shrinkWrap;
  wrapCentering: #center;
+ cellPositioning: #center;
+ cellInset: 5;
+ layoutInset: (5@0 corner: 5@0).!
- cellPositioning: #topCenter;
- layoutInset: 0.
- !

Item was changed:
  ----- Method: MenuMorph>>updateColor (in category 'control') -----
  updateColor
+ | fill title cc |
- | fill title |
  self class gradientMenu
  ifFalse: [^ self].
  (self fillStyle == self color) not
  ifTrue: [^ self]. "Don't apply the gradient more than once"
  ""
+ title := self allMorphs
+ detect: [:each | each hasProperty: #titleString]
+ ifNone: [].
+
+ cc := self color adjustSaturation: -0.08 brightness: 0.4.
+ fill := GradientFillStyle ramp: {
+ 0.0 -> (title ifNil: [cc] ifNotNil: [cc muchLighter]).
+ 0.25 -> (self color mixed: 0.5 with: cc).
+ 1.0 -> self color}.
- fill := GradientFillStyle ramp: {0.0 -> Color white. 1 -> self color}.
  ""
  fill
  radial: false;
  origin: self topLeft;
  direction: 0 @ self height.
  ""
- self fillStyle: fill.
  "
  update the title color"
+
+ title ifNotNil: [fill direction: 0@ title height].
+ self fillStyle: fill.
+ title ifNil: [^ self].
- title := self allMorphs
- detect: [:each | each hasProperty: #titleString]
- ifNone: [^ self].
  ""
+ fill := GradientFillStyle ramp: {
+ 0.0 -> title color twiceLighter.
+ 1 -> title color twiceDarker}.
- fill := GradientFillStyle ramp: {0.0 -> title color twiceLighter. 1 -> title color twiceDarker}.
  ""
  fill
  origin: title topLeft;
  direction: title width @ 0.
  ""
  title fillStyle: fill!

Item was added:
+ ----- Method: TheWorldMainDockingBar class>>applyUserInterfaceTheme (in category 'preferences') -----
+ applyUserInterfaceTheme
+
+ self updateInstances.!

Item was added:
+ ----- Method: TheWorldMainDockingBar class>>themeProperties (in category 'preferences') -----
+ themeProperties
+
+ ^ {
+ { #textColor. 'Colors'. 'The color for the clock and other labels.' }.
+ { #font. 'Fonts'. 'The font for the clock and other labels.' }.
+ { #logoColor. 'Colors'. 'The color of the Squeak logo.' }.
+ { #selectionLogoColor. 'Colors'. 'The color of the Squeak logo when it is selected.' }.
+ }!

Item was added:
+ ----- Method: TheWorldMainDockingBar>>applyUserInterfaceTheme (in category 'updating') -----
+ applyUserInterfaceTheme
+ "Do it on the class-side."!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>clockOn: (in category 'right side') -----
  clockOn: aDockingBar
  aDockingBar
  addMorphBack: (ClockMorph new
+ font: self fontToUse;
+ color: self colorToUse;
  show24hr: self class twentyFourHourClock;
  showSeconds: self class showSecondsInClock;
  yourself);
  addDefaultSpace!

Item was added:
+ ----- Method: TheWorldMainDockingBar>>colorToUse (in category 'private') -----
+ colorToUse
+
+ ^ self userInterfaceTheme textColor ifNil: [Color black]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>createDockingBar (in category 'construction') -----
  createDockingBar
  "Create a docking bar from the receiver's representation"
 
  | dockingBar |
  dockingBar := DockingBarMorph new
  adhereToTop;
  color: MenuMorph menuColor;
- gradientRamp: self gradientRamp;
  autoGradient: MenuMorph gradientMenu;
  borderWidth: 0.
  self fillDockingBar: dockingBar.
  self labelIfNeeded: dockingBar.
  ^ dockingBar!

Item was added:
+ ----- Method: TheWorldMainDockingBar>>fontToUse (in category 'private') -----
+ fontToUse
+
+ ^ self userInterfaceTheme font ifNil: [TextStyle defaultFont]!

Item was changed:
  ----- Method: TheWorldMainDockingBar>>squeakMenuOn: (in category 'construction') -----
  squeakMenuOn: aDockingBar
  "Private - fill the given docking bar"
 
  aDockingBar addItem: [ :item |
  item
  contents: '';
+ icon: (MenuIcons squeakLogoIconColorized:
+ (self userInterfaceTheme logoColor ifNil: [Color black]));
+ selectedIcon: (MenuIcons squeakLogoIconColorized:
+ (self userInterfaceTheme selectionLogoColor ifNil: [Color white]));
- icon: MenuIcons squeakLogoIcon;
- selectedIcon: MenuIcons squeakLogoInvertedIcon;
  addSubMenu: [ :menu |
  self
  aboutMenuItemOn: menu;
  updateMenuItemOn: menu.
  menu addLine.
  self
  saveMenuItemOn: menu;
  saveAsMenuItemOn: menu;
  saveAsNewVersionMenuItemOn: menu.
  menu addLine.
  self
  saveAndQuitMenuItemOn: menu;
  quitMenuItemOn: menu ] ]!

Item was added:
+ (PackageInfo named: 'Morphic') postscript: 'MenuIcons initializeIcons.
+ TheWorldMainDockingBar updateInstances.'!