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

commits at source.squeak.org commits at source.squeak.org
Sat Jun 25 06:51:44 UTC 2016


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

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

Name: Morphic-mt.1185
Author: mt
Time: 25 June 2016, 8:51:08.59647 am
UUID: 05385b8c-0ff4-6443-9c57-52be6dc91bbb
Ancestors: Morphic-mt.1184

Fixes several bugs with selection and hovering in menus and docking-bar menus and their sub-menus.

=============== Diff against Morphic-mt.1184 ===============

Item was changed:
  ----- Method: DockingBarItemMorph>>mouseEnter: (in category 'events') -----
  mouseEnter: evt
+ 	"Do not hover docking bar items directory. Mouse-down required. But if you already see a submenu, support hovering."
- 	"The mouse entered the receiver"
  
+ 	owner selectedItem ifNotNil: [owner selectItem: self event: evt]!
- 	super mouseEnter: evt.
- 	(owner selectedItem notNil and: [ owner selectedItem ~~ self ]) ifTrue: [
- 		owner selectItem: self event: evt. ]!

Item was removed:
- ----- Method: DockingBarItemMorph>>mouseLeaveDragging: (in category 'events') -----
- mouseLeaveDragging: evt !

Item was changed:
  StringMorph subclass: #MenuItemMorph
+ 	instanceVariableNames: 'isEnabled subMenu isSelected target selector arguments icon'
- 	instanceVariableNames: 'isEnabled subMenu isSelected target selector arguments icon lastMousePosition'
  	classVariableNames: 'SubMenuMarker'
  	poolDictionaries: ''
  	category: 'Morphic-Menus'!
  
  !MenuItemMorph commentStamp: '<historical>' prior: 0!
  I represent an item in a menu.
  
  Instance variables:
  	isEnabled 	<Boolean>	True if the menu item can be executed.
  	subMenu 	<MenuMorph | nil>	The submenu to activate automatically when the user mouses over the item.
  	isSelected 	<Boolean>	True if the item is currently selected.
  	target 		<Object>		The target of the associated action.
  	selector 		<Symbol>	The associated action.
  	arguments 	<Array>		The arguments for the associated action.
  	icon		<Form | nil>	An optional icon form to be displayed to my left.
  
  If I have a dynamic marker, created by strings like <yes> or <no> in my contents, it will be installed as a submorph.!

Item was changed:
  ----- Method: MenuItemMorph>>activateSubmenu: (in category 'events') -----
  activateSubmenu: evt
  	"Activate our submenu; e.g., pass control to it"
  	subMenu ifNil:[^false]. "not applicable"
  	(subMenu fullContainsPoint: evt position) ifFalse:[^false].
  	subMenu activate: evt.
- 	self removeAlarm: #deselectTimeOut:.
  	^true!

Item was changed:
  ----- Method: MenuItemMorph>>deselect: (in category 'selecting') -----
  deselect: evt
  
  	self isSelected: false.
- 	lastMousePosition := nil.
  	subMenu ifNotNil: [
  		owner ifNotNil: [ owner activeSubmenu: nil ] ].!

Item was removed:
- ----- Method: MenuItemMorph>>deselectTimeOut: (in category 'events') -----
- deselectTimeOut: evt
- 	"Deselect timout. Now really deselect"
- 	owner selectedItem == self
- 		ifTrue:[
- 			evt hand newMouseFocus: nil.
- 			owner selectItem: nil event: evt].
- !

Item was changed:
  ----- Method: MenuItemMorph>>mouseEnter: (in category 'events') -----
  mouseEnter: evt
  	"The mouse entered the receiver"
  
+ 	owner ifNotNil: [ owner selectItem: self event: evt ]!
- 	owner ifNotNil: [ owner stayUp ifFalse: [ self mouseEnterDragging: evt ] ]!

Item was changed:
  ----- Method: MenuItemMorph>>mouseEnterDragging: (in category 'events') -----
  mouseEnterDragging: evt
+ 
+ 	self mouseEnter: evt.!
- 	"The mouse entered the receiver. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu."
- 	evt hand mouseFocus == owner ifTrue:[owner selectItem: self event: evt]!

