The Inbox: Morphic-ct.1681.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-ct.1681.mcz

commits-2
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1681.mcz

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

Name: Morphic-ct.1681
Author: ct
Time: 8 September 2020, 1:48:12.211798 pm
UUID: 9e91205a-93e1-c143-ae8f-4aa3428bf197
Ancestors: Morphic-mt.1679

Fixes use of custom attributes in DialogWindows

Things like the following did NOT work properly before this patch:

        self inform: 'normal ' asText
                , ('red ' asText addAttribute: TextColor red; yourself)
                , ('font ' asText addAttribute: (TextFontReference toFont: ((TextStyle named: 'BitstreamVeraSansMono') fontOfSize: 20)); yourself)
                , ('url ' asText addAttribute: TextURL new; yourself)

This was because DialogWindow added its own styling attributes on top of all existing attributes. For color, this is not necessary because #textColor: is sufficient. For font size, in theory, TextFontChange should be sufficient, but currently it does not support relative changes to the font size.

=============== Diff against Morphic-mt.1679 ===============

Item was changed:
  ----- Method: DialogWindow>>setMessageParameters (in category 'initialization') -----
  setMessageParameters
+
+ messageMorph ifNil: [^ self].
 
+ messageMorph
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap.
+
+ self userInterfaceTheme textColor ifNotNil: [:color |
+ messageMorph textColor: color].
+ self userInterfaceTheme font ifNotNil: [:font |
+ self flag: #todo. "ct: Develop a relative text font change attribute. At the moment, all prior font sizes will be overwritten."
+ messageMorph contents addAttribute: (
+ TextFontChange fontNumber: (font textStyle fontIndexOf: font))].!
- messageMorph ifNotNil: [
- | fontToUse colorToUse |
- fontToUse := self userInterfaceTheme font ifNil: [TextStyle defaultFont].
- colorToUse := self userInterfaceTheme textColor ifNil: [Color black].
-
- messageMorph
- hResizing: #shrinkWrap;
- vResizing: #shrinkWrap.
-
- messageMorph contents
- addAttribute: (TextFontReference toFont: fontToUse);
- addAttribute: (TextColor color: colorToUse).
- messageMorph textColor: colorToUse].!