[Pkg] The Trunk: Morphic-mt.796.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Mar 31 15:30:52 UTC 2015


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

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

Name: Morphic-mt.796
Author: mt
Time: 31 March 2015, 5:30:16.582 pm
UUID: 4b95c232-4447-6f41-a251-e2a3f4196f23
Ancestors: Morphic-mt.795

Indicate hovered item in lists. Can be turned off via preference. 

Redraw of the highlight is fast because we only invalidate the rectangles from the affected rows.

Extended #handleMouseMove: and not #mouseMove: because there is a mouse-button guard in #handleMouseMove:, which is exploited in the multi-selection list morphs.

=============== Diff against Morphic-mt.795 ===============

Item was changed:
  ----- Method: LazyListMorph>>drawOn: (in category 'drawing') -----
  drawOn: aCanvas
  	| |
  	listItems size = 0 ifTrue: [ ^self ].
+ 	 
-  
  	self 
  		drawPreSelectionOn: aCanvas;
  		drawSelectionOn: aCanvas.
  
  	(self topVisibleRowForCanvas: aCanvas) to: (self bottomVisibleRowForCanvas: aCanvas) do: [ :row |
  		(listSource itemSelectedAmongMultiple:  row) ifTrue: [
+ 			self drawBackgroundForMulti: row on: aCanvas. ]].
+ 
+ 	PluggableListMorph highlightHoveredRow ifTrue: [
+ 		listSource hoverRow > 0 ifTrue: [
+ 			self highlightHoverRow: listSource hoverRow on: aCanvas ] ].
+ 
+ 	(self topVisibleRowForCanvas: aCanvas) to: (self bottomVisibleRowForCanvas: aCanvas) do: [ :row |
- 			self drawBackgroundForMulti: row on: aCanvas. ].
  		self display: (self item: row) atRow: row on: aCanvas.
  	].
  
  	listSource potentialDropRow > 0 ifTrue: [
  		self highlightPotentialDropRow: listSource potentialDropRow on: aCanvas ].!

Item was added:
+ ----- Method: LazyListMorph>>highlightHoverRow:on: (in category 'drawing') -----
+ highlightHoverRow: row on: aCanvas
+ 	| drawBounds  |
+ 	drawBounds := self drawBoundsForRow: row.
+ 	drawBounds := drawBounds intersect: self bounds.
+ 	aCanvas fillRectangle: drawBounds color: (self class listSelectionColor darker alpha: 0.3).!

Item was added:
+ ----- Method: LazyListMorph>>rowChanged: (in category 'updating') -----
+ rowChanged: anInteger
+ 
+ 	self invalidRect: (self drawBoundsForRow: anInteger).!

Item was changed:
  ScrollPane subclass: #PluggableListMorph
+ 	instanceVariableNames: 'list getListSelector getListSizeSelector getListElementSelector getIndexSelector setIndexSelector keystrokeActionSelector autoDeselect lastKeystrokeTime lastKeystrokes lastClickTime doubleClickSelector handlesBasicKeys potentialDropRow hoverRow listMorph hScrollRangeCache keystrokePreviewSelector priorSelection getIconSelector'
+ 	classVariableNames: 'ClearFilterAutomatically FilterableLists HighlightHoveredRow'
- 	instanceVariableNames: 'list getListSelector getListSizeSelector getListElementSelector getIndexSelector setIndexSelector keystrokeActionSelector autoDeselect lastKeystrokeTime lastKeystrokes lastClickTime doubleClickSelector handlesBasicKeys potentialDropRow listMorph hScrollRangeCache keystrokePreviewSelector priorSelection getIconSelector'
- 	classVariableNames: 'ClearFilterAutomatically FilterableLists'
  	poolDictionaries: ''
  	category: 'Morphic-Pluggable Widgets'!
  
  !PluggableListMorph commentStamp: 'cmm 8/21/2011 23:37' prior: 0!
  When a PluggableListMorph is in focus, type in a letter (or several letters quickly) to go to the next item that begins with that letter (if FilterableLists is false).
  
  Special keys (up, down, home, etc.) are also supported.!

Item was added:
+ ----- Method: PluggableListMorph class>>highlightHoveredRow (in category 'preferences') -----
+ highlightHoveredRow
+ 
+ 	<preference: 'Highlight Hovered Row in Lists'
+ 		category: #Morphic
+ 		description: 'Indicate, which row will be affected before any further iteraction takes place.'
+ 		type: #Boolean>
+ 	^ HighlightHoveredRow ifNil: [true]!

Item was added:
+ ----- Method: PluggableListMorph class>>highlightHoveredRow: (in category 'preferences') -----
+ highlightHoveredRow: aBoolean
+ 
+ 	HighlightHoveredRow := aBoolean.!

Item was changed:
  ----- Method: PluggableListMorph>>handleMouseMove: (in category 'events-processing') -----
  handleMouseMove: anEvent
  	"Reimplemented because we really want #mouseMove when a morph is dragged around"
  	anEvent wasHandled ifTrue:[^self]. "not interested"
+ 	self hoverRow: (self rowAtLocation: anEvent position).
  	(anEvent anyButtonPressed and:[anEvent hand mouseFocus == self]) ifFalse:[^self].
  	anEvent wasHandled: true.
  	self mouseMove: anEvent.
  	(self handlesMouseStillDown: anEvent) ifTrue:[
  		"Step at the new location"
  		self startStepping: #handleMouseStillDown: 
  			at: Time millisecondClockValue
  			arguments: {anEvent copy resetHandlerFields}
  			stepTime: 1].
  !

Item was added:
+ ----- Method: PluggableListMorph>>hoverItem (in category 'accessing') -----
+ hoverItem
+ 
+ 	^ self hoverRow = 0
+ 		ifTrue: [nil]
+ 		ifFalse: [self getListItem: self hoverRow]!

Item was added:
+ ----- Method: PluggableListMorph>>hoverRow (in category 'accessing') -----
+ hoverRow
+ 
+ 	^ hoverRow ifNil: [0]!

Item was added:
+ ----- Method: PluggableListMorph>>hoverRow: (in category 'accessing') -----
+ hoverRow: anInteger
+ 
+ 	hoverRow = anInteger ifTrue: [^ self].
+ 	
+ 	hoverRow ifNotNil: [self listMorph rowChanged: hoverRow].
+ 	hoverRow := anInteger.
+ 	hoverRow ifNotNil: [self listMorph rowChanged: hoverRow].!

Item was changed:
  ----- Method: PluggableListMorph>>mouseLeave: (in category 'events') -----
  mouseLeave: event
  	"The mouse has left the area of the receiver"
  
  	super mouseLeave: event.
+ 	
+ 	self hoverRow: nil.
+ 	
  	Preferences mouseOverForKeyboardFocus ifTrue:[
+ 		event hand releaseKeyboardFocus: self].!
- 	event hand releaseKeyboardFocus: self]!

Item was changed:
  ----- Method: PluggableListMorph>>mouseLeaveDragging: (in category 'events') -----
  mouseLeaveDragging: anEvent
+ 
+ 	self hoverRow: nil.
  	(self dropEnabled and:[anEvent hand hasSubmorphs]) ifFalse: ["no d&d"
  		^ super mouseLeaveDragging: anEvent].
  	self resetPotentialDropRow.
  	anEvent hand releaseMouseFocus: self.
  	"above is ugly but necessary for now"
  !



More information about the Packages mailing list