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

commits at source.squeak.org commits at source.squeak.org
Wed Feb 9 16:00:06 UTC 2022

Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:

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

Name: PreferenceBrowser-mt.131
Author: mt
Time: 9 February 2022, 5:00:05.357854 pm
UUID: aa0e8647-254e-9841-899e-4107582bea4c
Ancestors: PreferenceBrowser-mt.130

Fixes scaling issues in preference wizard.

Complements Morphic-mt.1879

=============== Diff against PreferenceBrowser-mt.130 ===============

Item was changed:
  ----- Method: PreferenceWizardMorph>>chooseScaleFactor: (in category 'actions - radio') -----
  chooseScaleFactor: inPercent
+ 	| 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].!
- 	Project current world
- 		noDisplayDuring: [self updateFromChangedScaleFactor].!

Item was changed:
  ----- Method: PreferenceWizardMorph>>updateFromChangedScaleFactor (in category 'display scale') -----
- 	previewWorld delete.
- 	previewWorld := nil.
  	DisplayScreen displayIsFullScreen ifFalse: [
  		DisplayScreen setNewScreenSize: (self defaultExtent * RealEstateAgent scaleFactor) rounded].
  	checkmark := nil.
  	radiomark := nil.
  		layoutInset: (self defaultFont widthOf: $x) * 2;
  		cellGap: (self defaultFont widthOf: $x).
  		font: (UserInterfaceTheme current get: #wizardTitleFont);
  		margins: (self cellGap @ 0 corner: self cellGap @ self cellGap).
  	titleMorph layoutFrame
  		bottomOffset: titleMorph height.
  	self updateLowPerformanceLabel: lowPerformanceMorph contents.
  	{startButton. skipButton. previousButton. nextButton. doneButton},
  		(pages gather: [:page | page allMorphs select: [:ea | ea isButton]])
  			do: [:button |
  				((button owner hasProperty: #isRadioButton)
  					or: [button owner hasProperty: #isCheckbox])
  						ifTrue: [
  								"layoutInset: 0;"
  								extent: (TextStyle defaultFont height * 1.75) asPoint;
  								update: button getLabelSelector.
  							button owner cellGap: (TextStyle defaultFont widthOf: $x).
  							button owner balloonText ifNotNil: [:text |
  								text addAttribute: (TextFontReference toFont: (UserInterfaceTheme current get: #wizardHelpFont))]]
  						ifFalse: [
  								layoutInset: self defaultButtonMargins].
  					borderWidth: (2 * RealEstateAgent scaleFactor) truncated;
  					font: (UserInterfaceTheme current get: #wizardButtonFont);
  					updateMinimumExtent "Font might not change but PPI did."].
  	self fullBounds.
  	(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].
  	(previousButton minimumWidth max: nextButton minimumWidth) in: [:w |
  		previousButton hResizing: #rigid; width: w.
  		nextButton hResizing: #rigid; width: w].
  		margins: (self layoutInset at 0 corner: self layoutInset at 0);
  		font: (UserInterfaceTheme current get: #wizardStandardFont).
  		cellGap: self cellGap;
  		layoutInset: (0 at self layoutInset corner: 0 at 0).
  	buttonRowMorph layoutFrame
  		topOffset: buttonRowMorph fullBounds height negated.
  	{controlMorph firstSubmorph}, (pages gather: [:page | page allMorphs select: [:ea | ea isTextMorph]])
  		do: [:label |
  				font: (UserInterfaceTheme current get: #wizardStandardFont);
  				margins: self defaultTextMargins
  			"No need for #releaseParagraph because window resizing will happen anyway."].
  	controlMorph layoutInset: (0 at 0 corner: self cellGap at 0).
  	controlMorph layoutFrame
  		topOffset: titleMorph height;
  		bottomOffset: buttonRowMorph height negated.
  	"scroll panes in pages"
  	pages do: [:page | | scrollPane |
  			layoutInset: (self layoutInset asPoint corner: self cellGap at 0);
  			cellGap: self cellGap.
  		scrollPane := page submorphs second.
  		scrollPane scrollBarThickness: self layoutInset.
  		scrollPane scroller firstSubmorph
  			cellGap: self cellGap;
  			layoutInset: (0 at 0 corner: self cellGap at 0).
  		(scrollPane vScrollBar instVarNamed: #slider)
  			borderWidth: (2 * RealEstateAgent scaleFactor) truncated].
+ 	previewWorld layoutFrame
+ 		topOffset: titleMorph height;
+ 		bottomOffset: buttonRowMorph height negated.
+ 	previewWorld borderWidth: (2 * RealEstateAgent scaleFactor) truncated.
- 	self initializePreviewWorld.
- 	self addMorph: previewWorld.
  	self bounds: self world bounds.
  	self updateWindowBounds.
  	self updatePageVisibility.!

More information about the Squeak-dev mailing list