Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-nice.249.mcz
==================== Summary ====================
Name: Multilingual-nice.249
Author: nice
Time: 9 December 2019, 6:17:46.99458 pm
UUID: 1a02af2f-d014-2a4e-9023-ef0cec93897b
Ancestors: Multilingual-nice.248
1) Nuke code specific to windows CE OS. We do not support such legacy OS in Opensmalltalk VM. Multilingual is complex enough without this useless drag.
2) Fix LanguageEnvironment comment which was a mixture of iso8859L1 (ByteString) and UTF32 (WideString) re-interpreted as ByteString. Note: that might have happened before UTF8 fixes to Monticello (the stream did start as ByteString, but did continue as WideString at first non-byte code... The encoding change did only happen at buffer boundary leading to such strange side-effects). Fortunately (sic!) most Multilingual classes are un-commented.
3) Nuke useless copy of 'encoding' literal
4) Comment possibly incorrect usage of (evtBuf at: 3) in UTF32InputInterpreter. This is the charCode field of squeak event, which is not anymore macRoman encoded on recent windows VM. More work is required at VM side for Unix before we can fully clean-up...
5) classify UTF32RussianInputInterpreter in same category than siblings
=============== Diff against Multilingual-nice.248 ===============
Item was changed:
----- Method: JapaneseEnvironment class>>clipboardInterpreterClass (in category 'subclass responsibilities') -----
clipboardInterpreterClass
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE'])
- ifTrue: [^NoConversionClipboardInterpreter].
platformName = 'Win32' ifTrue: [^UTF8ClipboardInterpreter].
platformName = 'Mac OS' ifTrue: [^MacShiftJISClipboardInterpreter].
^platformName = 'unix'
ifTrue:
[(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding)
ifTrue: [MacShiftJISClipboardInterpreter]
ifFalse: [UnixJPClipboardInterpreter]]
ifFalse: [ NoConversionClipboardInterpreter ]!
Item was changed:
----- Method: JapaneseEnvironment class>>defaultEncodingName (in category 'public query') -----
defaultEncodingName
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8'].
(#('Win32' 'ZaurusOS') includes: platformName) ifTrue: [^'shift-jis'].
platformName = 'Mac OS'
ifTrue:
[^('10*' match: osVersion)
ifTrue: ['utf-8']
ifFalse: ['shift-jis']].
^'unix' = platformName ifTrue: ['euc-jp'] ifFalse: ['mac-roman']!
Item was changed:
----- Method: JapaneseEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') -----
inputInterpreterClass
| platformName osVersion encoding |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32'
- and: [osVersion = 'CE'])
- ifTrue: [^ MacRomanInputInterpreter].
platformName = 'Win32'
ifTrue: [^ (self win32VMUsesUnicode) ifTrue: [UTF32JPInputInterpreter] ifFalse: [WinShiftJISInputInterpreter]].
platformName = 'Mac OS'
ifTrue: [^ (('10*' match: osVersion)
and: [(Smalltalk getSystemAttribute: 3) isNil])
ifTrue: [MacUnicodeInputInterpreter]
ifFalse: [MacShiftJISInputInterpreter]].
platformName = 'unix'
ifTrue: [encoding := X11Encoding encoding.
(EUCJPTextConverter encodingNames includes: encoding)
ifTrue: [^ UnixEUCJPInputInterpreter].
(UTF8TextConverter encodingNames includes: encoding)
ifTrue: [^ UnixUTF8JPInputInterpreter].
(ShiftJISTextConverter encodingNames includes: encoding)
ifTrue: [^ MacShiftJISInputInterpreter]].
^ MacRomanInputInterpreter!
Item was changed:
----- Method: KoreanEnvironment class>>clipboardInterpreterClass (in category 'subclass responsibilities') -----
clipboardInterpreterClass
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE'])
- ifTrue: [^NoConversionClipboardInterpreter].
platformName = 'Win32' ifTrue: [^WinKSX1001ClipboardInterpreter].
platformName = 'Mac OS'
ifTrue:
[('10*' match: osVersion)
ifTrue: [^NoConversionClipboardInterpreter]
ifFalse: [^WinKSX1001ClipboardInterpreter]].
platformName = 'unix'
ifTrue:
[(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding)
ifTrue: [^WinKSX1001ClipboardInterpreter]
ifFalse: [^NoConversionClipboardInterpreter]].
^NoConversionClipboardInterpreter!
Item was changed:
----- Method: KoreanEnvironment class>>defaultEncodingName (in category 'public query') -----
defaultEncodingName
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8' copy].
(#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName)
+ ifTrue: [^'euc-kr'].
+ (#('unix') includes: platformName) ifTrue: [^'euc-kr'].
- ifTrue: [^'euc-kr' copy].
- (#('unix') includes: platformName) ifTrue: [^'euc-kr' copy].
^'mac-roman'!
Item was changed:
----- Method: KoreanEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') -----
inputInterpreterClass
| platformName osVersion encoding |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE'])
- ifTrue: [^MacRomanInputInterpreter].
platformName = 'Win32' ifTrue: [^WinKSX1001InputInterpreter].
platformName = 'Mac OS'
ifTrue:
[('10*' match: osVersion)
ifTrue: [^MacUnicodeInputInterpreter]
ifFalse: [^WinKSX1001InputInterpreter]].
platformName = 'unix'
ifTrue:
[encoding := X11Encoding encoding.
(EUCJPTextConverter encodingNames includes: encoding)
ifTrue: [^MacRomanInputInterpreter].
(UTF8TextConverter encodingNames includes: encoding)
ifTrue: [^MacRomanInputInterpreter].
(ShiftJISTextConverter encodingNames includes: encoding)
ifTrue: [^MacRomanInputInterpreter]].
^MacRomanInputInterpreter!
Item was changed:
Object subclass: #LanguageEnvironment
instanceVariableNames: 'id'
classVariableNames: 'ClipboardInterpreterClass FileNameConverterClass InputInterpreterClass KnownEnvironments SystemConverterClass'
poolDictionaries: ''
category: 'Multilingual-Languages'!
+ !LanguageEnvironment commentStamp: 'nice 12/9/2019 15:34' prior: 0!
- !LanguageEnvironment commentStamp: 'bf 8/16/2009 16:52' prior: 0!
The name multilingualized Squeak suggests that you can use multiple language at one time. This is true, of course, but the system still how to manage the primary language; that provides the interpretation of data going out or coming in from outside world. It also provides how to render strings, as there rendering rule could be different in one language to another, even if the code points in a string is the same.
Originally, LanguageEnvironment and its subclasses only has class side methods. After merged with Diego's Babel work, it now has instance side methods. Since this historical reason, the class side and instance side are not related well.
+ When we talk about the interface with the outside of the Squeak world, there are three different "channels"; the keyboard input, clipboard output and input, and filename. On a not-to-uncommon system such as a Unix system localized to Japan, all of these three can have (and does have) different encodings. So we need to manage them separately. Note that the encoding in a file can be anything. While it is nice to provide a suggested guess for this 'default system file content encoding', it is not critical.
+
+ Rendering support is limited basic L-to-R rendering so far. But you can provide different line-wrap rule, at least.
+ !
- When we talk about the interface with the outside of the Squeak world, there are three different "channels"; the keyboard input, clipboard output and input, and filename. On a not-to-uncommon system such as a Unix system localized to Japan, all of these three can have (and does h
ave) different encodings. So we need to manage them separately. Note that the encoding in a file can be anything. While it is nice to provide a suggested guess for this 'default system file content encoding', it is not critical.
-
- Rendering support is limited basic L-to-R rendering so far. But you can provide different line-wrap rule, at least.
- !
Item was changed:
----- Method: Latin1Environment class>>defaultEncodingName (in category 'subclass responsibilities') -----
defaultEncodingName
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8' copy].
(#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName)
+ ifTrue: [^'iso8859-1'].
+ (#('unix') includes: platformName) ifTrue: [^'iso8859-1'].
- ifTrue: [^'iso8859-1' copy].
- (#('unix') includes: platformName) ifTrue: [^'iso8859-1' copy].
^'mac-roman'!
Item was changed:
----- Method: Latin1Environment class>>inputInterpreterClass (in category 'subclass responsibilities') -----
inputInterpreterClass
+ | platformName |
- | platformName osVersion |
platformName := Smalltalk platformName.
+ (platformName = 'Win32')
- osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion ~= 'CE'])
ifTrue: [^ (self win32VMUsesUnicode) ifTrue: [UTF32InputInterpreter] ifFalse: [MacRomanInputInterpreter]].
platformName = 'Mac OS'
ifTrue: [^ MacUnicodeInputInterpreter].
platformName = 'unix'
ifTrue: [^ UTF32InputInterpreter].
^ MacUnicodeInputInterpreter!
Item was changed:
----- Method: Latin1Environment class>>systemConverterClass (in category 'subclass responsibilities') -----
systemConverterClass
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk getSystemAttribute: 1002.
- (platformName = 'Win32'
- and: [osVersion = 'CE'])
- ifTrue: [^ MacRomanTextConverter].
platformName = 'Win32'
ifTrue: [^ (self win32VMUsesUnicode) ifTrue: [UTF8TextConverter] ifFalse: [ISO88591TextConverter]].
platformName = 'Mac OS'
ifTrue: [^ ('10*' match: Smalltalk osVersion)
ifTrue: [UTF8TextConverter]
ifFalse: [MacRomanTextConverter]].
platformName = 'unix'
ifTrue: [^ UTF8TextConverter].
^ MacRomanTextConverter!
Item was changed:
----- Method: Latin2Environment class>>defaultEncodingName (in category 'subclass responsibilities') -----
defaultEncodingName
+ | platformName |
- | platformName osVersion |
platformName := Smalltalk platformName.
- osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8' copy].
(#('Win32') includes: platformName)
+ ifTrue: [^'cp-1250'].
+ (#('unix') includes: platformName) ifTrue: [^'iso8859-2'].
- ifTrue: [^'cp-1250' copy].
- (#('unix') includes: platformName) ifTrue: [^'iso8859-2' copy].
^'mac-roman'!
Item was changed:
----- Method: SimplifiedChineseEnvironment class>>clipboardInterpreterClass (in category 'subclass responsibilities') -----
clipboardInterpreterClass
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE'])
- ifTrue: [^NoConversionClipboardInterpreter].
platformName = 'Win32' ifTrue: [^WinGB2312ClipboardInterpreter].
platformName = 'Mac OS'
ifTrue:
[('10*' match: osVersion)
ifTrue: [^NoConversionClipboardInterpreter]
ifFalse: [^WinGB2312ClipboardInterpreter]].
platformName = 'unix'
ifTrue:
[(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding)
ifTrue: [^MacShiftJISClipboardInterpreter]
ifFalse: [^NoConversionClipboardInterpreter]].
^NoConversionClipboardInterpreter!
Item was changed:
----- Method: SimplifiedChineseEnvironment class>>defaultEncodingName (in category 'public query') -----
defaultEncodingName
| platformName osVersion |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8' copy].
(#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName)
+ ifTrue: [^'gb2312'].
+ (#('unix') includes: platformName) ifTrue: [^'euc-cn'].
- ifTrue: [^'gb2312' copy].
- (#('unix') includes: platformName) ifTrue: [^'euc-cn' copy].
^'mac-roman'!
Item was changed:
----- Method: SimplifiedChineseEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') -----
inputInterpreterClass
| platformName osVersion encoding |
platformName := Smalltalk platformName.
osVersion := Smalltalk osVersion.
- (platformName = 'Win32' and: [osVersion = 'CE'])
- ifTrue: [^MacRomanInputInterpreter].
platformName = 'Win32' ifTrue: [^WinGB2312InputInterpreter].
platformName = 'Mac OS'
ifTrue:
[('10*' match: osVersion)
ifTrue: [^MacUnicodeInputInterpreter]
ifFalse: [^WinGB2312InputInterpreter]].
platformName = 'unix'
ifTrue:
[encoding := X11Encoding encoding.
(EUCJPTextConverter encodingNames includes: encoding)
ifTrue: [^MacRomanInputInterpreter].
(UTF8TextConverter encodingNames includes: encoding)
ifTrue: [^MacRomanInputInterpreter].
(ShiftJISTextConverter encodingNames includes: encoding)
ifTrue: [^MacRomanInputInterpreter]].
^MacRomanInputInterpreter!
Item was changed:
----- Method: UTF32InputInterpreter>>nextCharFrom:firstEvt: (in category 'keyboard') -----
nextCharFrom: sensor firstEvt: evtBuf
+ "Fall back to internal char-code if char is 0"
- "Fall back on MacRoman if char is 0"
^(evtBuf at: 6) > 0
ifTrue: [(evtBuf at: 6) asCharacter]
+ ifFalse:
+ [#fixme.
+ "The windows VM does not require macToSqueak for the fallback char-code
+ since https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/403
+ But unix VM still uses sqTextEncoding which still defaults to MacRoman...
+ We should fix the Unix VM too, or create two different KeyboardInterpreter.
+ Hardcoding macToSqueak is a bad idea anyway, because Unix behavior is a
+ parameter that can be changed thru either --encoding VM option
+ or SQUEAK_ENCODING environment variable"
+ (evtBuf at: 3) asCharacter macToSqueak].
- ifFalse: [(evtBuf at: 3) asCharacter macToSqueak].
!
Item was changed:
UTF32InputInterpreter subclass: #UTF32RussianInputInterpreter
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
+ category: 'Multilingual-TextConversion'!
- category: 'Multilingual-Languages'!
Marcel Taeumel uploaded a new version of Help-Squeak-TerseGuide to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-TerseGuide-jr.13.mcz
==================== Summary ====================
Name: Help-Squeak-TerseGuide-jr.13
Author: jr
Time: 7 December 2019, 9:21:46.658998 pm
UUID: 7d846785-0ca0-3840-9489-59de4e607cca
Ancestors: Help-Squeak-TerseGuide-mt.12
Old-style assignment should not be the first thing a newcomer should learn.
Edited the page directly in the HelpBrowser. It added the parentheses and the key: and shouldStyle: sends.
=============== Diff against Help-Squeak-TerseGuide-mt.12 ===============
Item was changed:
----- Method: TerseGuideHelp class>>assignment (in category 'pages') -----
assignment
"This method was automatically generated. Edit it using:"
"TerseGuideHelp edit: #assignment"
+ ^(HelpTopic
- ^HelpTopic
title: 'Assignment'
contents:
'| x y z |
- "x _ 4. " "older assignment style, Squeak used to repurpose the underscore to a left-arrow glyph <-"
x := 5. "assignment"
x := y := z := 6. "compound assignment"
x := (y := 6) + 1.
+ "x _ 4. " "older assignment style, Squeak used to repurpose the underscore to a left-arrow glyph <-"
x := Object new. "bind to allocated instance of a class"
x := 123 class. "discover the object class"
x := Integer superclass. "discover the superclass of a class"
x := Object allInstances. "get an array of all instances of a class"
x := Integer allSuperclasses. "get all superclasses of a class"
x := 1.2 hash. "hash value for object"
y := x copy. "copy object"
y := x shallowCopy. "copy object (not overridden)"
y := x deepCopy. "copy object and instance vars"
y := x veryDeepCopy. "complete tree copy using a dictionary"
+ !!' readStream nextChunkText)
+ key: #assignment;
+ shouldStyle: true;
+ yourself!
- !!' readStream nextChunkText!
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1290.mcz
==================== Summary ====================
Name: Kernel-mt.1290
Author: mt
Time: 23 December 2019, 11:24:23.728349 am
UUID: b2e649ef-ad9d-5040-b6b0-70b7e29e4085
Ancestors: Kernel-mt.1289
Do actually *duplicate* CTRL and CMD/ALT keys if that preference is enabled.
This means that such key-stroke events will always answer TRUE to both #controlKeyPressed and #commandKeyPressed. This solves various issues in client code. Now all paths that only check for #controlKeyPressed will match even if the duplication preference is enabled.
Note that for applications that do want to make use of CTRL and ALT/CMD in separate ways, the PREFERENCE "duplicate (all) ctrl and alt keys" has to be DISABLED. Those applications can easily check and inform the user.
Also note that key duplication means that there is no way to detect actual control keys. Disable that preference if you want to hit CTRL+C and, for example, access "Character enter" (ASCII 3) for that event's #keyCharacter.
Finally note that I will double-check effects in TextEditor asap.
=============== Diff against Kernel-mt.1289 ===============
Item was changed:
----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
installDuplicateKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
+ KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.
+ KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower . 8 bitOr: 2 "cmd/alt + ctrl" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt + shift" } put: { upper . (8 bitOr: 2) bitOr: 1 "cmd/alt + ctrl + shift" }.
- KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
"For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.!
- KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1611.mcz
==================== Summary ====================
Name: Morphic-mt.1611
Author: mt
Time: 22 December 2019, 3:05:29.126349 pm
UUID: cf7063f3-6f6c-9a4b-b111-c488509419af
Ancestors: Morphic-mt.1610
Fixes text-emphasis bug in menu items.
Not sure whether the extra storage of emphasis is really necessary in the long term.
=============== Diff against Morphic-mt.1610 ===============
Item was changed:
----- Method: StringMorph>>initializeFromText: (in category 'initialization') -----
initializeFromText: aText
| scanner |
scanner := StringMorphAttributeScanner new initializeFromStringMorph: self.
(aText attributesAt: 1 forStyle: self font textStyle)
do: [:attr | attr emphasizeScanner: scanner].
+ font := scanner font emphasized: scanner emphasis.
emphasis := scanner emphasis.
+
- font := scanner font.
color := scanner textColor.
self contents: aText string.!
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1289.mcz
==================== Summary ====================
Name: Kernel-mt.1289
Author: mt
Time: 19 December 2019, 11:45:58.637761 am
UUID: e9f9d6a0-0ce8-114e-b3d2-26b481f590a1
Ancestors: Kernel-mt.1288
- fixes ctrl <-> alt key swapping bug in #processEvent:
- fixes ctrl <-> alt key swapping by extending the range to the same range as for "duplicate *all*"
- LINUX ONLY: fixes swapping and duplication of ctrl/alt keys
- LINUX ONLY: maps controls keys that arrive as ASCII 64 to 127 down to ASCII 0 to 31
- document that other (older) "duplicate keys" preference to be deprecated after the 5.3 release
So, the current VM 201911282316 should be fine for all platforms for Squeak 5.3 at the moment.
=============== Diff against Kernel-mt.1288 ===============
Item was added:
+ ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
+ installControlKeyEntryFor: aPrintableCharacter
+
+ | upper lower |
+ self assert: (aPrintableCharacter asInteger between: 64 and: 95).
+
+ upper := aPrintableCharacter asInteger.
+ lower := aPrintableCharacter asInteger bitOr: 16r20.
+
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
+ self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
Item was changed:
----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
installDuplicateKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
+ self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
- !
Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
+ "Create a decode table that swaps or duplicates some keys if the respective preference is set."
+
- "Create a decode table that swaps some keys if
- Preferences swapControlAndAltKeys is set"
KeyDecodeTable := Dictionary new.
+
+ "In any case, ensure that control keys are mapped correctly."
+ self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
+ 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
+
- Preferences duplicateControlAndAltKeys
- ifTrue: [ self defaultCrossPlatformKeys do:
- [ :c | self installDuplicateKeyEntryFor: c ] ].
Preferences swapControlAndAltKeys
+ ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
- ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
+
+ self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
+ Preferences duplicateControlAndAltKeys
+ ifTrue: [ self defaultCrossPlatformKeys do:
+ [ :c | self installDuplicateKeyEntryFor: c ] ].
!
Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: aPrintableCharacter
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."
| upper lower |
upper := aPrintableCharacter asUppercase asInteger.
lower := aPrintableCharacter asLowercase asInteger.
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.
+
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."
+ self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
Item was changed:
----- Method: EventSensor>>processEvent: (in category 'private-I/O') -----
processEvent: evt
"Process a single event. This method is run at high priority."
| type buttons window |
type := evt at: 1.
"Only process main window events, forward others to host window proxies"
window := evt at: 8.
(window isNil or: [window isZero]) ifTrue:
[window := 1.
evt at: 8 put: window].
window = 1 ifFalse: [
^Smalltalk at: #HostWindowProxy ifPresent: [:w | w processEvent: evt]].
"Tackle mouse events and mouse wheel events first"
(type = EventTypeMouse or: [type = EventTypeMouseWheel])
ifTrue: [buttons := (ButtonDecodeTable at: (evt at: 5) + 1).
evt at: 5 put: (Smalltalk platformName = 'Mac OS'
ifTrue: [ buttons ]
ifFalse: [ self mapButtons: buttons modifiers: (evt at: 6) ]).
self queueEvent: evt.
type = EventTypeMouse ifTrue: [self processMouseEvent: evt].
type = EventTypeMouseWheel ifTrue: [self processMouseWheelEvent: evt].
^self].
"Store the event in the queue if there's any"
type = EventTypeKeyboard
ifTrue: [ "Check if the event is a user interrupt"
((evt at: 4) = EventKeyChar
and: [((evt at: 3)
bitOr: (((evt at: 5)
bitAnd: 8)
bitShift: 8))
= interruptKey])
ifTrue: ["interrupt key is meta - not reported as event"
^ interruptSemaphore signal].
"Decode keys for characters (i.e., duplicate or swap, ctrl <-> alt/cmd)."
(evt at: 4) = EventKeyChar
+ ifTrue: [ | unicode ascii |
+ "Copy lookup key first in case of key swap."
+ unicode := {evt at: 6. evt at: 5}.
+ ascii := {evt at: 3. evt at: 5}.
- ifTrue: [
KeyDecodeTable "Unicode character first"
+ at: unicode
- at: {evt at: 6. evt at: 5}
ifPresent: [:a | evt at: 6 put: a first;
at: 5 put: a second].
KeyDecodeTable "ASCII character second"
+ at: ascii
- at: {evt at: 3. evt at: 5}
ifPresent: [:a | evt at: 3 put: a first;
at: 5 put: a second]].
self queueEvent: evt.
self processKeyboardEvent: evt .
^self ].
"Handle all events other than Keyboard or Mouse."
self queueEvent: evt.
!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1610.mcz
==================== Summary ====================
Name: Morphic-mt.1610
Author: mt
Time: 18 December 2019, 4:31:47.223146 pm
UUID: 569aa27b-a8eb-0247-a758-b9ef6f53fa97
Ancestors: Morphic-mt.1609
Fixes a serious regression in text widgets and all other scroll panes.
- There were too many layout invalidations when scrolling through a pane's scroll bars. See #moveSliderTo: for the fix.
- There was a control-flow contract violation in ScrollPane >> #scrollToShow:.
- The text field discarderd mark-and-point information when replacing its editor. See, for example, #scrollSelectionIntoView:.
- All transform morphs triggered redraw requests on offset updates even if the new offset was not different. That made code in ScrollPanes unnecessarily complex.
I documented all the other quirks to be tackled after the 5.3 release. :-)
=============== Diff against Morphic-mt.1609 ===============
Item was changed:
----- Method: Morph>>position: (in category 'geometry') -----
position: aPoint
"Change the position of this morph, which is the top left corner of its bounds."
| delta box |
delta := (aPoint - self bounds topLeft) rounded.
"Skip drawing and layout updates for null changes."
(delta x = 0 and: [delta y = 0])
ifTrue: [^ self].
"Optimize drawing. Record one damage rectangle for short distance and two damage rectangles for large distances."
box := self fullBounds.
(delta dotProduct: delta) > 100 "More than 10 pixels?"
ifTrue: [self
invalidRect: box;
invalidRect: (box translateBy: delta)]
ifFalse: [self
invalidRect: (box merge: (box translateBy: delta))].
"Move this morph and *all* of its submorphs."
self privateFullMoveBy: delta.
"For all known layout policies, my layout and the layout of my children is fine. Only the layout of my owner might be affected. So, tell about it."
+ self owner ifNotNil: [:o |
+ self flag: #todo. "mt: Maybe we can save a lot of effort and troubles by only calling #layoutChanged if the owner has a layout policy installed? Take the thumbs of scroll-bars as an example..."
+ o layoutChanged].!
- self owner ifNotNil: [:o | o layoutChanged].!
Item was changed:
----- Method: PluggableTextMorph>>mouseLeave: (in category 'event handling') -----
mouseLeave: event
"Save the selection interval for later."
+ self flag: #fixIntervalCache. "mt: We should find a better design for discarding unused text editors in text morphs and restoring them on demand."
+ selectionInterval := textMorph editor markIndex to: textMorph editor pointIndex -1.
- selectionInterval := textMorph editor selectionInterval.
super mouseLeave: event.
Preferences mouseOverForKeyboardFocus
ifTrue: [event hand releaseKeyboardFocus: self]!
Item was changed:
----- Method: PluggableTextMorph>>printIt (in category 'menu commands') -----
printIt
| oldEditor |
textMorph editor selectFrom: selectionInterval first to: selectionInterval last;
model: model. "For, eg, evaluateSelection"
textMorph handleEdit: [(oldEditor := textMorph editor) evaluateSelectionAndDo:
[:result |
+ self flag: #fixIntervalCache. "mt: We should find a better design for discarding unused text editors in text morphs and restoring them on demand."
+ selectionInterval := oldEditor markIndex to: oldEditor pointIndex -1.
- selectionInterval := oldEditor selectionInterval.
textMorph installEditorToReplace: oldEditor.
textMorph handleEdit: [oldEditor afterSelectionInsertAndSelect: result printString].
+ selectionInterval := oldEditor markIndex to: oldEditor pointIndex -1.
- selectionInterval := oldEditor selectionInterval.
textMorph editor selectFrom: selectionInterval first to: selectionInterval last.
self scrollSelectionIntoView]]!
Item was changed:
----- Method: PluggableTextMorph>>scrollSelectionIntoView: (in category 'editor access') -----
scrollSelectionIntoView: event
"Scroll my text into view. Due to line composition mechanism, we must never use the right of a character block because the lines last character block right value always comes from a global container and is *not* line specific."
+
+ self flag: #fixIntervalCache. "mt: We should find a better design for discarding unused text editors in text morphs and restoring them on demand."
+ selectionInterval := textMorph editor markIndex to: textMorph editor pointIndex - 1.
- selectionInterval := textMorph editor selectionInterval.
-
textMorph editor hasSelection
ifFalse: [self scrollToShow: (textMorph editor startBlock withWidth: 1)]
ifTrue: [
self scrollToShow: (textMorph editor startBlock topLeft corner: textMorph editor stopBlock bottomLeft).
self scrollToShow: (textMorph editor pointBlock withWidth: 1). "Ensure text cursor visibility."].
^ true!
Item was changed:
----- Method: ScrollPane>>scrollToShow: (in category 'scrolling') -----
scrollToShow: aRectangle
| newOffset |
newOffset := self offsetToShow: aRectangle.
+ self hScrollBar setValue: newOffset x.
+ self vScrollBar setValue: newOffset y.!
- scroller offset = newOffset ifTrue: [^ self].
- scroller offset: newOffset.
- self layoutChanged.!
Item was changed:
----- Method: Slider>>computeSlider (in category 'geometry') -----
computeSlider
| r v |
r := self roomToMove.
v := self maximumValue = self minimumValue
ifTrue: [0]
ifFalse: [(value - self minimumValue) / (self maximumValue - self minimumValue)].
self descending
ifFalse:
+ [self moveSliderTo: (self orientation == #horizontal
- [slider position: (self orientation == #horizontal
ifTrue: [r topLeft + ((r width * v) asInteger @ 0)]
ifFalse: [r topLeft + (0 @ (r height * v) asInteger)])]
ifTrue:
+ [self moveSliderTo: (self orientation == #horizontal
- [slider position: (self orientation == #horizontal
ifTrue: [r bottomRight - ((r width * v) asInteger @ 0)]
ifFalse: [r bottomRight - ((0 @ (r height * v) asInteger))])].
+ self resizeSliderTo: self sliderExtent.!
- slider extent: self sliderExtent!
Item was added:
+ ----- Method: Slider>>moveSliderTo: (in category 'geometry') -----
+ moveSliderTo: newPosition
+ "Sliently move the slider (or thumb) to not trigger any #layoutChanged events."
+
+ | delta |
+ self flag: #codeDuplication. "mt: We need a better way to silently do position changes. See Morph >> #position:."
+
+ delta := (newPosition - slider position) rounded.
+ delta = (0@0) ifTrue: [^ self].
+
+ slider privateFullMoveBy: delta.
+ self changed.
+ !
Item was added:
+ ----- Method: Slider>>resizeSliderTo: (in category 'geometry') -----
+ resizeSliderTo: newExtent
+
+ slider extent: newExtent.!
Item was changed:
----- Method: Slider>>showSliderShadow (in category 'other events') -----
showSliderShadow
sliderShadow color: self sliderShadowColor.
sliderShadow cornerStyle: slider cornerStyle.
+ sliderShadow privateBounds: slider bounds. "mt: Avoid #layoutChanged. See #moveSliderTo:."
- sliderShadow bounds: slider bounds.
sliderShadow show.!
Item was changed:
----- Method: TextEditor>>stateArray (in category 'initialize-release') -----
stateArray
^ {ChangeText.
FindText.
history ifNil: [TextEditorCommandHistory new]. "Convert old instances"
+ self markIndex to: self pointIndex - 1.
- self selectionInterval.
self startOfTyping.
emphasisHere}!
Item was changed:
----- Method: TransformMorph>>offset: (in category 'accessing') -----
offset: newOffset
+ self offset = newOffset ifTrue: [^ self].
transform := transform withOffset: newOffset - self innerBounds topLeft.
+ self changed.!
- self changed!
Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
http://source.squeak.org/trunk/PreferenceBrowser-mt.97.mcz
==================== Summary ====================
Name: PreferenceBrowser-mt.97
Author: mt
Time: 18 December 2019, 9:44:48.790146 am
UUID: 85d3e759-4cc1-e74e-9f3b-1bbea95e10c6
Ancestors: PreferenceBrowser-mt.96, PreferenceBrowser-ck.85
Merges typo fix from PreferenceBrowser-ck.85.
=============== Diff against PreferenceBrowser-mt.96 ===============
Item was changed:
----- Method: PreferenceBrowser>>defaultSelected (in category 'preferences search') -----
defaultSelected
+ (Project uiManager
+ confirm: 'Do you really want to restore the default\preferences?\\If you want to keep the current state,\you have to save it first.' translated withCRs
+ title: 'Restore Preferences')
+ ifFalse: [^ self].
- (Project uiManager
- confirm: 'Do you really want to restorethe default\preferences?\\If you want to keep the current state,\you have to save it first.' translated withCRs
- title: 'Restore Preferences') ifFalse: [^ self].
+ Preferences chooseInitialSettings.!
-
- Preferences chooseInitialSettings!
Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
http://source.squeak.org/trunk/PreferenceBrowser-ck.85.mcz
==================== Summary ====================
Name: PreferenceBrowser-ck.85
Author: ck
Time: 18 December 2019, 9:22:49.829611 am
UUID: 1484d057-814b-4fb8-8d02-9b28797cf917
Ancestors: PreferenceBrowser-eem.84
Simple typo fix adding a space in the confirmation dialog.
=============== Diff against PreferenceBrowser-eem.84 ===============
Item was changed:
----- Method: PreferenceBrowser>>defaultSelected (in category 'preferences search') -----
defaultSelected
+ (Project uiManager confirm: 'Do you really want to restore the default\preferences?\\If you want to keep the current state,\you have to save it first.' translated withCRs title: 'Restore Preferences')
+ ifFalse: [^ self].
-
- (Project uiManager
- confirm: 'Do you really want to restorethe default\preferences?\\If you want to keep the current state,\you have to save it first.' translated withCRs
- title: 'Restore Preferences') ifFalse: [^ self].
-
-
Preferences chooseInitialSettings!