Christoph Thiede uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ct.998.mcz
==================== Summary ====================
Name: Collections-ct.998
Author: ct
Time: 28 March 2022, 1:56:52.242267 pm
UUID: 74080f41-16ed-dc43-8f7c-1cd16bc91db7
Ancestors: Collections-ct.997
Adds literal arrays and scaled decimals to the smalltalk postcard. Removes obsolete line breaks from the comment.
=============== Diff against Collections-ct.997 ===============
Item was changed:
----- Method: Text class>>codeSample (in category 'filler text') -----
codeSample
^ 'exampleWithNumber: x
+ "A method that illustrates every part of Smalltalk method syntax including primitives. It has unary, binary, and keyboard messages; declares arguments and temporaries; accesses a global variable (but not an instance variable); uses literals (array, nested array, character, symbol, string, integer, float, scaled decimal, and byte array); uses the pseudo variables nil, true, false, self, super, and thisContext; shows that within a literal array nil, true, and false are symbols not pseudo variables; and has sequence, assignment, return, cascade, and tuple (array) creation. It has both zero argument and one argument blocks, and has a block temporary."
- "A method that illustrates every part of Smalltalk method syntax
- including primitives. It has unary, binary, and keyboard messages,
- declares arguments and temporaries, accesses a global variable
- (but not an instance variable), uses literals (array, character, symbol,
- string, integer, float, byte array), uses the pseudo variables nil, true,
- false, self, super, and thisContext, shows that within a literal array
- nil, true and false are symbols not pseudo variables, and has sequence,
- assignment, return, cascade, and tuple (array) creation. It has both
- zero argument and one argument blocks, and has a block temporary."
<primitive: ''primitiveCopyBits'' module: #BitBltPlugin error: ec>
| y |
true & false not & (nil isNil) ifFalse: [self halt].
y := self size + super size.
+ #($a #a ''a'' "a" (1 1.0 1.0s2) nil true false), { #[65]. thisContext. nil. true. false }
- #($a #a ''a'' "a" 1 1.0 nil true false), { #[65]. thisContext. nil. true. false }
do: [ :each | | class |
class := each class.
Transcript
show: (class name);
show: '' ''].
^ x < y'!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1947.mcz
==================== Summary ====================
Name: Morphic-mt.1947
Author: mt
Time: 28 March 2022, 11:05:29.42409 am
UUID: 3d8c8c8f-c37b-e843-bd78-4fe4a1ab32e5
Ancestors: Morphic-ct.1946
Complements System-mt.1331.
=============== Diff against Morphic-ct.1946 ===============
Item was changed:
----- Method: BorderedMorph>>displayScaleChangedBy: (in category 'display scale') -----
displayScaleChangedBy: factor
"The system's scale factor has changed. Try to scale the receiver so that it looks nice on the display. See DisplayScreen >> #uiScaleFactor:."
self paneMorphs
select: [:ea | ea respondsTo: #displayScaleChangedBy:]
thenDo: [:ea | ea displayScaleChangedBy: factor].
+ self bounds: ((self topLeft * factor) rounded extent: (self extent * factor) rounded).
- "Scale my bounds. Is okay even if I am layouted in my owner. Keep the center. If you also change the world bounds, make sure to move the receiver after this."
- self bounds: ((self extent * factor) rounded center: self center).
self removeGrips; removePaneSplitters.
self cellGap: 0.
self paneMorphs do: [:ea | ea layoutFrame ifNotNil: [:frame |
frame topOffset: (frame topOffset * factor) rounded.
frame bottomOffset: (frame bottomOffset * factor) rounded.
frame leftOffset: (frame leftOffset * factor) rounded.
frame rightOffset: (frame rightOffset * factor) rounded]].
self wantsGrips ifTrue: [self addGrips].
self wantsPaneSplitters ifTrue: [self addPaneSplitters].!
Item was changed:
----- Method: MorphicProject>>displayScaleChangedFrom:to: (in category 'display') -----
displayScaleChangedFrom: oldFactor to: newFactor
"Update Morphic-specific geometry. Try to be more efficient than UI theme's #applyUserInterfaceTheme."
super displayScaleChangedFrom: oldFactor to: newFactor.
"Switching UI themes involves updating geometry for different fonts anyway. Maybe we can speed up this at some point by avoiding to refresh non-geometry properties such as colors."
UserInterfaceTheme current
basicApply;
+ scaleMorphicWorldBy: newFactor / oldFactor;
scaleMorphicToolsBy: newFactor / oldFactor.
!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1331.mcz
==================== Summary ====================
Name: System-mt.1331
Author: mt
Time: 28 March 2022, 11:03:20.99909 am
UUID: ad69b8ce-b5e7-4343-a205-89bf6a262623
Ancestors: System-mt.1330
When changing the #uiScaleFactor, resize the window/world if not already done by the platform.
=============== Diff against System-mt.1330 ===============
Item was changed:
----- Method: UserInterfaceTheme>>fixFontsAndScaleAround: (in category 'private - fonts') -----
fixFontsAndScaleAround: applyThemeBlock
"Given that the receiver is the current UI theme, set the system's default fonts, which define RealEstateAgent's #scaleFactor. If the factor changes, resize open windows to make them fit the scaled contents. Note that themes can have arbitrary point sizes for their system font, even though it is not recommended. See TTCFont class >> #referencePointSize."
lastScaleFactor ifNil: [lastScaleFactor := RealEstateAgent scaleFactor].
"Due to the current font situation, update TextConstants."
(self get: #standardSystemFont) ifNotNil: [:font | self installSystemFont: font].
(self get: #standardFixedFont) ifNotNil: [:font | self installFixedFont: font].
"Propagate the receiver's properties across the system."
applyThemeBlock value.
"Due to the current real-estate manager situation, resize all windows. Works only for Morphic projects."
+ self scaleMorphicWorldBy: RealEstateAgent scaleFactor / lastScaleFactor.
self scaleMorphicToolsBy: RealEstateAgent scaleFactor / lastScaleFactor.
lastScaleFactor := nil.!
Item was added:
+ ----- Method: UserInterfaceTheme>>scaleMorphicWorldBy: (in category 'private - fonts') -----
+ scaleMorphicWorldBy: factor
+
+ (factor closeTo: 1) ifTrue: [^ self].
+
+ self flag: #todo. "mt: Once the UserInterfaceTheme does not fake any scale factors anymore and we are all-in with #isTTCBased, the following code can be moved to Project >> #displayScaleChangedFrom:to:. Note that we can stop faking when a low-resolution TTCFont starts looking okay but for now, we rely on pre-rendered StrikeFont."
+
+ (DisplayScreen displayIsFullScreen not
+ and: [Display extent = DisplayScreen actualScreenSize])
+ ifTrue: [ "The platform has not (yet?) adapted the window size but maybe the #platformScaleFactor. So we have to change the window size now to account for re-scaled tools. Note that projects should do #checkForNewScreenScaleFactor *before* #checkForNewScreenSize."
+ DisplayScreen setNewScreenSize: (Display extent * factor) rounded].!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.505.mcz
==================== Summary ====================
Name: Graphics-mt.505
Author: mt
Time: 28 March 2022, 11:01:24.78109 am
UUID: 21fb6966-c70d-344e-9435-0a46778a197b
Ancestors: Graphics-mt.504
Tweaks the commentary around #uiScaleFactor.
=============== Diff against Graphics-mt.504 ===============
Item was changed:
----- Method: DisplayScreen>>uiScaleFactor (in category 'scale factor') -----
uiScaleFactor
+ "Answers the current scale factor used to configure all widgets, tools, or windows to be prepared for the current rendering system, i.e., BitBlt. Note that 1.0 is usually the design space for pixel-based metrics such as #borderWidth or #layoutInset (if not based on font metrics)."
- "Answers the current scale factor used to configure all widgets, tools, or windows to be prepared for the current rendering system, i.e., BitBlt. Note that 1.0 means 'pixel perfect'."
^ UserInterfaceTheme current isTTCBased
ifTrue: [TextStyle pixelsPerInch / 96.0 "Hide rounding errors in TTCFont >> #height."]
ifFalse: [RealEstateAgent scaleFactor roundTo: 0.25 "Force 25% steps. See, e.g., #doScale150."].!
Item was changed:
----- Method: DisplayScreen>>uiScaleFactor: (in category 'scale factor') -----
uiScaleFactor: aFloat
+ "Sets the effective scale factor for the user interface, i.e., all widgets, tools, and windows. Note that the user can override the #platformScaleFactor, which is just a hint recommended by the platform."
- "Sets the effective scale factor for the user interface, i.e., all widgets, tools, and windows. The user can override the CurrentScaleFactor recommended by the platform."
+ | oldPixelFactor newPixelFactor newScaleFactor |
+ newScaleFactor := aFloat max: 0.75.
+
+ (UserInterfaceTheme current canFakeScaleFactor: newScaleFactor) ifTrue: [
- | oldFactor newFactor |
- (UserInterfaceTheme current canFakeScaleFactor: aFloat) ifTrue: [
self flag: #isTTCBased.
+ ^ UserInterfaceTheme current applyScaled: newScaleFactor].
+
+ newScaleFactor = 0.75 ifTrue: [(Project uiManager
+ confirm: ('You are currently using <b>TrueType fonts</b>. Your requested scale factor of <b>{1}%</b> looks better using pre-rendered <b>pixel fonts</b>.<br><br>Do you want to switch to pixel fonts now?' translated format: {(newScaleFactor * 100) rounded}) asTextFromHtml
- ^ UserInterfaceTheme current applyScaled: aFloat].
-
- aFloat = 0.75 ifTrue: [(Project uiManager
- confirm: ('You are currently using <b>TrueType fonts</b>. Your requested scale factor of <b>{1}%</b> looks better using pre-rendered <b>pixel fonts</b>.<br><br>Do you want to switch to pixel fonts now?' translated format: {(aFloat * 100) rounded}) asTextFromHtml
title: 'Blurry Fonts Detected' translated) == true
+ ifTrue: [UserInterfaceTheme cleanUpAndReset. ^ self uiScaleFactor: newScaleFactor]].
- ifTrue: [UserInterfaceTheme cleanUpAndReset. ^ self uiScaleFactor: aFloat]].
+ "Do nothing if the factor is unchanged. For comparison, use actual pixel-based scale factor to account for rounding errors, instead of #uiScaleFactor."
+ oldPixelFactor := RealEstateAgent scaleFactor.
+ newScaleFactor = oldPixelFactor ifTrue: [^ self].
+
+ "Update system's PPI to then compute the new pixel-based scale factor."
+ TextStyle pixelsPerInch: 96.0 * newScaleFactor.
+ newPixelFactor := RealEstateAgent resetScaleFactor; scaleFactor.
- oldFactor := RealEstateAgent scaleFactor. "Use effective, pixel-based factor to account for rounding errors. See #isTTCBased and #uiScaleFactor."
- newFactor := aFloat max: 0.75.
- newFactor = oldFactor ifTrue: [^ self].
+ "Let the current project (kind) decide how to update the system."
+ Project current ifNotNil: [:p | p displayScaleChangedFrom: oldPixelFactor to: newPixelFactor].!
- TextStyle pixelsPerInch: 96.0 * aFloat.
- newFactor := RealEstateAgent resetScaleFactor; scaleFactor. "Again, account for rounding errors."
- Project current ifNotNil: [:p | p displayScaleChangedFrom: oldFactor to: newFactor].!