Christoph Thiede uploaded a new version of Morphic to project The Treated Inbox:
http://source.squeak.org/treated/Morphic-ct.1905.mcz
==================== Summary ====================
Name: Morphic-ct.1905
Author: ct
Time: 24 February 2022, 11:59:10.222147 am
UUID: ac4eb336-4623-5f48-9485-b4e46c636580
Ancestors: Morphic-mt.1904
Proposal: For Morph extensions, establish the common return value semantics known from most other collection protocols. I.e., #setProperty:... now answers the added value and #removeProperty: answers the removed value.
This can also help us to clean up a number of senders, browse this for an impression:
self systemNavigation browseAllCallsOn: #removeProperty: and: #valueOfProperty:
=============== Diff against Morphic-mt.1904 ===============
Item was changed:
----- Method: Morph>>removeProperty: (in category 'accessing - properties') -----
removeProperty: aSymbol
+ "Remove the property named aSymbol if it exists. Answer the old value or nil."
- "removes the property named aSymbol if it exists"
extension ifNil: [^ self].
+ ^ extension removeProperty: aSymbol!
- extension removeProperty: aSymbol!
Item was changed:
----- Method: Morph>>setProperties: (in category 'accessing - properties') -----
setProperties: aList
+ "Set many properties at once from a list of prop, value, prop, value. Answer the list."
- "Set many properties at once from a list of prop, value, prop, value"
1 to: aList size by: 2 do: [:ii |
+ self setProperty: (aList at: ii) toValue: (aList at: ii+1)].
+ ^ aList!
- self setProperty: (aList at: ii) toValue: (aList at: ii+1)].!
Item was changed:
----- Method: Morph>>setProperty:toValue: (in category 'accessing - properties') -----
setProperty: aSymbol toValue: anObject
+ "Change the receiver's property named aSymbol to anObject. Answer anObject."
- "change the receiver's property named aSymbol to anObject"
anObject ifNil: [^ self removeProperty: aSymbol].
+ ^ self assureExtension setProperty: aSymbol toValue: anObject!
- self assureExtension setProperty: aSymbol toValue: anObject!
Item was changed:
----- Method: MorphExtension>>removeProperty: (in category 'accessing - other properties') -----
removeProperty: aSymbol
+ "Removes the property named aSymbol if it exists. Answer the old value or nil."
+ | value |
- "removes the property named aSymbol if it exists"
otherProperties ifNil: [^ self].
+ value := otherProperties removeKey: aSymbol ifAbsent: [].
+ otherProperties isEmpty ifTrue: [self removeOtherProperties].
+ ^ value!
- otherProperties removeKey: aSymbol ifAbsent: [].
- otherProperties isEmpty ifTrue: [self removeOtherProperties]!
Item was changed:
----- Method: MorphExtension>>setProperty:toValue: (in category 'accessing - other properties') -----
setProperty: aSymbol toValue: abObject
+ "Change the receiver's property named aSymbol to anObject. Answer anObject."
+ ^ self assureOtherProperties at: aSymbol put: abObject!
- "change the receiver's property named aSymbol to anObject"
- self assureOtherProperties at: aSymbol put: abObject!
Christoph Thiede uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ct.1906.mcz
==================== Summary ====================
Name: Morphic-ct.1906
Author: ct
Time: 24 February 2022, 5:41:18.342147 pm
UUID: 4cdef9c0-ecb4-1c40-bb54-8fd5153939e6
Ancestors: Morphic-mt.1904
For Morph properties, establishes the common return value semantics known from most other collection protocols. I.e., #setProperty:... now answers the added value and #removeProperty: answers the removed value.
This can also help us to clean up a number of senders, browse this for an impression:
self systemNavigation browseAllCallsOn: #removeProperty: and: #valueOfProperty:
Thanks to Marcel for the review! Treats Morphic-ct.1905.
=============== Diff against Morphic-mt.1904 ===============
Item was changed:
----- Method: Morph>>removeProperty: (in category 'accessing - properties') -----
removeProperty: aSymbol
+ "Remove the property named aSymbol if it exists. Answer the old value or nil."
+ extension ifNil: [^ nil].
+ ^ extension removeProperty: aSymbol!
- "removes the property named aSymbol if it exists"
- extension ifNil: [^ self].
- extension removeProperty: aSymbol!
Item was changed:
----- Method: Morph>>setProperties: (in category 'accessing - properties') -----
setProperties: aList
+ "Set many properties at once from a list of prop, value, prop, value. Answer the list."
- "Set many properties at once from a list of prop, value, prop, value"
1 to: aList size by: 2 do: [:ii |
+ self setProperty: (aList at: ii) toValue: (aList at: ii+1)].
+ ^ aList!
- self setProperty: (aList at: ii) toValue: (aList at: ii+1)].!
Item was changed:
----- Method: Morph>>setProperty:toValue: (in category 'accessing - properties') -----
setProperty: aSymbol toValue: anObject
+ "Change the receiver's property named aSymbol to anObject. Answer anObject."
+ anObject ifNil: [
+ self removeProperty: aSymbol.
+ ^ anObject].
+ ^ self assureExtension setProperty: aSymbol toValue: anObject!
- "change the receiver's property named aSymbol to anObject"
- anObject ifNil: [^ self removeProperty: aSymbol].
- self assureExtension setProperty: aSymbol toValue: anObject!
Item was changed:
----- Method: MorphExtension>>removeProperty: (in category 'accessing - other properties') -----
removeProperty: aSymbol
+ "Removes the property named aSymbol if it exists. Answer the old value or nil."
+ | value |
+ otherProperties ifNil: [^ nil].
+ value := otherProperties removeKey: aSymbol ifAbsent: [].
+ otherProperties ifEmpty: [self removeOtherProperties].
+ ^ value!
- "removes the property named aSymbol if it exists"
- otherProperties ifNil: [^ self].
- otherProperties removeKey: aSymbol ifAbsent: [].
- otherProperties isEmpty ifTrue: [self removeOtherProperties]!
Item was changed:
----- Method: MorphExtension>>setProperty:toValue: (in category 'accessing - other properties') -----
setProperty: aSymbol toValue: abObject
+ "Change the receiver's property named aSymbol to anObject. Answer anObject."
+ ^ self assureOtherProperties at: aSymbol put: abObject!
- "change the receiver's property named aSymbol to anObject"
- self assureOtherProperties at: aSymbol put: abObject!
Marcel Taeumel uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-mt.279.mcz
==================== Summary ====================
Name: ST80-mt.279
Author: mt
Time: 22 February 2022, 8:41:55.006334 am
UUID: 3d65bef8-ad3a-c843-9848-f3845292dafd
Ancestors: ST80-mt.278
Fixes regression in MVC text composition.
=============== Diff against ST80-mt.278 ===============
Item was changed:
----- Method: CompositionScanner>>composeLine:fromCharacterIndex:inParagraph: (in category '*ST80-Support') -----
composeLine: lineIndex fromCharacterIndex: startIndex inParagraph: aParagraph
"Answer an instance of TextLineInterval that represents the next line in the paragraph."
+ | runLength stopCondition |
- | runLength stopCondition lineSpacing |
destX := spaceX := leftMargin := aParagraph leftMarginForCompositionForLine: lineIndex.
destY := 0.
rightMargin := aParagraph rightMarginForComposition.
leftMargin >= rightMargin ifTrue: [self error: 'No room between margins to compose'].
lastIndex := startIndex. "scanning sets last index"
lineHeight := baseline := 0. "Will be increased by setFont"
lineGap := lineGapSlice := -9999. "Will be increased by setFont; allow negative to show all effects of a custom #extraGap value. See TTFontDescription."
topMargin := bottomMargin := 0.
self setStopConditions. "also sets font"
self handleIndentation.
runLength := text runLengthFor: startIndex.
runStopIndex := (lastIndex := startIndex) + (runLength - 1).
line := TextLineInterval
start: lastIndex
stop: 0
internalSpaces: 0
paddingWidth: 0.
nextIndexAfterLineBreak := spaceCount := 0.
lastBreakIsNotASpace := false.
[stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
in: text string rightX: rightMargin.
"See setStopConditions for stopping conditions for composing."
self perform: stopCondition] whileFalse.
+ self flag: #margins. "mt: Note that this path does not support #lineSpacing because ST80's text views do not use TextComposer but TextLineInterval and their own legacy Paragraph class."
- lineHeight := lineHeight + lineGap.
- baseline := baseline + lineGapSlice.
+ ^ line
+ lineHeight: lineHeight + lineGap
+ baseline: baseline + lineGapSlice!
- "TODO: Allow special characters or text attributes to accumulate extra top or bottom margin."
- (lineSpacing := textStyle lineSpacing) = 0.0
- ifFalse: [bottomMargin := bottomMargin + (lineSpacing * lineHeight) truncated].
-
- line lineHeight: lineHeight baseline: baseline.
- line topMargin: topMargin bottomMargin: bottomMargin.
-
- ^ line!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.486.mcz
==================== Summary ====================
Name: Graphics-mt.486
Author: mt
Time: 21 February 2022, 5:06:38.314875 pm
UUID: f5395b09-31fa-994e-b227-0dc8166d79d7
Ancestors: Graphics-mt.485
Updates commentary around primitive 103 and its issues with TTCFont.
Thanks to Tony (tonyg) for the pointer!
=============== Diff against Graphics-mt.485 ===============
Item was changed:
----- Method: CharacterScanner>>primScanCharactersFrom:to:in:rightX:stopConditions:kern: (in category 'scanning') -----
primScanCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX stopConditions: stops kern: kernDelta
+ "Primitive. This is the inner loop of text display--but see #scanCharactersFrom:to:in:rightX: which would get the string, stopConditions and displaying from the instance. March through sourceString from startIndex to stopIndex. If any character is flagged with a non-nil entry in stops, then return the corresponding value. Determine width of each character from xTable, indexed by map. If destX would exceed rightX, then return stops at: 258. Advance destX by the width of the character. If stopIndex has been reached, then return stops at: 257.
+
+ Optional. See Object documentation whatIsAPrimitive.
+
+ NOTE THAT this primitive does only work for our legacy StrikeFont because #setActualFont: needs #xTable and #characterToGlyphMap, which are both not available for TTCFont this way and thus we end up calling #widthOf: manually on the font."
+
- "Primitive. This is the inner loop of text display--but see
- scanCharactersFrom: to:rightX: which would get the string,
- stopConditions and displaying from the instance. March through source
- String from startIndex to stopIndex. If any character is flagged with a
- non-nil entry in stops, then return the corresponding value. Determine
- width of each character from xTable, indexed by map.
- If dextX would exceed rightX, then return stops at: 258.
- Advance destX by the width of the character. If stopIndex has been
- reached, then return stops at: 257. Optional.
- See Object documentation whatIsAPrimitive.
- Historical note: this primitive has been unusable since about Squeak 2.8 when the shape of the CharracterScanner class changed. It is left here as a reminder that the actual primitive still needs supporting in the VM to keep old images such as Scratch1.4 alive - tpr"
<primitive: 103>
+ ^self basicScanByteCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX
+
+ "Here are some sketchy benchmarks to illustrate the performance issue regarding the use of TrueType fonts:
+
+ 1) TTCFont only; with primitive fail
+ '1,160 per second. 865 microseconds per run. 0.44 % GC time.'
+
+ 2) TTCFont only; without primitive fail
+ '5,730 per second. 175 microseconds per run. 6.12 % GC time.'
+
+ 3) StrikeFont only; using primitive 103
+ '29,700 per second. 33.6 microseconds per run. 1.11978 % GC time.'
+
+ 4) StrikeFont only; without primitive 103
+ '13,900 per second. 71.7 microseconds per run. 1.17976 % GC time.'
+
+ "!
- ^self basicScanByteCharactersFrom: startIndex to: stopIndex in: sourceString rightX: rightX !
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.990.mcz
==================== Summary ====================
Name: Collections-mt.990
Author: mt
Time: 21 February 2022, 4:37:12.410875 pm
UUID: cef34928-08c4-154a-b1ec-1cbd6e18b725
Ancestors: Collections-mt.989
Let CMD+0 also remove custom fonts in a text selection, not just colors etc. This means that the selection will then be formatted using the text style's default font. Until now, it was easy to change a font via CMD+k but hard to revert that modification.
=============== Diff against Collections-mt.989 ===============
Item was added:
+ ----- Method: TextFontChange>>dominatedByCmd0 (in category 'testing') -----
+ dominatedByCmd0
+ "Revert to default font using current paragraph's text style. See TextStyle >> #defaultFont."
+
+ ^ true!