[squeak-dev] The Trunk: Morphic-mt.2019.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jul 13 07:10:17 UTC 2022


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

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

Name: Morphic-mt.2019
Author: mt
Time: 13 July 2022, 9:10:12.591574 am
UUID: 6c59894c-0bc0-9041-9cb7-1da53808cc1b
Ancestors: Morphic-mt.2018

Use an actual menu for "Choose display depth" bc. there is no support for "<on>" and "<off>" in regular lists. It's a menu thing.

See http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-July/221430.html

=============== Diff against Morphic-mt.2018 ===============

Item was changed:
  ----- Method: TheWorldMenu>>setDisplayDepth (in category 'commands') -----
  setDisplayDepth
  	"Let the user choose a new depth for the display. "
  
+ 	| menu effect oldDepth allDepths allLabels hasBoth |
- 	| result oldDepth allDepths allLabels hasBoth |
  	oldDepth := Display nativeDepth.
  	allDepths := #(1 -1 2 -2 4 -4 8 -8 16 -16 32 -32) select: [:d | Display supportsDisplayDepth: d].
  	hasBoth := (allDepths anySatisfy:[:d| d > 0]) and:[allDepths anySatisfy:[:d| d < 0]].
  	allLabels := allDepths collect:[:d|
  		String streamContents:[:s|
  			s nextPutAll: (d = oldDepth ifTrue:['<on>'] ifFalse:['<off>']).
  			s print: d abs.
  			hasBoth ifTrue:[s nextPutAll: (d > 0 ifTrue:['  (big endian)'] ifFalse:['  (little endian)'])].
  		]].
+ 	effect := [:choice | | newDepth |
+ 		newDepth := allDepths at: choice.
+ 		Display newDepth: newDepth].
+ 		oldDepth := oldDepth abs.
+ 		(Smalltalk isMorphic and: [(Display depth < 4) ~= (oldDepth < 4)])
+ 			ifTrue:
+ 				["Repaint windows since they look better all white in depth < 4"
+ 				(SystemWindow windowsIn: myWorld satisfying: [:w | true]) do:
+ 					[:w |
+ 					oldDepth < 4
+ 						ifTrue: [w restoreDefaultPaneColor]
+ 						ifFalse: [w updatePaneColors]]].
+ 	menu := MenuMorph new
+ 		title: 'Choose a display depth' translated;
+ 		target: effect;
+ 		yourself.
+ 	allLabels withIndexDo: [:label :index |
+ 		menu add: label action: #value:.
+ 		menu lastItem arguments: {index}].
+ 	menu
+ 		invokeAt: self currentHand position
+ 		in: self currentWorld
+ 		allowKeyboard: true.!
- 	result := UIManager default
- 		chooseFrom: allLabels 
- 		values: allDepths 
- 		title: 'Choose a display depth' translated.
- 	result ifNotNil: [Display newDepth: result].
- 	oldDepth := oldDepth abs.
- 	(Smalltalk isMorphic and: [(Display depth < 4) ~= (oldDepth < 4)])
- 		ifTrue:
- 			["Repaint windows since they look better all white in depth < 4"
- 			(SystemWindow windowsIn: myWorld satisfying: [:w | true]) do:
- 				[:w |
- 				oldDepth < 4
- 					ifTrue: [w restoreDefaultPaneColor]
- 					ifFalse: [w updatePaneColors]]]!



More information about the Squeak-dev mailing list