Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1409.mcz
==================== Summary ====================
Name: System-mt.1409
Author: mt
Time: 31 March 2023, 3:47:13.230258 pm
UUID: d1af62bf-d0ab-c54c-b294-1b872187104b
Ancestors: System-mt.1408
Forgot to reset the clipboard constants ... sorry for the noise...
=============== Diff against System-mt.1408 ===============
Item was changed:
+ (PackageInfo named: 'System') postscript: 'ExtendedClipboardWinInterface initialize..'!
- (PackageInfo named: 'System') postscript: 'ExtendedClipboardWinInterface initialize.'!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1407.mcz
==================== Summary ====================
Name: System-mt.1407
Author: mt
Time: 31 March 2023, 1:03:38.939305 pm
UUID: b9a7d013-e3e5-264b-8376-9e3fcb8c2396
Ancestors: System-mt.1406
For (multi-lingual) text morphs from Squeak 4.3, add a class-rename to be able to load .morph files without prompt.
=============== Diff against System-mt.1406 ===============
Item was changed:
----- Method: SmartRefStream>>initKnownRenames (in category 'read write') -----
initKnownRenames
renamed
at: #FlasherMorph put: #Flasher;
at: #AlansTextPlusMorph put: #TextPlusMorph;
at: #Project put: #MorphicProject;
at: #Presenter put: #EtoysPresenter;
at: #InputSensor put: #EventSensor;
+ at: #MultiNewParagraph put: #NewParagraph;
yourself!
Marcel Taeumel uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-mt.288.mcz
==================== Summary ====================
Name: Multilingual-mt.288
Author: mt
Time: 30 March 2023, 9:24:00.543449 am
UUID: 5301b1ee-1cd2-be44-9f02-a8829a3a2505
Ancestors: Multilingual-pre.287
Expands commentary on utf8 encoding/decoding. Documents the #changeClassTo: idiom.
=============== Diff against Multilingual-pre.287 ===============
Item was changed:
----- Method: ByteArray>>utf8Decoded (in category '*Multilingual-converting') -----
utf8Decoded
+ "Interprets the receiver as a UTF8-encoded String. Yields a String, or an InvalidUTF8 exception if the receiver is not valid UTF8.
+ If the receiver is only temporary (and writable), class adoption can be faster:
+ self changeClassTo: ByteString; utf8ToSqueak."
+
- "Interprets the receiver as a UTF8-encoded String. Yields a String, or an InvalidUTF8 exception if the receiver is not valid UTF8."
- "Equivalent to the Pharo method of the same name."
^ self asString utf8ToSqueak!
Item was changed:
----- Method: String>>utf8Encoded (in category '*Multilingual-converting') -----
utf8Encoded
+ "Yields a ByteArray containing the UTF8 encoding of the receiver's contents.
+ If the receiver is only temporary (and writable), class adoption can be faster:
+ self squeakToUtf8 changeClassTo: ByteArray."
+
- "Yields a ByteArray containing the UTF8 encoding of the receiver's contents."
- "Equivalent to the Pharo method of the same name."
^ self squeakToUtf8 asByteArray!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1405.mcz
==================== Summary ====================
Name: System-mt.1405
Author: mt
Time: 29 March 2023, 1:56:30.174927 pm
UUID: 0ff6d772-c400-ec4b-98db-219158b3a7dd
Ancestors: System-mt.1404
Try to use the extended clipboard for both set/get contents. Gracefully fallback to the old primitive. Retain in-image buffer (and text attributes) when string contents are unchanged.
Note that there is no #getClipboardData: but only #readClipboardData:.
=============== Diff against System-mt.1404 ===============
Item was changed:
----- Method: Clipboard>>clipboardText (in category 'accessing') -----
clipboardText
+ "Answer the text currently in the (system) clipboard. To preserve image-specifc formatting, simply answer the text from an in-image buffer UNLESS that buffer differs from what is in the system clipboard. Also use that buffer if the sytem clipboard got cleared by some other application."
- "Return the text currently in the clipboard. If the system clipboard is empty, or if it differs from the Smalltalk clipboard text, use the Smalltalk clipboard. This is done since (a) the Mac clipboard gives up on very large chunks of text and (b) since not all platforms support the notion of a clipboard."
+ | systemContents needsDecoding stringOrText |
+ needsDecoding := false.
+ systemContents := ExtendedClipboardInterface current readTextClipboardData
+ ifNil: [needsDecoding := true.
+ self primitiveClipboardText "old primitive"].
+ stringOrText := systemContents withSqueakLineEndings.
+ (stringOrText isEmpty or: [stringOrText asString = contents asString])
- | string decodedString |
- string := self primitiveClipboardText withSqueakLineEndings.
- (string isEmpty
- or: [string = contents asString])
ifTrue: [^ contents].
+ ^ needsDecoding
+ ifFalse: [stringOrText asText]
+ ifTrue: [ | decodedString | "from old primitive"
+ decodedString := self interpreter fromSystemClipboard: stringOrText asString.
+ decodedString = contents asString
+ ifTrue: [contents]
+ ifFalse: [decodedString asText]].!
- decodedString := self interpreter fromSystemClipboard: string.
- ^ decodedString = contents asString
- ifTrue: [contents]
- ifFalse: [decodedString asText].
- !
Item was changed:
----- Method: Clipboard>>clipboardText: (in category 'accessing') -----
clipboardText: text
+
+ self clipboardText: text notifyWith: nil!
- (ExtendedClipboardInterface current clipboardText: text) ifFalse:
- [self clipboardText: text notifyWith: nil]!
Item was changed:
----- Method: Clipboard>>clipboardText:notifyWith: (in category 'accessing') -----
+ clipboardText: stringOrText notifyWith: anObject
+ "Set the contents of the (system) clipboard. anObject can be used as a marker for the source of the clipboard change, the default value is nil. Try to use the extended interface so that, e.g., rich text can be encoded and transported to other applications."
- clipboardText: text notifyWith: anObject
- "Set the contents of the clipboard to text. anObject can be used as a marker for the source of the clipboard change, the default value is nil."
+ | newContents |
+ newContents := stringOrText asText.
+ self noteRecentClipping: newContents.
+ contents := newContents. "Preserve in-image attributes. See #clipboardText."
+
+ (ExtendedClipboardInterface current clipboardText: newContents)
+ ifFalse: [ | string |
+ "Extended interface failed. Use old primitive and plain text with system-specific encoding."
+ string := newContents asString.
+ string := self interpreter toSystemClipboard: string.
+ self primitiveClipboardText: string].
+
+ self triggerEvent: #contentChanged withArguments: { newContents. anObject }.!
- | string |
- string := text asString.
- self noteRecentClipping: text asText.
- contents := text asText.
- string := self interpreter toSystemClipboard: string.
- self primitiveClipboardText: string.
- self triggerEvent: #contentChanged withArguments: { text. anObject }!
Item was added:
+ ----- Method: ExtendedClipboardInterface>>clipboardText (in category 'general-api-read') -----
+ clipboardText
+
+ ^ self readTextClipboardData ifNil: ['' asText]!
Item was changed:
----- Method: ExtendedClipboardInterface>>readStringClipboardData (in category 'general-api-read') -----
readStringClipboardData
+
+ ^ self readWideStringClipboardData
+ ifNil: [self readByteStringClipboardData]!
- ^ self subclassResponsibility!
Item was changed:
----- Method: ExtendedClipboardInterface>>readTextClipboardData (in category 'general-api-read') -----
readTextClipboardData
+ ^ self readStringClipboardData ifNotNil: [:string | string asText]!
- ^ nil!
Item was changed:
----- Method: ExtendedClipboardWinInterface>>readByteStringClipboardData (in category 'general-api-read') -----
readByteStringClipboardData
+ ^ (self hasClipboardData: CF_TEXT)
+ ifTrue: [(self readClipboardData: CF_TEXT) asString]!
- (self hasClipboardData: 1) "CF_TEXT"
- ifFalse: [^ nil].
-
- ^ (self readClipboardData: 1) "CF_TEXT" asString!
Item was changed:
----- Method: ExtendedClipboardWinInterface>>readWideStringClipboardData (in category 'general-api-read') -----
readWideStringClipboardData
+ ^ (self hasClipboardData: CF_UNICODETEXT)
+ ifTrue: [((self readClipboardData: CF_UTF8TEXT) changeClassTo: ByteString) utf8ToSqueak]!
- (self hasClipboardData: 13) "CF_UNICODETEXT"
- ifFalse: [^ nil].
-
- ^((self getClipboardData: CF_UTF8TEXT) changeClassTo: ByteString) utf8ToSqueak!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1404.mcz
==================== Summary ====================
Name: System-mt.1404
Author: mt
Time: 29 March 2023, 11:45:14.718107 am
UUID: e6746bf6-9dd7-ce49-ad64-410f5ae752c8
Ancestors: System-mt.1403
Complement Collections-mt.1031
=============== Diff against System-mt.1403 ===============
Item was removed:
- ----- Method: String>>isPlainText (in category '*System-Support') -----
- isPlainText
- "For compatibility with Text"
- ^true!
Item was removed:
- ----- Method: Text>>isPlainText (in category '*System-Support') -----
- isPlainText
- "A Text with no emphasis has empty values."
- ^runs values = #(#())!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.2100.mcz
==================== Summary ====================
Name: Morphic-mt.2100
Author: mt
Time: 29 March 2023, 11:44:49.143107 am
UUID: 4c032757-c84e-d945-87eb-eeb6124849b3
Ancestors: Morphic-mt.2099
Complement Collections-mt.1031
=============== Diff against Morphic-mt.2099 ===============
Item was changed:
----- Method: TextMorph>>newContents: (in category 'accessing') -----
newContents: stringOrText
"Accept new text contents."
| newText embeddedMorphs oldSelection |
newText := stringOrText isString
ifTrue: [Text fromString: stringOrText copy ]
ifFalse: [ stringOrText copy asText. "should be veryDeepCopy?" ].
+ self plainTextOnly ifTrue: [ newText removeAttributesForPlainText ].
- self plainTextOnly ifTrue: [ newText removeAttributesThat: [:att | att isTextAlignment not] ].
(text = newText and: [text runs = newText runs]) ifTrue: [^ self]. "No substantive change"
text ifNotNil: [(embeddedMorphs := text embeddedMorphs)
ifNotNil:
[self removeAllMorphsIn: embeddedMorphs.
embeddedMorphs do: [:m | m delete]]].
oldSelection := editor ifNotNil: [:ed | ed selectionInterval].
text := newText.
"add all morphs off the visible region; they'll be moved into the right
place when they become visible. (this can make the scrollable area too
large, though)"
newText embeddedMorphs do:
[:m |
self addMorph: m.
m position: -1000 @ 0].
self releaseParagraph.
"update the paragraph cache"
self paragraph.
oldSelection ifNotNil: [:sel | self selectFrom: sel first to: sel last].
"re-instantiate to set bounds"
self world ifNotNil: [self world startSteppingSubmorphsOf: self]!
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.1031.mcz
==================== Summary ====================
Name: Collections-mt.1031
Author: mt
Time: 29 March 2023, 11:43:16.766107 am
UUID: 90b7b1a5-0369-5542-9507-80d32a98cc4a
Ancestors: Collections-mt.1030
Document and expand on the notion of "plain text" as a property that can be checked on any String or Text.
See commentary in #isPlainText for more inforamtion. Add #hasAnyAttribute to be used if a more strict check is necessary.
=============== Diff against Collections-mt.1030 ===============
Item was added:
+ ----- Method: String>>asPlainText (in category 'converting') -----
+ asPlainText
+ "For compatibility with Text"
+ ^self!
Item was added:
+ ----- Method: String>>isPlainText (in category 'testing') -----
+ isPlainText
+ "For compatibility with Text"
+ ^true!
Item was added:
+ ----- Method: Text>>asPlainText (in category 'converting') -----
+ asPlainText
+ "Answer a copy of the receiver that represents text that has no attributes substantially related to the visual representation of glyphs. If the receiver represents already plain text, just return it. Thus, do not rely on this method to always answer a copy."
+
+ self isPlainText ifTrue: [^ self].
+ ^ self copy removeAttributesForPlainText!
Item was added:
+ ----- Method: Text>>hasAnyAttribute (in category 'testing') -----
+ hasAnyAttribute
+ "Also see (commentary in) #isPlainText, which is compatible with the String protocol.
+ Examples:
+ data isStringOrText and: [data isPlainText].
+ data isString or: [data isText and: [data hasAnyAttribute not]]."
+
+ ^ self notEmpty and: [self runs anySatisfy: [:attributes | attributes notEmpty]]!
Item was added:
+ ----- Method: Text>>hasAttributeThat: (in category 'testing') -----
+ hasAttributeThat: block
+
+ ^ self runs anySatisfy: [:attributes |
+ attributes anySatisfy: [:attribute |
+ block value: attribute]]!
Item was changed:
----- Method: Text>>hasClickableAttribute (in category 'testing') -----
hasClickableAttribute
+ ^ self hasAttributeThat: [:attr | attr mayActOnClick]!
- ^ self runs anySatisfy: [:attrs | attrs anySatisfy: [:attr |
- attr respondsTo: #mayActOnClick]]!
Item was changed:
----- Method: Text>>hasColorAttribute (in category 'testing') -----
hasColorAttribute
+ ^ self hasAttributeThat: [:attr | attr respondsTo: #color]!
- ^ self runs anySatisfy: [:attrs | attrs anySatisfy: [:attr |
- attr respondsTo: #color]]!
Item was changed:
----- Method: Text>>hasFontAttribute (in category 'testing') -----
hasFontAttribute
+ ^ self hasAttributeThat: [:attr |
+ (attr respondsTo: #fontNumber) or: [attr respondsTo: #font]]!
- ^ self runs anySatisfy: [:attrs | attrs anySatisfy: [:attr |
- (attr respondsTo: #fontNumber) or: [attr respondsTo: #font]]]!
Item was added:
+ ----- Method: Text>>isPlainText (in category 'testing') -----
+ isPlainText
+ "A plain text has no attribute that is substantial for a character's visual representation. As of now, this excludes text alignment as this is regarded more a layout property of the surrounding text container (or widget). See #hasAttributes for a more strict check and #asPlainText for conversion. Note that Squeak's notion of text attributes is more powerful and expressive compared to what plain-text is outside Squeak's context."
+
+ self flag: #todo. "mt: First, we should find a way to make widget-specific text alignment possible without having to set attributes on the (plain) text it is showing. See uses of #plainTextOnly(:). Second, there might be an entire category of text attributes possible that only affects Squeak-specific magic but not related to the user's notin of plain text. Thus, find a better check."
+ ^ (self hasAttributeThat: [:att | att isTextAlignment not]) not!
Item was added:
+ ----- Method: Text>>removeAttributesForPlainText (in category 'private') -----
+ removeAttributesForPlainText
+ "In the receiver, remove all text attributes so that #isPlainText will answer true after this."
+
+ self removeAttributesThat: [:att | att isTextAlignment not].!