[squeak-dev] The Trunk: ST80-mt.280.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 11 09:04:55 UTC 2022


Marcel Taeumel uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-mt.280.mcz

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

Name: ST80-mt.280
Author: mt
Time: 11 March 2022, 10:04:53.135495 am
UUID: 93391eff-c5a0-ec47-a76d-831df97fa7c2
Ancestors: ST80-mt.279

Complements Morphic-mt.1931 (and sth. I forgot to commit yesterday about Locale updates)

=============== Diff against ST80-mt.279 ===============

Item was changed:
  ----- Method: EventSensor>>keyboard (in category '*ST80-Support-keyboard') -----
  keyboard
  	"Answer the next (single-byte or multi-byte) character from the keyboard."
  
  	| firstCharacter secondCharactor stream multiCharacter converter |
  	"1) Consume next character from buffer."
  	(firstCharacter := self characterForKeycode: keyboardBuffer next) ifNil: [^ nil].
  	
  	"2) Peek additional character and try to read multi-byte character."
  	(secondCharactor := self characterForKeycode: keyboardBuffer peek) ifNil: [^ firstCharacter].
+ 	(converter := Locale currentPlatform systemConverter) ifNil: [^ firstCharacter].
- 	(converter := TextConverter defaultSystemConverter) ifNil: [^ firstCharacter].
  	stream := ReadStream on: (String with: firstCharacter with: secondCharactor).
  	multiCharacter := [converter nextFromStream: stream] ifError: [firstCharacter].
  	
  	"3) Only consume that additional character if we got a multi-byte character."
  	multiCharacter isOctetCharacter ifFalse: [keyboardBuffer next].
  	
  	"4) Answer either single-byte or multi-byte character."
  	^ multiCharacter
  !

Item was changed:
  ----- Method: ParagraphEditor class>>initializeCmdKeyShortcuts (in category 'keyboard shortcut tables') -----
  initializeCmdKeyShortcuts
  	"Initialize the (unshifted) command-key (or alt-key) shortcut table."
  
  	"NOTE: if you don't know what your keyboard generates, use Sensor kbdTest"
  
  	"ParagraphEditor initialize"
  
  	| cmdMap |
  
  	cmdMap := Array new: 256 withAll: #noop:.	"use temp in case of a crash"
  
  	cmdMap at: 1 + 1 put: #cursorHome:.			"home key"
  	cmdMap at: 4 + 1 put: #cursorEnd:.				"end key"
  	cmdMap at: 8 + 1 put: #backspace:.				"ctrl-H or delete key"
  	cmdMap at: 11 + 1 put: #cursorPageUp:.		"page up key"
  	cmdMap at: 12 + 1 put: #cursorPageDown:.	"page down key"
  	cmdMap at: 13 + 1 put: #crWithIndent:.			"cmd-Return"
  	cmdMap at: 27 + 1 put: #offerMenuFromEsc:.	"escape key"
  	cmdMap at: 28 + 1 put: #cursorLeft:.			"left arrow key"
  	cmdMap at: 29 + 1 put: #cursorRight:.			"right arrow key"
  	cmdMap at: 30 + 1 put: #cursorUp:.				"up arrow key"
  	cmdMap at: 31 + 1 put: #cursorDown:.			"down arrow key"
  	cmdMap at: 32 + 1 put: #selectWord:.			"space bar key"
  	cmdMap at: 127 + 1 put: #forwardDelete:.		"del key"
  
