The Trunk: Tools-mt.1043.mcz

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

The Trunk: Tools-mt.1043.mcz

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

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

Name: Tools-mt.1043
Author: mt
Time: 25 April 2021, 8:28:55.388934 am
UUID: 9a01fd42-a193-4843-a890-68749b797e70
Ancestors: Tools-mt.1042

Complements Morphic-mt.1757 (and Kernel-mt.1391).

=============== Diff against Tools-mt.1042 ===============

Item was added:
+ ----- Method: ToolIcons class>>keyboardButtonLabeled: (in category 'buttons') -----
+ keyboardButtonLabeled: stringOrForm
+
+ ^ self keyboardButtonLabeled: stringOrForm dyed: Color black!

Item was added:
+ ----- Method: ToolIcons class>>keyboardButtonLabeled:dyed: (in category 'buttons') -----
+ keyboardButtonLabeled: anObject dyed: aColor
+
+ | id form c width height elevation thickness font margins color label |
+ thickness := RealEstateAgent scaleFactor rounded.
+
+ anObject isForm
+ ifTrue: [label := anObject]
+ ifFalse: [
+ label := anObject asString.
+ id := (#button, label, thickness) asSymbol.
+ self icons at: id ifPresent: [:icon |
+ ^ aColor ~= Color black
+ ifTrue: [icon dyed: aColor]
+ ifFalse: [icon]]].
+
+ elevation := (thickness * 2.5) rounded.
+ font := Preferences standardButtonFont.
+ color := Color black.
+
+ margins := (font widthOf: $x) @ (font height // 2).
+ width := label isForm ifTrue: [label width] ifFalse: [font widthOfString: label].
+ height := label isForm ifTrue: [label height] ifFalse: [font height].
+
+ form := Form
+ extent: (width + (2* margins x)) @ (height + (2* margins y) + elevation)
+ depth: 32.
+
+ c := form getCanvas.
+ c
+ frameRoundRect: (0@0 extent: form extent - (0@elevation))
+ radius: thickness * 5
+ width: thickness
+ color: Color black.
+
+ elevation > 0 ifTrue: [
+ c
+ clipBy: (0@ (form height // 2) corner: form width @ form height)
+ during: [:c2 |
+ c2
+ frameRoundRect: (0@ elevation extent: form extent - (0@elevation))
+ radius: thickness * 5
+ width: thickness
+ color: Color black]].
+
+ label isForm
+ ifTrue: [ c paintImage: label at: margins x @ (margins y)]
+ ifFalse: [
+ c
+ drawString: label
+ at: margins x @ (margins y)
+ font: font
+ color: color].
+
+ id ifNotNil: [self icons at: id put: form].
+
+ ^ aColor ~= Color black
+ ifTrue: [form dyed: aColor]
+ ifFalse: [form]!