Item was removed:
- ----- Method: MenuItemMorph>>mouseLeave: (in category 'events') -----
- mouseLeave: evt
- 	"The mouse has left the interior of the receiver..."
- 
- 	owner ifNotNil: [owner stayUp ifFalse: [self mouseLeaveDragging: evt]]!

Item was removed:
- ----- Method: MenuItemMorph>>mouseLeaveDragging: (in category 'events') -----
- mouseLeaveDragging: evt 
- 	"The mouse left the receiver. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu."
- 
- 	owner ifNil: [^self].
- 	evt hand mouseFocus == owner ifFalse: [ ^self ].
- 	lastMousePosition := evt position.
- 	owner selectItem: nil event: evt!

Item was removed:
- ----- Method: MenuItemMorph>>releasesSelection: (in category 'events') -----
- releasesSelection: evt
- 	" Returns a boolean indicating that this menu item is ready to go deselected.
- 	It answers false if the mouse is moving towards its submenu. 
- 	We check this by testing that the current mouse position lays in the triangle of 
- 	the last mouse position and the two corners of the submenu facing our menu item. "
- 
- 	| triangle submenuIsOnTheRightSide |
- 	self hasSubMenu ifFalse: [ 
- 		lastMousePosition := nil.
- 		^true ].
- 	lastMousePosition ifNil: [ 
- 		lastMousePosition := evt position.
- 		^false ].
- 	submenuIsOnTheRightSide := self left < subMenu left.
- 	triangle := {
- 		lastMousePosition.
- 		submenuIsOnTheRightSide 
- 			ifTrue: [ subMenu topLeft ] 
- 			ifFalse: [ subMenu topRight ].
- 		submenuIsOnTheRightSide 
- 			ifTrue: [ subMenu bottomLeft ] 
- 			ifFalse: [ subMenu bottomRight ] }.
- 	lastMousePosition := evt position.
- 	(self triangle: triangle containsPoint: evt position)
- 		ifTrue: [ ^false ]
- 		ifFalse: [ 
- 			lastMousePosition := nil.
- 			^true ]!

Item was changed:
  ----- Method: MenuItemMorph>>veryDeepInner: (in category 'copying') -----
  veryDeepInner: deepCopier 
  	"Copy all of my instance variables. Some need to be not copied  
  	at all, but shared. Warning!!!! Every instance variable defined in  
  	this class must be handled. We must also implement  
  	veryDeepFixupWith:. See DeepCopier class comment."
  	super veryDeepInner: deepCopier.
  	isEnabled := isEnabled veryDeepCopyWith: deepCopier.
  	subMenu := subMenu veryDeepCopyWith: deepCopier.
  	isSelected := isSelected veryDeepCopyWith: deepCopier.
  	icon := icon veryDeepCopyWith: deepCopier.
  	"target := target.		Weakly copied"
  	"selector := selector.		a Symbol"
+ 	arguments := arguments.!
- 	arguments := arguments.
- 	lastMousePosition := nil!

Item was added:
+ ----- Method: MenuMorph>>handlesMouseOver: (in category 'events') -----
+ handlesMouseOver: evt
+ 	^ true!

Item was added:
+ ----- Method: MenuMorph>>mouseLeave: (in category 'events') -----
+ mouseLeave: evt
+ 	self selectItem: nil event: evt.!

Item was removed:
- ----- Method: MenuMorph>>releasesSelection: (in category 'events') -----
- releasesSelection: evt
- 	" The MenuMorph releases its selection if the selected item releases it. 
- 	Used in #selectItem:event: "
- 
- 	self selectedItem ifNil: [ ^true ].
- 	evt ifNil: [ ^true ].
- 	evt isKeyboard ifTrue: [ ^true ].
- 	(self selectedItem containsPoint: evt position) ifTrue: [ ^true ].
- 	^self selectedItem releasesSelection: evt!

Item was changed:
  ----- Method: MenuMorph>>selectItem:event: (in category 'control') -----
  selectItem: aMenuItem event: anEvent
+ 	"Change the selected item." 
+ 	
- 
- 	" Change the selected item, but first ask the currently selected item 
- 	if it want to release it. " 
- 	(self releasesSelection: anEvent) ifFalse: [ ^self ].
  	selectedItem ifNotNil:[selectedItem deselect: anEvent].
  	selectedItem := aMenuItem.
  	selectedItem ifNotNil:[selectedItem select: anEvent].!



More information about the Packages mailing list