+ 	'0123456789' 
- 	'0123456789-=' 
  		do: [:char | cmdMap at: char asciiValue + 1 put: #changeEmphasis:].
  
  	"triplet = {character. comment selector. novice appropiated}"
  	#(
  		($a		#selectAll:				true)
  		($b		#browseIt:				false)
  		($c		#copySelection:			true)
  		($d		#doIt:						false)
  		($e		#exchange:				true)
  		($f		#find:						true)
  		($g		#findAgain:				true)
  		($h		#setSearchString:		true)
  		($i		#inspectIt:				false)
  		($j		#doAgainOnce:			true)
  		($k		#offerFontMenu:		true)
  		($l		#cancel:					true)
  		($m	#implementorsOfIt:		false)
  		($n		#sendersOfIt:			false)
  		($o		#spawnIt:				false)
  		($p		#printIt:					false)
  		($q		#querySymbol:			false)
  		($s		#save:					true)
  		($t		#tempCommand:		false)
  		($u		#align:					true)
  		($v		#paste:					true)
  		($w	#backWord:				true)
  		($x		#cut:						true)
  		($y		#swapChars:				true)
  		($z		#undo:					true)
  	)
  		select:[:triplet | Preferences noviceMode not or:[triplet third]]
  		thenDo:[:triplet | cmdMap at: triplet first asciiValue + 1 put: triplet second].
  
  	CmdActions := cmdMap.
  !

Item was changed:
  ----- Method: ParagraphEditor>>changeEmphasis: (in category 'editing keys') -----
  changeEmphasis: characterStream 
  	"Change the emphasis of the current selection or prepare to
  	accept characters with the change in emphasis. Emphasis
  	change amounts to a font change. Keeps typeahead."
  	
  	| keyCode attribute oldAttributes index thisSel colors extras |
  
  	"control 0..9 -> 0..9"
+ 	keyCode := ('0123456789' indexOf: sensor keyboard ifAbsent: [1]) - 1.
- 	keyCode := ('0123456789-=' indexOf: sensor keyboard ifAbsent: [1]) - 1.
  
  	oldAttributes := paragraph text attributesAt: self pointIndex forStyle: paragraph textStyle.
  	thisSel := self selection.
  
  	"Decipher keyCodes for Command 0-9..."
+ 	"(keyCode between: 1 and: 5) ifTrue: [
- 	(keyCode between: 1 and: 5) ifTrue: [
  		attribute := TextFontChange fontNumber: keyCode
+ 	]."
- 	].
  
+ 	keyCode = 5 ifTrue: [
- 	keyCode = 6 ifTrue: [
  		| labels lines | 
  		colors := #(#black #magenta #red #yellow #green #blue #cyan #white ).
  		extras := #('Link to comment of class' 'Link to definition of class' 'Link to hierarchy of class' 'Link to method' ).
  
  		Preferences noviceMode ifTrue: [
  			labels := colors , #('choose color...' ).
  			lines := #()
  		]
  		ifFalse: [
  			labels := colors , #('choose color...' 'Do it' 'Print it' ) , extras , #('be a web URL link' 'Edit hidden info' 'Copy hidden info' ).
  			lines := Array with: colors size + 1
  		].
  
  		"index := (PopUpMenu labelArray: labels lines: lines) startUp. "
  		index := UIManager default chooseFrom: labels lines: lines.
  		index = 0
  			ifTrue: [ ^ true].
  			
  		index <= colors size ifTrue: [
  			attribute := TextColor color: (Color perform: (colors at: index))
  		]
  		ifFalse: [
  			index := index - colors size - 1. "Re-number!!!!!!"
  
  			index = 0 ifTrue: [
  				attribute := self chooseColor
  			].
  
  			index = 1 ifTrue: [
  				attribute := TextDoIt new.
  				thisSel := attribute analyze: self selection asString
  			].
  
  			index = 2 ifTrue: [
  				attribute := TextPrintIt new.
  				thisSel := attribute analyze: self selection asString
  			].
  
  			extras size = 0 & (index > 2) ifTrue: [
  				index := index + 4 "skip those"
  			].
  
  			index = 3 ifTrue: [
  				attribute := TextLink new.
  				thisSel := attribute analyze: self selection asString with: 'Comment'
  			].
  
  			index = 4 ifTrue: [
  				attribute := TextLink new.
  				thisSel := attribute analyze: self selection asString with: 'Definition'
  			].
  
  			index = 5 ifTrue: [
  				attribute := TextLink new.
  				thisSel := attribute analyze: self selection asString with: 'Hierarchy'
  			].
  
  			index = 6 ifTrue: [
  				attribute := TextLink new.
  				thisSel := attribute analyze: self selection asString
  			].
  		
  			index = 7 ifTrue: [
  				attribute := TextURL new.
  				thisSel := attribute analyze: self selection asString
  			].
  		
  			index = 8 ifTrue: [
  				"Edit hidden info"
  				thisSel := self hiddenInfo. "includes selection"
  				attribute := TextEmphasis normal
  			].
  
  			index = 9 ifTrue: [
  				"Copy hidden info"
  				self copyHiddenInfo.
  				^ true
  			].
  		
  			"no other action"
  			thisSel
  				ifNil: [ ^ true ]
  		]
  	].
  
+ 	(keyCode between: 6 and: 9) ifTrue: [
- 	(keyCode between: 7 and: 11) ifTrue: [
  		sensor leftShiftDown ifTrue: [
+ 			keyCode = 6 ifTrue: [
- 			keyCode = 10 ifTrue: [
  				attribute := TextKern kern: -1
  			].
+ 			keyCode = 7 ifTrue: [
- 			keyCode = 11 ifTrue: [
  				attribute := TextKern kern: 1
  			]
  		]
  		ifFalse: [
+ 			attribute := TextEmphasis perform: (#(#bold #italic #underlined #struckOut ) at: keyCode - 5).
- 			attribute := TextEmphasis perform: (#(#bold #italic #narrow #underlined #struckOut ) at: keyCode - 6).
  			oldAttributes
  						do: [:att | (att dominates: attribute) ifTrue: [attribute turnOff]]
  		]
  	].
  
  	keyCode = 0
  		ifTrue: [attribute := TextEmphasis normal].
  
+ 	attribute ifNil: [^ true].
+ 
  	beginTypeInBlock ~~ nil ifTrue: [
  		"only change emphasisHere while typing"
  		self insertTypeAhead: characterStream.
  		emphasisHere := Text addAttribute: attribute toArray: oldAttributes.
  		^ true
  	].
  
  	self
  		replaceSelectionWith: (thisSel asText addAttribute: attribute).
  		
  	^ true
  !



More information about the Squeak-dev mailing list