[squeak-dev] The Trunk: Morphic-mt.1622.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Feb 14 14:54:53 UTC 2020
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1622.mcz
==================== Summary ====================
Name: Morphic-mt.1622
Author: mt
Time: 14 February 2020, 3:54:44.749667 pm
UUID: 20cac908-757f-be47-a081-1043be58a4ad
Ancestors: Morphic-mt.1621
Fixes more icon scaling bugs, which I discovered by testing Etoys (and the demo mode).
(Note that all those #scaleIconToDisplay sends can easily be located through the senders tool and later be corrected once we find better way of scaling things up for high-dpi displays. It is also a nice way of documenting those hard-coded values. ^__^)
=============== Diff against Morphic-mt.1621 ===============
Item was changed:
----- Method: DialogWindow>>createTitle: (in category 'initialization') -----
createTitle: aString
"Mimick behavior of MenuMorph title creation."
| box closeButton menuButton |
box := Morph new
name: #title;
changeTableLayout;
listDirection: #leftToRight;
yourself.
titleMorph := aString asText asMorph lock.
closeButton := SystemWindowButton new
color: Color transparent;
target: self;
extent: 12 at 12;
actionSelector: #cancelDialog;
balloonText: 'Cancel this dialog' translated;
borderWidth: 0;
- labelGraphic: SystemWindow closeBoxImage;
- extent: SystemWindow closeBoxImage extent;
visible: self class includeCloseButton;
yourself.
+ SystemWindow closeBoxImage scaleIconToDisplay in: [:icon |
+ closeButton labelGraphic: icon; extent: icon extent].
menuButton := SystemWindowButton new
color: Color transparent;
target: self;
actionSelector: #offerDialogMenu;
balloonText: 'Dialog menu' translated;
borderWidth: 0;
- labelGraphic: SystemWindow menuBoxImage;
- extent: SystemWindow menuBoxImage extent;
visible: self class includeControlMenu;
yourself.
+ SystemWindow menuBoxImage scaleIconToDisplay in: [:icon |
+ menuButton labelGraphic: icon; extent: icon extent].
box addAllMorphs: {closeButton. titleMorph. menuButton}.
self addMorphBack: box.
self setTitleParameters.!
Item was changed:
----- Method: MenuIcons class>>decorateMenu: (in category 'menu decoration') -----
decorateMenu: aMenu
"decorate aMenu with icons"
| maxWidth |
Preferences menuWithIcons ifFalse: [^ self].
Preferences tinyDisplay ifTrue:[^ self].
maxWidth := 0.
aMenu items do: [:item |
item icon isNil ifTrue: [
| icon |
icon := self iconForMenuItem: item.
icon isNil ifFalse: [
item icon: icon.
maxWidth := maxWidth max: item icon width.
]
]
ifFalse: [
maxWidth := maxWidth max: item icon width
].
item hasSubMenu ifTrue: [
self decorateMenu: item subMenu.
].
].
maxWidth isZero ifFalse: [
+ self flag: #hacky. "mt: That manual icon scaling is not optimal..."
+ aMenu addBlankIconsIfNecessary: (self blankIconOfWidth: (
+ "Avoid duplicate scaling because the actual menu icons are already scaled at this point."
+ RealEstateAgent scaleFactor > 1.0
+ ifTrue: [RealEstateAgent defaultIconExtent x]
+ ifFalse: [maxWidth]))].
- aMenu addBlankIconsIfNecessary: (self blankIconOfWidth: maxWidth).
- ].
!
Item was changed:
----- Method: MenuItemMorph>>icon: (in category 'accessing') -----
+ icon: aFormOrNil
+
+ icon := aFormOrNil
+ ifNotNil: [:form | form scaleIconToDisplay].
- icon: aForm
- "change the the receiver's icon"
- icon := aForm.
self height: self minHeight.
+ self width: self minWidth.!
- self width: self minWidth!
Item was changed:
----- Method: MenuMorph>>addStayUpIcons (in category 'construction') -----
addStayUpIcons
| title closeBox pinBox |
title := submorphs
detect: [:ea | ea hasProperty: #titleString]
ifNone: [
"Called too soon. Will add stay-up icons when title is added."
self setProperty: #needsTitlebarWidgets toValue: true.
^ self].
closeBox := SystemWindowButton new target: self;
actionSelector: #delete;
- labelGraphic: self class closeBoxImage;
color: Color transparent;
+ setBalloonText: 'close this menu' translated;
- extent: self class closeBoxImage extent;
borderWidth: 0.
+ self class closeBoxImage scaleIconToDisplay in: [:icon |
+ closeBox labelGraphic: icon; extent: icon extent].
pinBox := SystemWindowButton new target: self;
actionSelector: #stayUp:;
arguments: {true};
- labelGraphic: self class pushPinImage;
color: Color transparent;
+ setBalloonText: 'keep this menu up' translated;
- extent: self class pushPinImage extent;
borderWidth: 0.
+ self class pushPinImage scaleIconToDisplay in: [:icon |
+ pinBox labelGraphic: icon; extent: icon extent].
- Preferences noviceMode ifTrue: [
- closeBox setBalloonText: 'close this menu'.
- pinBox setBalloonText: 'keep this menu up'].
title
addMorphFront: closeBox;
addMorphBack: pinBox.
self setProperty: #hasTitlebarWidgets toValue: true.
self removeProperty: #needsTitlebarWidgets.
self removeStayUpItems!
Item was changed:
----- Method: TheWorldMainDockingBar>>colorIcon: (in category 'private') -----
colorIcon: aColor
"Guess if 'uniform window colors' are used and avoid all icons to be just gray"
(aColor = (UserInterfaceTheme current get: #uniformWindowColor for: Model) or: [Preferences tinyDisplay]) ifTrue: [ ^nil ].
+ ^(aColor iconOrThumbnailOfSize: (14 * RealEstateAgent scaleFactor) truncated)
- ^(aColor iconOrThumbnailOfSize: 14)
borderWidth: 3 color: ((UserInterfaceTheme current get: #color for: #MenuMorph) ifNil: [(Color r: 0.9 g: 0.9 b: 0.9)]) muchDarker;
borderWidth: 2 color: Color transparent!
More information about the Squeak-dev
mailing list
|