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

commits at source.squeak.org commits at source.squeak.org
Mon Jan 30 12:09:05 UTC 2023


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

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

Name: Morphic-mt.2083
Author: mt
Time: 30 January 2023, 1:09:02.561867 pm
UUID: 6a7a9c44-e657-0442-b88a-25d3c49aa46d
Ancestors: Morphic-mt.2082

In tree widgets, when collapsing a node via mouse-click, do update the selection if the current one gets lost.

Avoid jumpy view if intermediate selection is nil.

Remove some dead code.

=============== Diff against Morphic-mt.2082 ===============

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>mouseDown: (in category 'event handling') -----
  mouseDown: evt
  
  	| aMorph selectors |	
  	aMorph := self itemFromPoint: evt position.
  	evt yellowButtonPressed  "First check for option (menu) click"
  		ifTrue: [
  			(PluggableListMorph menuRequestUpdatesSelection and: [model okToChange]) ifTrue: [
  				aMorph == selectedMorph 
  					ifFalse: [self setSelectedMorph: aMorph]].
  			^ self yellowButtonActivity: evt shiftPressed].
  
  	aMorph ifNil: [^ super mouseDown: evt].
  
  	(aMorph notNil and:[aMorph inToggleArea: (aMorph point: evt position from: self)])
+ 		ifTrue: [
+ 			self toggleExpandedState: aMorph event: evt.
+ 			self selectedMorph ifNil: [
+ 				self setProperty: #changeSelectionOnMouseUp toValue: true.
+ 				self setProperty: #selectedMorph toValue: aMorph].
+ 			^ self]. 
- 		ifTrue: [^ self toggleExpandedState: aMorph event: evt]. 
  	
  	PluggableListMorph highlightPreSelection ifTrue: [
  		aMorph highlightedForMouseDown: true.
  		self setProperty: #highlightedMorph toValue: aMorph].
  	
  	self setProperty: #changeSelectionOnMouseUp toValue: true.
  	
  	selectors := Array 
  		with: #click:
  		with: (self doubleClickEnabled ifTrue: [#doubleClick:] ifFalse: [nil])
  		with: nil
  		with: (self dragEnabled ifTrue:[#startDrag:] ifFalse:[nil]).
  	evt hand waitForClicksOrDrag: self event: evt selectors: selectors threshold: HandMorph dragThreshold "pixels".!

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>mouseUp: (in category 'event handling') -----
  mouseUp: event
   
  	| clickedMorph |
  	model okToChange ifFalse: [^ self].
  	(clickedMorph := self itemFromPoint: event position) ifNil: [^ self].
  	
  	(self valueOfProperty: #highlightedMorph ifAbsent: [])
  		ifNotNil: [:m |
  			m highlightedForMouseDown: false.
  			self removeProperty: #highlightedMorph].
  	
  	(self hasProperty: #changeSelectionOnMouseUp)
  		ifFalse: [^ self]
  		ifTrue: [self removeProperty: #changeSelectionOnMouseUp].
+ 		
+ 	(self valueOfProperty: #selectedMorph) ifNotNil: [:m |
+ 		clickedMorph := m.
+ 		self removeProperty: #selectedMorph].
  	
  	((autoDeselect isNil or: [autoDeselect]) and: [clickedMorph == selectedMorph]) 
  		ifTrue: [self setSelectedMorph: nil]
  		ifFalse: [self setSelectedMorph: clickedMorph].
  
  	event hand newKeyboardFocus: self.
  	Cursor normal show.!

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>scrollSelectionIntoView (in category 'selection') -----
  scrollSelectionIntoView
+ 	"Ensure that the user can see the current selection. If there is no current selection, keep the view stable."
+ 	
+ 	self selectedMorph ifNotNil: [:m | self scrollToShow: m bounds].!
- 
- 	self selectedMorph
- 		ifNil: [self scrollToTop]
- 		ifNotNil: [:m | self scrollToShow: m bounds].!

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>toggleExpandedState:event: (in category 'events') -----
  toggleExpandedState: aMorph event: event
+ 
+ 	aMorph toggleExpandedState.
- 	| oldState |
- 	"self setSelectedMorph: aMorph."
- 	event yellowButtonPressed ifTrue: [
- 		oldState := aMorph isExpanded.
- 		scroller submorphs copy do: [ :each |
- 			(each canExpand and: [each isExpanded = oldState]) ifTrue: [
- 				each toggleExpandedState.
- 			].
- 		].
- 	] ifFalse: [
- 		aMorph toggleExpandedState.
- 	].
  	self adjustSubmorphPositions.
  	!



More information about the Squeak-dev mailing list