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

commits at source.squeak.org commits at source.squeak.org
Fri May 18 06:59:44 UTC 2018


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

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

Name: Morphic-mt.1434
Author: mt
Time: 18 May 2018, 8:59:28.078917 am
UUID: 194e4181-5646-bb4c-b7cf-dcc237a99517
Ancestors: Morphic-kfr.1433

Further reduce the usage of #cmdGesturesEnabled. Adds two more specific preferences #haloForAll and #metaMenuForAll.

Why? Both dev tools, namely halo and meta menu, might interfere with some applications. So the user (or programmer) might want to disable, for example, the meta menu to free another user gesture. At the moment, the halo is invoked via BLUE click and the meta menu via CTRL+ANY click.

=============== Diff against Morphic-kfr.1433 ===============

Item was changed:
  Object subclass: #Morph
  	instanceVariableNames: 'bounds owner submorphs fullBounds color extension'
+ 	classVariableNames: 'HaloForAll IndicateKeyboardFocus MetaMenuForAll PreferredCornerRadius UseSoftDropShadow'
- 	classVariableNames: 'IndicateKeyboardFocus PreferredCornerRadius UseSoftDropShadow'
  	poolDictionaries: ''
  	category: 'Morphic-Kernel'!
  
  !Morph commentStamp: 'klc 3/14/2017 11:30' prior: 0!
  A Morph (from the Greek "shape" or "form") is an interactive graphical object. General information on the Morphic system can be found at http://wiki.squeak.org/squeak/30. 
  
  Morphs exist in a tree, rooted at a World (generally a PasteUpMorph). The morphs owned by a morph are its submorphs. Morphs are drawn recursively; if a Morph has no owner it never gets drawn. To hide a Morph and its submorphs, set its #visible property to false using the #visible: method. 
  
  The World (screen) coordinate system is used for most coordinates, but can be changed if there is a TransformMorph somewhere in the owner chain. 
  
  My instance variables have accessor methods (e.g., #bounds, #bounds:). Most users should use the accessor methods instead of using the instance variables directly.
  
  Structure:
  instance var 	Type 			Description 
  bounds 			Rectangle 		A Rectangle indicating my position and a size that will enclose 									me. 
  owner 			Morph		 	My parent Morph, or nil for the top-level Morph, which is a
   				or nil			world, typically a PasteUpMorph.
  submorphs 		Array 			My child Morphs. 
  fullBounds 		Rectangle 		A Rectangle minimally enclosing me and my submorphs. 
  color 			Color 			My primary color. Subclasses can use this in different ways. 
  extension 		MorphExtension Allows extra properties to be stored without adding a
  				or nil  				storage burden to all morphs. 
  
  By default, Morphs do not position their submorphs. Morphs may position their submorphs directly or use a LayoutPolicy to automatically control their submorph positioning.
  
  Although Morph has some support for BorderStyle, most users should use BorderedMorph if they want borders.!

Item was added:
+ ----- Method: Morph class>>haloForAll (in category 'preferences') -----
+ haloForAll
+ 
+ 	<preference: 'Offer Halo for All Morphs'
+ 		categoryList: #(Morphic)
+ 		description: 'If enabled, there will be a halo provided for any morph after a certain input gesture is detected, which is usually a BLUE (middle) mouse click.'
+ 		type: #Boolean>
+ 	^ HaloForAll ifNil: [true]!

Item was added:
+ ----- Method: Morph class>>haloForAll: (in category 'preferences') -----
+ haloForAll: aBoolean
+ 
+ 	HaloForAll := aBoolean.!

Item was added:
+ ----- Method: Morph class>>metaMenuForAll (in category 'preferences') -----
+ metaMenuForAll
+ 
+ 	<preference: 'Offer Meta Menu for All Morphs'
+ 		categoryList: #(Morphic)
+ 		description: 'If enabled, there will be a meta menu provided for any morph after a certain input gesture is detected, which is usually a CTRL+Any mouse click.'
+ 		type: #Boolean>
+ 	^ MetaMenuForAll ifNil: [true]!

Item was added:
+ ----- Method: Morph class>>metaMenuForAll: (in category 'preferences') -----
+ metaMenuForAll: aBoolean
+ 
+ 	MetaMenuForAll := aBoolean.!

Item was changed:
  ----- Method: Morph>>addYellowButtonMenuItemsTo:event: (in category 'menu') -----
  addYellowButtonMenuItemsTo: aMenu event: evt 
  	"Populate aMenu with appropriate menu items for a  
  	yellow-button (context menu) click."
  	aMenu defaultTarget: self.
  	""
  	Preferences noviceMode
  		ifFalse: [aMenu addStayUpItem].
  	""
  	self addModelYellowButtonItemsTo: aMenu event: evt.
  	""
  	Preferences generalizedYellowButtonMenu
  		ifFalse: [^ self].
  	""
+ 	aMenu addLine.
+ 	aMenu add: 'inspect' translated action: #inspect.
- 	Preferences cmdGesturesEnabled
- 		ifTrue: [""
- 			aMenu addLine.
- 			aMenu add: 'inspect' translated action: #inspect].
  	""
  	aMenu addLine.
  	self world selectedObject == self
  		ifTrue: [aMenu add: 'deselect' translated action: #removeHalo]
  		ifFalse: [aMenu add: 'select' translated action: #addHalo].
  	""
  	(self isWorldMorph
  			or: [self mustBeBackmost
  			or: [self wantsToBeTopmost]])
  		ifFalse: [""
  			aMenu addLine.
  			aMenu add: 'send to back' translated action: #goBehind.
  			aMenu add: 'bring to front' translated action: #comeToFront.
  			self addEmbeddingMenuItemsTo: aMenu hand: evt hand].
  	""
  	self isWorldMorph
  		ifFalse: [""
  	Smalltalk
  		at: #NCAAConnectorMorph
  		ifPresent: [:connectorClass | 
  			aMenu addLine.
  			aMenu add: 'connect to' translated action: #startWiring.
  			aMenu addLine].
  	""
  
  			self isFullOnScreen
  				ifFalse: [aMenu add: 'move onscreen' translated action: #goHome]].
  	""
  	Preferences noviceMode
  		ifFalse: [""
  			self addLayoutMenuItems: aMenu hand: evt hand.
  			(owner notNil
  					and: [owner isTextMorph])
  				ifTrue: [self addTextAnchorMenuItems: aMenu hand: evt hand]].
  	""
  	self isWorldMorph
  		ifFalse: [""
  			aMenu addLine.
  			self addToggleItemsToHaloMenu: aMenu].
  	""
  	aMenu addLine.
  	self isWorldMorph
  		ifFalse: [aMenu add: 'copy to paste buffer' translated action: #copyToPasteBuffer:].
  	(self allStringsAfter: nil) isEmpty
  		ifFalse: [aMenu add: 'copy text' translated action: #clipText].
  	""
  	self addExportMenuItems: aMenu hand: evt hand.
  	""
  	(Preferences noviceMode not
  			and: [self isWorldMorph not])
  		ifTrue: [""
  			aMenu addLine.
  			aMenu add: 'adhere to edge...' translated action: #adhereToEdge].
  	""
  	self addCustomMenuItems: aMenu hand: evt hand!

Item was changed:
  ----- Method: PasteUpMorph>>tryInvokeHalo: (in category 'events-processing') -----
  tryInvokeHalo: anEvent
  
  	| innerMost target |
  	anEvent hand halo ifNotNil: [^ self "No invocation needed. Halo will handle transfer itself."].
  	Preferences noviceMode ifTrue: [^ self "No halo in novice mode."].
+ 	Morph haloForAll ifFalse: [^ self].
- 	Preferences cmdGesturesEnabled ifFalse: [^ self].
  	
  	innerMost := (self morphsAt: anEvent position unlocked: true) first.
  	
  	"1) Try to use innermost morph but skip all the ones that do not want to show a halo along the owner chain."
  	target := innerMost.
  	[target isNil or: [target wantsHaloFromClick]]
  		whileFalse: [target := target owner].
  	target ifNil: [^ self].
  	
  	"2) Without a modifier, which is normal, find the outermost container for that inner morph."
  	(innerMost == self or: [anEvent shiftPressed]) ifFalse: [
  		| previousTargets |
  		previousTargets := OrderedCollection new.
  		[target notNil and: [target owner ~~ self]] whileTrue: [
  			previousTargets add: target.
  			target := target owner].
  		target ifNil: [^ self].
  		[previousTargets isEmpty or: [target wantsHaloFromClick]] whileFalse: [
  			target := previousTargets removeLast].
  		target wantsHaloFromClick ifFalse: [^ self]].
  		
  	"3) Now that we have the target, show the halo. Abort event dispatching, too, to avoid confusion."
  	anEvent hand newMouseFocus: target event: anEvent.
  	target invokeHaloOrMove: anEvent.
  	anEvent ignore.!

Item was changed:
  ----- Method: PasteUpMorph>>tryInvokeMetaMenu: (in category 'events-processing') -----
  tryInvokeMetaMenu: anEvent
  
  	| innerMost target |
+ 	Morph metaMenuForAll ifFalse: [^ self].
- 	Preferences cmdGesturesEnabled ifFalse: [^ self].
  	Preferences eToyFriendly ifTrue: [^ self].
  	
  	innerMost := (self morphsAt: anEvent position unlocked: true) first.
  	
  	"Traverse the owner chain if some morph does not want to show its meta menu."
  	target := innerMost.
  	[target isNil or: [target wantsMetaMenu]] whileFalse: [target := target owner].
  	target ifNil: [^ self].
  	
  	target invokeMetaMenu: anEvent.
  	anEvent ignore.!



More information about the Packages mailing list