The Inbox: Morphic-ct.2226.mcz

[email protected] Thu, 30 Jul 2026 22:48:34 0000
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <[email protected]>
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.2226.mcz

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

Name: Morphic-ct.2226
Author: ct
Time: 31 July 2026, 12:48:30.394399 am
UUID: 9fd6f716-4d1b-4948-9bf4-f0f99b53a01b
Ancestors: Morphic-ct.2223

Attempts to improve high-dpi support for menus. In particular, this fixes a bug in 75%-scale factor mode where opening a menu would directly open the first item if the user did not drag the cursor away before the releasing the mouse button (#positionAt:relativeTo:inWorld:). Fixes #removeStayUpBox to avoid blue hole in the title bar.

=============== Diff against Morphic-ct.2223 ===============

Item was changed:
  ----- Method: MenuItemMorph>>applyUserInterfaceTheme (in category 'updating') -----
  applyUserInterfaceTheme
  
  	super applyUserInterfaceTheme.
  	
  	self
  		color: (self userInterfaceTheme textColor ifNil: [Color black]);
  		font: (self userInterfaceTheme font ifNil: [TextStyle defaultFont]).
+ 	self icon ifNotNil: [self icon: self icon scaleIconToDisplay] "forth and back will be blurry, though".
+ 	self submorphs
+ 		detect: [:m | m isImageMorph]
+ 		ifFound: [:marker |
+ 			marker image: marker image scaleIconToDisplay.
+ 			marker position: self left @ (self top + 2 px)].!
- 	!

Item was changed:
  ----- Method: MenuItemMorph>>contents:withMarkers:inverse: (in category 'accessing') -----
  contents: aString withMarkers: aBool inverse: inverse 
  	"Set the menu item entry. If aBool is true, parse aString for embedded markers."
  
  	| markerIndex marker |
  	self contentString: nil.	"get rid of old"
  	aBool ifFalse: [^super contents: aString].
  	self removeAllMorphs.	"get rid of old markers if updating"
  	self hasIcon ifTrue: [ self icon: nil ].
  	(aString notEmpty and: [aString first = $<]) 
  		ifFalse: [^super contents: aString].
  	markerIndex := aString indexOf: $>.
  	markerIndex = 0 ifTrue: [^super contents: aString].
  	marker := (aString copyFrom: 1 to: markerIndex) asLowercase.
  	(#('<on>' '<off>' '<yes>' '<no>') includes: marker) 
  		ifFalse: [^super contents: aString].
  	self contentString: aString.	"remember actual string"
  	marker := (marker = '<on>' or: [marker = '<yes>']) ~= inverse 
  				ifTrue: [self onImage]
  				ifFalse: [self offImage].
  	super contents:  (aString copyFrom: markerIndex + 1 to: aString size).
  	"And set the marker"
  	marker := ImageMorph new image: marker scaleIconToDisplay.
+ 	marker position: self left @ (self top + 2 px).
- 	marker position: self left @ (self top + 2).
  	self addMorphFront: marker!

Item was changed:
  ----- Method: MenuMorph>>applyUserInterfaceTheme (in category 'update') -----
  applyUserInterfaceTheme
  
  	| colorToUse |
  	super applyUserInterfaceTheme.
  	
  	self setDefaultParameters.
  	
+ 	self submorphs
+ 		detect: [:ea | ea hasProperty: #titleString]
+ 		ifFound: [:title |
+ 			title firstSubmorph "closeBox" delete.
+ 			self removeStayUpBox; addStayUpIcons.
+ 			self stayUp ifTrue: [self removeStayUpBox].
+ 			
+ 			(title findDeeplyA: StringMorph) ifNotNil: [:label | | fontToUse |
+ 				fontToUse := self userInterfaceTheme titleFont ifNil: [TextStyle defaultFont].
+ 				colorToUse := self userInterfaceTheme titleTextColor ifNil: [Color black].
+ 				label font: fontToUse; color: colorToUse]].
+ 	
  	"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]) px;
- 				height: (self userInterfaceTheme lineWidth ifNil: [2]);
  				borderStyle: (self userInterfaceTheme lineStyle ifNil: [BorderStyle inset]) copy;
+ 				borderColor: colorToUse;
+ 				borderWidth: 1 px].!
- 				borderColor: colorToUse].!

Item was changed:
  ----- Method: MenuMorph>>positionAt:relativeTo:inWorld: (in category 'private') -----
  positionAt: aPoint relativeTo: aMenuItem inWorld: aWorld
  	"Note: items may not be laid out yet (I found them all to be at 0@0),  
  	so we have to add up heights of items above the selected item."
  
  	| i yOffset sub delta |	
  	self fullBounds. "force layout"
  	i := 0.
  	yOffset := 0.
  	[(sub := self submorphs at: (i := i + 1)) == aMenuItem]
  		whileFalse: [yOffset := yOffset + sub height].
  
+ 	self position: aPoint - (2 px @ (yOffset + 8 px)).
- 	self position: aPoint - (2 @ (yOffset + 8)).
  
  	"If it doesn't fit, show it to the left, not to the right of the hand."
  	self right > aWorld worldBounds right
  		ifTrue:
+ 			[self right: aPoint x + 1 px].
- 			[self right: aPoint x + 1].
  
  	"Make sure that the menu fits in the world."
  	delta := self bounds amountToTranslateWithin:
+ 		(aWorld worldBounds withHeight: ((aWorld worldBounds height - 18 px) max: (self currentHand position y) + 1 px)).
- 		(aWorld worldBounds withHeight: ((aWorld worldBounds height - 18) max: (self currentHand position y) + 1)).
  	delta isZero ifFalse: [self position: self position + delta].!

Item was changed:
  ----- Method: MenuMorph>>removeStayUpBox (in category 'menu') -----
  removeStayUpBox
  	| box |
  	submorphs isEmpty ifTrue: [^self].
  	(submorphs first isAlignmentMorph) ifFalse: [^self].
  	box := submorphs first submorphs last.
  	(box isKindOf: IconicButton) 
  		ifTrue: 
  			[box
+ 				lock;
+ 				labelGraphic: ((Form extent: box extent depth: 8) fillWithColor: Color transparent);
- 				labelGraphic: (Form extent: box extent depth: 8);
  				shedSelvedge;
+ 				borderWidth: 0]!
- 				borderWidth: 0;
- 				lock]!

Item was changed:
  ----- Method: MenuMorph>>setTitleParametersFor: (in category 'initialization') -----
  setTitleParametersFor: aMenuTitle 
  
  	aMenuTitle
  		color: (self userInterfaceTheme titleColor ifNil: [Color transparent]);
  		borderStyle: (self userInterfaceTheme titleBorderStyle ifNil: [BorderStyle simple]) copy;
  		borderColor: (self userInterfaceTheme titleBorderColor ifNil: [Color r: 0.6 g: 0.7 b: 1]);
+ 		borderWidth: (self userInterfaceTheme titleBorderWidth ifNil: [0]) px;
- 		borderWidth: (self userInterfaceTheme titleBorderWidth ifNil: [0]);
  		cornerStyle: (self wantsRoundedCorners ifTrue: [#rounded] ifFalse: [#square]);
  		vResizing: #shrinkWrap;
  		wrapCentering: #center;
  		cellPositioning: #center;
+ 		cellGap: 5 px;
+ 		layoutInset: (5 px @ 0 corner: 5 px @ 0).!
- 		cellGap: 5;
- 		layoutInset: (5@0 corner: 5@0).!

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