[squeak-dev] The Trunk: Morphic-mt.2077.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jan 26 10:17:43 UTC 2023


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

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

Name: Morphic-mt.2077
Author: mt
Time: 26 January 2023, 11:17:15.858707 am
UUID: 17adbf1c-192f-9647-9e7c-912e0df5ef19
Ancestors: Morphic-mt.2076

Tree navigation:
- [arrow-left] now jumps to parent if not expanded, collapse otherwise
- [SHIFT]+[arrow-up/down] now jumps between siblings only

=============== Diff against Morphic-mt.2076 ===============

Item was added:
+ ----- Method: IndentingListItemMorph>>previousSibling (in category 'accessing') -----
+ previousSibling
+ 
+ 	container ifNil: [^ self].
+ 	(container parentMorphOf: self)
+ 		ifNil: [^ nil]
+ 		ifNotNil: [:pm |
+ 			| currentChild |
+ 			currentChild := pm firstChild.
+ 			[currentChild isNil or: [currentChild nextSibling == self]]
+ 				whileFalse: [currentChild := currentChild nextSibling].
+ 			^ currentChild].!

Item was added:
+ ----- Method: IndentingListItemMorph>>previousVisibleSibling (in category 'accessing') -----
+ previousVisibleSibling
+ 
+ 	^ self previousSibling ifNotNil: [:c |
+ 		c visible ifTrue: [c] ifFalse: [c previousVisibleSibling]]!

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>arrowKey: (in category 'keyboard navigation') -----
  arrowKey: asciiValue
  	"Handle a keyboard navigation character. Answer true if handled, false if not."
  	| keyEvent max oldSelection nextSelection howManyItemsShowing keyHandled |
  	keyHandled := false.
  	keyEvent := asciiValue.
  	max := self maximumSelection.
  	nextSelection := oldSelection := self getSelectionIndex.
       keyEvent = 31 ifTrue:["down"
+ 		self currentEvent shiftPressed ifTrue: [
+ 			self selectedMorph nextVisibleSibling
+ 				ifNil: [^ false]
+ 				ifNotNil: [:m | self setSelectedMorph: m. ^ true]].
  		keyHandled := true.
  		nextSelection :=oldSelection + 1.
  		nextSelection > max ifTrue: [nextSelection := (self class wrappedNavigation ifTrue: [1] ifFalse: [max])]].
       keyEvent = 30 ifTrue:["up"
+ 		self currentEvent shiftPressed ifTrue: [
+ 			self selectedMorph previousVisibleSibling
+ 				ifNil: [^ false]
+ 				ifNotNil: [:m | self setSelectedMorph: m. ^ true]].
  		keyHandled := true.
  		nextSelection := oldSelection - 1.
  		nextSelection < 1 ifTrue: [nextSelection := self class wrappedNavigation ifTrue: [max] ifFalse: [1]]].
       keyEvent = 1  ifTrue: ["home"
  		keyHandled := true.
  		nextSelection := 1].
       keyEvent = 4  ifTrue: ["end"
  		keyHandled := true.
  		nextSelection := max].
  	howManyItemsShowing := self numSelectionsInView.
        keyEvent = 11 ifTrue: ["page up"
  		keyHandled := true.
  		nextSelection := 1 max: oldSelection - howManyItemsShowing].
       keyEvent = 12  ifTrue: ["page down"
  		keyHandled := true.
  		nextSelection := oldSelection + howManyItemsShowing min: max].
  
  	(nextSelection ~= oldSelection or: [ keyHandled and: [ self class wrappedNavigation not ]]) ifTrue: [
  		self setSelectionIndex: nextSelection.
  		^ true].
  	
  	keyEvent = 29 ifTrue:["right"
  		selectedMorph ifNotNil:[
  			(selectedMorph canExpand and:[selectedMorph isExpanded not])
  				ifTrue:[self toggleExpandedState: selectedMorph]
  				ifFalse:[self setSelectionIndex: self getSelectionIndex+1].
  		].
  		^true].
  	keyEvent = 28 ifTrue:["left"
  		selectedMorph ifNotNil:[
  			(selectedMorph isExpanded)
  				ifTrue:[self toggleExpandedState: selectedMorph]
+ 				ifFalse:[
+ 					self selectedParentMorph
+ 						ifNil: [self setSelectionIndex: (self getSelectionIndex-1 max: 1)]
+ 						ifNotNil: [:pm | self setSelectedMorph: pm]]
- 				ifFalse:[self setSelectionIndex: (self getSelectionIndex-1 max: 1)].
  		].
  		^true].
  	^false!

Item was added:
+ ----- Method: SimpleHierarchicalListMorph>>parentMorphOf: (in category 'selection') -----
+ parentMorphOf: itemMorph
+ 	"Answers the parent morph for itemMorph or nil if there is none."
+ 
+ 	| wrapper |
+ 	wrapper := itemMorph complexContents.
+ 	^ (wrapper respondsTo: #parent)
+ 		ifFalse: [ | parentItemMorph |
+ 			parentItemMorph := itemMorph.
+ 			[parentItemMorph isNil
+ 				or: [parentItemMorph indentLevel = (itemMorph indentLevel -1)]]
+ 					whileFalse: [parentItemMorph := parentItemMorph submorphBefore]]
+ 		ifTrue: [
+ 			wrapper := wrapper parent.
+ 			scroller submorphs
+ 				detect: [:each | each complexContents == wrapper]
+ 				ifNone: [nil]]!

Item was added:
+ ----- Method: SimpleHierarchicalListMorph>>selectedParentMorph (in category 'selection') -----
+ selectedParentMorph
+ 
+ 	^ self selectedMorph ifNotNil: [:itemMorph |
+ 		self parentMorphOf: itemMorph]!



More information about the Squeak-dev mailing list