[squeak-dev] The Inbox: Morphic-ct.2044.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 14 17:49:39 UTC 2022


Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.2044.mcz

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

Name: Morphic-ct.2044
Author: ct
Time: 14 September 2022, 7:49:27.697879 pm
UUID: 8df3aeb1-91fa-6943-835c-d24a1b16caad
Ancestors: Morphic-ct.2043

Proposal: Avoids trickling/incomplete selections in PluggableListMorphOfMany by remembering the previous dragged index and updating all items since there in #mouseMove:. Especially helpful for low performance systems.

=============== Diff against Morphic-ct.2043 ===============

Item was changed:
  PluggableListMorph subclass: #AlternatePluggableListMorphOfMany
  	instanceVariableNames: 'getSelectionListSelector setSelectionListSelector'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Morphic-Pluggable Widgets'!
  
+ !AlternatePluggableListMorphOfMany commentStamp: 'ct 9/14/2022 19:45' prior: 0!
+ This is a multi-select list that is more conventional in its behavior than PluggableListMorphOfMany.  It utilizes a shift+click mechanism for selecting ranges, and control+click for toggling individual selections.!
- !AlternatePluggableListMorphOfMany commentStamp: 'cmm 3/2/2010 14:39' prior: 0!
- This is a multi-select list that is more conventional in its behavior than PluggableListMorphOfMany.  It utilizes a shift+click mechanism for selecting ranges, and control+click for toggling individual selections.  This list also allows fast mouse swipes without missing any message selections.!

Item was changed:
  PluggableListMorph subclass: #PluggableListMorphOfMany
+ 	instanceVariableNames: 'dragOnOrOff getSelectionListSelector setSelectionListSelector lastDraggedIndex'
- 	instanceVariableNames: 'dragOnOrOff getSelectionListSelector setSelectionListSelector'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Morphic-Pluggable Widgets'!
  
  !PluggableListMorphOfMany commentStamp: 'hpt 4/5/2004 11:21' prior: 0!
  A variant of its superclass that allows multiple items to be selected simultaneously.  There is still a distinguished element which is selected, but each other element in the list may be flagged on or off.
  !

Item was changed:
  ----- Method: PluggableListMorphOfMany>>mouseDown: (in category 'event handling') -----
  mouseDown: event
  	| row index |
  	event yellowButtonPressed ifTrue: [^ self yellowButtonActivity: event shiftPressed].
  	row := self rowAtLocation: event position.
  
  	row = 0 ifTrue: [^super mouseDown: event].
  	index := self modelIndexFor: row.
  
  	model okToChange ifFalse: [^ self].  "No change if model is locked"
  
  	self changeModelSelection: index.
  
  	"Set meaning for subsequent dragging of selection"
  	self
  		listSelectionAt: index
+ 		put: (dragOnOrOff := (self listSelectionAt: index) not).
+ 	lastDraggedIndex := index.!
- 		put: (dragOnOrOff := (self listSelectionAt: index) not)
- !

Item was changed:
  ----- Method: PluggableListMorphOfMany>>mouseMove: (in category 'event handling') -----
  mouseMove: event 
  	"The mouse has moved, as characterized by the event provided.  Adjust the scrollbar, and alter the selection as appropriate"
  
+ 	| row index direction originIndex |
- 	| row index |
  	event position y < self top 
  		ifTrue: 
  			[scrollBar scrollUp: 1.
  			row := self rowAtLocation: scroller topLeft + (1 @ 1)]
  		ifFalse: 
  			[row := event position y > self bottom 
  				ifTrue: 
  					[scrollBar scrollDown: 1.
  					self rowAtLocation: scroller bottomLeft + (1 @ -1)]
  				ifFalse: [ self rowAtLocation: event position]].
  	row = 0 ifTrue: [^super mouseDown: event].
  	index := self modelIndexFor: row.
  
  	model okToChange ifFalse: [^self].	"No change if model is locked"
  
  	dragOnOrOff ifNil: [
  		"Was not set at mouse down, which means the mouse must have gone down in an area where there was no list item"
  		dragOnOrOff := (self listSelectionAt: index) not].
+ 	
- 
  	self changeModelSelection: index.
+ 	
+ 	"Update selections. To avoid trickling/incomplete selections for fast mouse swipes, update all selections from the previous index."
+ 	originIndex := (lastDraggedIndex ifNil: [index]).
+ 	direction := 1 sign: index - originIndex.
+ 	((originIndex + direction) to: index - direction by: direction) do: [:eachIndex |
+ 		self listSelectionAt: eachIndex put: dragOnOrOff].
+ 	self listSelectionAt: index put: dragOnOrOff.
+ 	lastDraggedIndex := index.!
- 	self listSelectionAt: index put: dragOnOrOff.!

Item was changed:
  ----- Method: PluggableListMorphOfMany>>mouseUp: (in category 'event handling') -----
  mouseUp: event
  
  	dragOnOrOff := nil.  "So improperly started drags will have not effect"
+ 	lastDraggedIndex := nil.
  
  	event hand newKeyboardFocus: self. 
  	hasFocus := true.
  	Cursor normal show.!



More information about the Squeak-dev mailing list