[squeak-dev] The Trunk: PreferenceBrowser-mt.145.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Apr 7 12:23:01 UTC 2022


Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
http://source.squeak.org/trunk/PreferenceBrowser-mt.145.mcz

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

Name: PreferenceBrowser-mt.145
Author: mt
Time: 7 April 2022, 2:23:00.822346 pm
UUID: f368891d-aab1-1e42-8478-eb156de16965
Ancestors: PreferenceBrowser-mt.144

Fixes display-scale changes in preference wizard.
Adds [CMD]+[+/-] shortcut to directly modify the scale factor like the user can do when the keyboard focus is in the world (i.e., desktop background).

Note that there is still further code clean-up needed. Sorry.

Complements Morphic-mt.1965.

=============== Diff against PreferenceBrowser-mt.144 ===============

Item was changed:
  ----- Method: PreferenceWizardMorph>>chooseScaleFactor: (in category 'actions - radio') -----
  chooseScaleFactor: inPercent
  
+ 	Display relativeUiScaleFactor: inPercent / 100.!
- 	| prior factor |
- 	prior := RealEstateAgent scaleFactor.
- 	Display relativeUiScaleFactor: inPercent / 100.
- 	factor := RealEstateAgent scaleFactor / prior.
- 	
- 	self changedRadio.
- 	
- 	Project current world noDisplayDuring: [
- 		previewWorld submorphsDo: [:ea |
- 			ea isSystemWindow ifTrue: [ea displayScaleChangedBy: factor]].
- 		self world submorphsDo: [:ea |
- 			"We also try to change the host window size, so let's make the actual windows look centered."
- 			ea isSystemWindow ifTrue: [ea center: (ea center * factor) rounded]].
- 		self updateFromChangedScaleFactor].!

Item was added:
+ ----- Method: PreferenceWizardMorph>>displayScaleChangedBy: (in category 'display scale') -----
+ displayScaleChangedBy: factor
+ 
+ 	isFullScreen == true ifTrue: [
+ 		self changedRadio.
+ 		previewWorld submorphsDo: [:ea |
+ 			ea isSystemWindow ifTrue: [ea displayScaleChangedBy: factor]].
+ 		self updateFromChangedScaleFactor.
+ 		^ self].
+ 	
+ 	self
+ 		layoutInset: (self defaultFont widthOf: $x) * 2;
+ 		cellGap: (self defaultFont widthOf: $x).
+ 		
+ 	titleMorph
+ 		font: (UserInterfaceTheme current get: #wizardTitleFont);
+ 		margins: (self cellGap @ 0 corner: self cellGap @ self cellGap).
+ 		
+ 	self height: titleMorph height * 4.
+ 	
+ 	self updateLowPerformanceLabel: lowPerformanceMorph contents.
+ 	
+ 	{ startButton . skipButton } do: [:button |
+ 		button
+ 			layoutInset: self defaultButtonMargins;
+ 			borderWidth: (2 * RealEstateAgent scaleFactor) truncated;
+ 			font: (UserInterfaceTheme current get: #wizardButtonFont);
+ 			updateMinimumExtent "Font might not change but PPI did."].
+ 		
+ 	(startButton minimumWidth max: skipButton minimumWidth) in: [:w |
+ 		startButton hResizing: #rigid; width: w.
+ 		skipButton hResizing: #rigid; width: w.
+ 		startButton layoutFrame leftOffset: 2*w negated.
+ 		skipButton layoutFrame rightOffset: 2*w].
+ 	
+ 	self width: self world width.
+ 	self center: self world center.!

Item was changed:
  ----- Method: PreferenceWizardMorph>>filterEvent:for: (in category 'event handling') -----
  filterEvent: aKeyboardEvent for: aMorph
  
  	aKeyboardEvent isKeystroke ifTrue: [
  		aKeyboardEvent keyCharacter = Character escape
  			ifTrue: [self showSqueak. ^ aKeyboardEvent ignore].
  		(aKeyboardEvent keyCharacter = Character cr and: [self isInWelcome])
  			ifTrue: [self showPlayfield. ^ aKeyboardEvent ignore].
+ 			
+ 		aKeyboardEvent commandKeyPressed ifTrue: [
+ 			aKeyboardEvent keyCharacter = $+
+ 				ifTrue: [Preferences increaseFontSize. ^ aKeyboardEvent ignore].
+ 			aKeyboardEvent keyCharacter = $-
+ 				ifTrue: [Preferences decreaseFontSize. ^ aKeyboardEvent ignore]].
  		].
  
  	^ aKeyboardEvent!

Item was added:
+ ----- Method: PreferenceWizardMorph>>handlesDisplayScaleChangedBy: (in category 'display scale') -----
+ handlesDisplayScaleChangedBy: factor
+ 	
+ 	^ true!

Item was changed:
  ----- Method: PreferenceWizardMorph>>initializeWelcome (in category 'initialization') -----
  initializeWelcome
  
  	titleMorph := ('Welcome to Squeak' translated asText
  		addAttribute: (TextColor color: self defaultTextColor);
  		addAttribute: (TextFontReference toFont: (UserInterfaceTheme current get: #wizardTitleFont));
  		yourself) asMorph lock.
  	titleMorph margins: (self cellGap @ 0 corner: self cellGap @ self cellGap).
+ 	titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0)).
- 	titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0@ 0 corner: 0 @ titleMorph height)).
  
  	startButton := (self createButton action: #showPlayfield; label: 'Configure' translated).
  	skipButton := (self createButton action: #showSqueak; label: 'Skip' translated).
  	
  	(startButton width max: skipButton width) in: [:w |
  		startButton hResizing: #rigid; width: w.
  		skipButton hResizing: #rigid; width: w.
  		
  		startButton layoutFrame: (LayoutFrame fractions: (0.5 @ 0.6 corner: 0.5 @ 0.6) offsets: (2*w negated @ 0 corner: 0 @ 0)).
  		skipButton layoutFrame: (LayoutFrame fractions: (0.5 @ 0.6 corner: 0.5 @ 0.6) offsets: (0@ 0 corner: 2*w @ 0))].
  	
  	lowPerformanceMorph := TextMorph new lock.
  	
  	self addAllMorphs: {titleMorph. startButton. skipButton. lowPerformanceMorph}.!

Item was changed:
  ----- Method: PreferenceWizardMorph>>updateLowPerformanceLabel: (in category 'layout') -----
  updateLowPerformanceLabel: string
  
+ 	lowPerformanceMorph
+ 		contentsAsIs: string asText;
+ 		textColor: (Color gray: 0.7);
+ 		font: (UserInterfaceTheme current get: #wizardHelpFont).
+ 	
+ 	lowPerformanceMorph fullBounds.
- 	lowPerformanceMorph contentsAsIs: (string asText
- 		addAttribute: (TextColor color: (Color gray: 0.7));
- 		addAttribute: (TextFontReference toFont: (UserInterfaceTheme current get: #wizardHelpFont))).
  		
+ 	lowPerformanceMorph layoutFrame: (LayoutFrame
+ 		fractions: (1 @ 1 corner: 1 @ 1)
+ 		offsets: (lowPerformanceMorph extent negated corner: self layoutInset asPoint "Into margins")).
- 	lowPerformanceMorph layoutFrame: (LayoutFrame fractions: (1 @ 1 corner: 1 @ 1) offsets: (lowPerformanceMorph fullBounds width negated @ lowPerformanceMorph fullBounds height negated corner: self layoutInset @ self layoutInset "Into margins")).
  	
  	self layoutChanged.!



More information about the Squeak-dev mailing list