[squeak-dev] The Trunk: Morphic-mt.2024.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Aug 15 10:47:04 UTC 2022
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.2024.mcz
==================== Summary ====================
Name: Morphic-mt.2024
Author: mt
Time: 15 August 2022, 12:46:58.334306 pm
UUID: 2fd9a707-6be5-514a-8003-d9575eb99687
Ancestors: Morphic-mt.2023
Fixes minimal width of TextMorph. Adds more commentary to the relevant methods.
Thanks to Stef (spfa) for pointing this out!
I will backport this to Squeak 6.0.
=============== Diff against Morphic-mt.2023 ===============
Item was changed:
----- Method: TextMorph>>createParagraph (in category 'private') -----
createParagraph
self setProperty: #CreatingParagraph toValue: true.
[
self setDefaultContentsIfNil.
"...Code here to recreate the paragraph..."
paragraph := (self paragraphClass new textOwner: self owner).
paragraph wantsColumnBreaks: successor notNil.
paragraph
compose: text
style: textStyle
from: self startingIndex
in: self container.
wrapFlag ifFalse:
["Was given huge container at first... now adjust"
+ paragraph adjustRightX].
- paragraph adjustRightXDownTo: self minCompositionWidth].
paragraph focused: (self currentHand keyboardFocus == self).
paragraph
caretColor: self caretColor;
selectionColor: self selectionColor;
unfocusedSelectionColor: self unfocusedSelectionColor.
self fit.
] ensure: [self removeProperty: #CreatingParagraph].
^ paragraph!
Item was changed:
----- Method: TextMorph>>minCompositionHeight (in category 'layout') -----
minCompositionHeight
+ "Answer the minimal height for the receiver's composited contents. Without linebreaks, this height matches the default font's line grid. Note that we cannot use information from paragraph here, as it would require the text composition to have already happened."
^ (textStyle ifNil: [TextStyle default]) lineGrid!
Item was changed:
----- Method: TextMorph>>minCompositionWidth (in category 'layout') -----
minCompositionWidth
+ "Answer the minimal width for the receiver's composited contents. Without specific content, this width could be zero but matches the default font's example text to avoid composition issues. Note that we cannot use information from paragraph here, as it would require the text composition to have already happened."
+ self flag: #todo. "mt: Fix issues in CompositionScanner to allow for 0 or at least fit a specific character to match the single-line metric in #minCompositionHeight."
^ ((textStyle ifNil: [TextStyle default]) defaultFont widthOf: $x) * 2!
Item was changed:
----- Method: TextMorph>>minHeight (in category 'layout') -----
minHeight
+ "Answer the minimal height of the receiver to be used in Morphic layout policies. Avoid text composition if there is no paragraph yet to speed up overall layouting and avoid cyclic algorithmic dependencies. The minimal height is basically computed from text-composition metrics and extra decoration such as borders and margins."
| result |
result := (paragraph
ifNil: [self minCompositionHeight]
ifNotNil: [:para| para lines first lineHeight])
+ (self borderWidth*2).
margins ifNil: [^ result].
^ margins isRectangle
ifTrue: [result + margins top + margins bottom]
ifFalse: [margins isPoint
ifTrue: [result + margins y + margins y]
ifFalse: [result + (2*margins)]]!
Item was changed:
----- Method: TextMorph>>minWidth (in category 'layout') -----
minWidth
+ "Answer the minimal width of the receiver to be used in Morphic layout policies. Avoid text composition if there is no paragraph yet to speed up overall layouting and avoid cyclic algorithmic dependencies. The minimal width is basically computed from text-composition metrics and extra decoration such as borders and margins."
+
-
| result |
result := self minCompositionWidth + (self borderWidth*2).
margins ifNil: [^ result].
^ margins isRectangle
ifTrue: [result + margins left + margins right]
ifFalse: [margins isPoint
ifTrue: [result + margins x + margins x]
ifFalse: [result + (2*margins)]]!
More information about the Squeak-dev
mailing list
|