The Trunk: Tools-mt.1373.mcz

[email protected] Tue, 4 Aug 2026 14:06:30 0000
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <[email protected]>
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1373.mcz

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

Name: Tools-mt.1373
Author: mt
Time: 4 August 2026, 4:06:29.909405 pm
UUID: a183693a-6ca9-8c40-a724-33c7aba6d1ef
Ancestors: Tools-mt.1372

Fix dying of button labels for KeyboardExerciser to make it readable in darker UI themes. 

Note that string-drawing primitives will use true black for "Color black" (00-00-00) and not the 00-00-01 pattern.

=============== Diff against Tools-mt.1372 ===============

Item was changed:
  ----- 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].
  	
+ 	"Fix true black to use #000001 so that #colorFromPixelValue:depth: can work."
+ 	form bits: (form bits collect: [:ea | 
+ 		(ea bitAnd: 16r00FFFFFF) = 0
+ 			ifTrue: [(ea bitAnd: 16rFF000000) + 1]
+ 			ifFalse: [ea]]).
+ 	
  	id ifNotNil: [self icons at: id put: form].
  	
  	^ aColor ~= Color black
  		ifTrue: [form dyed: aColor]
  		ifFalse: [form]!

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]