[squeak-dev] The Trunk: Morphic-ct.1944.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 25 18:55:46 UTC 2022


Christoph Thiede uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ct.1944.mcz

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

Name: Morphic-ct.1944
Author: ct
Time: 25 March 2022, 7:54:29.184407 pm
UUID: 39f69026-43a3-134b-a6d6-79b127ac54de
Ancestors: Morphic-ct.1943

Merges backupAndHideDropShadows.5.cs (hide drop shadows of morphs during halo manipulation).

	This changeset hides the drop shadow of any morph while it is being dragged, scaled/resized, or rotated via halos. We already do this for bordered morphs while resizing them via grips (see CornerGripMorph>>mouseDown:) for performance reasons, and this changeset generalizes and reuses the same mechanism for any interaction via halo, too. Furthermore, when resizing an inactive window via the grips, shadows are now hidden reliably.
	[...]
	In particular, this changeset restores the old and previously unsent Etoys hooks for 'halo notifications' (#aboutToBeGrownViaHalo et al.) and integrates them into Morphic-Kernel.

See: http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-February/219319.html

=============== Diff against Morphic-ct.1943 ===============

Item was added:
+ ----- Method: CornerGripMorph>>backupAndHideTargetDropShadows (in category 'private') -----
+ backupAndHideTargetDropShadows
+ 
+ 	self target fastFramingOn ifFalse: [
+ 		self setProperty: #targetHadDropShadow toValue: target hasDropShadow.
+ 		self target hasDropShadow: false].!

Item was changed:
  ----- Method: CornerGripMorph>>mouseDown: (in category 'event handling') -----
  mouseDown: anEvent 
  	"Disable drop shadow to improve performance while resizing."
  
  	super mouseDown: anEvent.
  
  	self target ifNil: [^ self].
+ 	self backupAndHideTargetDropShadows.!
- 	self target fastFramingOn ifFalse: [
- 		self setProperty: #targetHadDropShadow toValue: target hasDropShadow.
- 		self target hasDropShadow: false].!

Item was changed:
  ----- Method: CornerGripMorph>>mouseMove: (in category 'event handling') -----
  mouseMove: anEvent 
  	
  	| delta |
  	self target ifNil: [^ self].
+ 	(self hasProperty: #targetHadDropShadow) ifFalse: [
+ 		"When dragging resizing an inactive system window, the shadow will be added after sending #mouseDown: on the receiver by the event filter on SystemWindow. Take a second chance to remove the expensive drop shadow temporarily."
+ 		self backupAndHideTargetDropShadows].
  	self target fastFramingOn 
  		ifTrue: [delta := self target doFastWindowReframe: self ptName] 
  		ifFalse: [
  			delta := anEvent position - (self referencePoint + self position).
  			self apply: delta.
  			self bounds: (self bounds origin + delta extent: self bounds extent)].!

Item was changed:
  ----- Method: CornerGripMorph>>mouseUp: (in category 'event handling') -----
  mouseUp: anEvent 
  	"Restore target drop shadow if there was one. See #mouseDown:."
  	
  	self target ifNil: [^ self].
  	self target fastFramingOn ifFalse: [
+ 		((self removeProperty: #targetHadDropShadow) ifNil: [false])
+ 			ifTrue: [self target hasDropShadow: true]].!
- 		(self valueOfProperty: #targetHadDropShadow ifAbsent: [false]) ifTrue: [self target hasDropShadow: true].
- 		self removeProperty: #targetHadDropShadow].!

Item was added:
+ ----- Method: HaloMorph>>backupAndHideTargetDropShadows (in category 'private') -----
+ backupAndHideTargetDropShadows
+ 
+ 	self setProperty: #targetHadDropShadow toValue: target hasDropShadow.
+ 	self target hasDropShadow: false.!

Item was changed:
  ----- Method: HaloMorph>>endInteraction: (in category 'private') -----
  endInteraction: event
  	"Clean up after a user interaction with the a halo control"
  
  	| m |
  	self isMagicHalo: false.	"no longer"
  	self magicAlpha: 1.0.
  	(target isInWorld not or: [owner isNil]) ifTrue: [^self].
  	[target isFlexMorph and: [target hasNoScaleOrRotation]] whileTrue: 
  			[m := target firstSubmorph.
  			target removeFlexShell.
  			target := m].
+ 	self restoreTargetDropShadows.
+ 	target changedViaHalo: self.
  	self isInWorld 
  		ifTrue: 
  			["make sure handles show in front, even if flex shell added"
  			self flag: #tofix. "mt: Try to avoid deleting and re-creating an event handler (here: the handle) while handling the event."
  			self comeToFront.
  			self addHandles.
  			event hand newMouseFocus: self].
  	(self valueOfProperty: #commandInProgress) ifNotNil: 
  			[:cmd | 
  			self rememberCommand: cmd.
  			self removeProperty: #commandInProgress].!

Item was added:
+ ----- Method: HaloMorph>>handleMouseUp: (in category 'events') -----
+ handleMouseUp: evt
+ 
+ 	super handleMouseUp: evt.
+ 	
+ 	self restoreTargetDropShadows.
+ 	target changedViaHalo: self.!

Item was added:
+ ----- Method: HaloMorph>>restoreTargetDropShadows (in category 'private') -----
+ restoreTargetDropShadows
+ 
+ 	((self removeProperty: #targetHadDropShadow) ifNil: [false])
+ 		ifTrue: [self target hasDropShadow: true].!

Item was changed:
  ----- Method: HaloMorph>>startDrag:with: (in category 'private') -----
  startDrag: evt with: dragHandle
  	"Drag my target without removing it from its owner."
  
  	| itsOwner |
  	self obtainHaloForEvent: evt andRemoveAllHandlesBut: dragHandle.
+ 	target aboutToBeDraggedViaHalo.
+ 	
  	positionOffset := dragHandle center - (target point: target position in: owner).
  
  	 ((itsOwner := target topRendererOrSelf owner) notNil and:
  			[itsOwner automaticViewing]) ifTrue:
  				[target openViewerForArgument]!

Item was changed:
  ----- Method: HaloMorph>>startGrow:with: (in category 'private') -----
  startGrow: evt with: growHandle
  	"Initialize resizing of my target.  Launch a command representing it, to support Undo"
  
  	| botRt |
  	self obtainHaloForEvent: evt andRemoveAllHandlesBut: growHandle.
+ 	self backupAndHideTargetDropShadows.
+ 	target aboutToBeGrownViaHalo.
+ 	
  	botRt := target point: target bottomRight in: owner.
  	positionOffset := (self world viewBox containsPoint: botRt)
  		ifTrue: [evt cursorPoint - botRt]
  		ifFalse: [0 at 0].
  
  	self setProperty: #commandInProgress toValue:
  		(Command new
  			cmdWording: ('resize ' translated, target nameForUndoWording);
  			undoTarget: target renderedMorph selector: #setFlexExtentFromHalo: argument: target extent).
  
  	originalExtent := target extent!

Item was changed:
  ----- Method: HaloMorph>>startResizeTarget: (in category 'dragging or resizing') -----
  startResizeTarget: event
  	"Begin resizing the target"
  	growingOrRotating := true.
  	positionOffset := event position.
+ 	self backupAndHideTargetDropShadows.
+ 	target aboutToBeScaledViaHalo.
+ 	
  	originalExtent := target extent.
  	self removeAllHandlesBut: nil.
  	event hand newMouseFocus: self.
  	event hand addMouseListener: self. "add handles back on mouse-up"!

Item was changed:
  ----- Method: HaloMorph>>startRot:with: (in category 'private') -----
  startRot: evt with: rotHandle
  	"Initialize rotation of my target if it is rotatable.  Launch a command object to represent the action"
  
  	self obtainHaloForEvent: evt andRemoveAllHandlesBut: rotHandle.
+ 	self backupAndHideTargetDropShadows.
+ 	target aboutToBeRotatedViaHalo.
  	target isFlexMorph ifFalse: 
  		[target isInWorld ifFalse: [self setTarget: target player costume].
  		target addFlexShellIfNecessary].
  	growingOrRotating := true.
  
  	self removeAllHandlesBut: rotHandle.  "remove all other handles"
  	angleOffset := evt cursorPoint - (target pointInWorld: target referencePosition).
  	angleOffset := Point
  			r: angleOffset r
  			degrees: angleOffset degrees - target rotationDegrees.
  	self setProperty: #commandInProgress toValue:
  		(Command new
  			cmdWording: ('rotate ' translated, target nameForUndoWording);
  			undoTarget: target renderedMorph selector: #heading: argument: target rotationDegrees)
  
  !

Item was changed:
  ----- Method: HaloMorph>>startScale:with: (in category 'private') -----
  startScale: evt with: scaleHandle
  	"Initialize scaling of my target."
  
  	self obtainHaloForEvent: evt andRemoveAllHandlesBut: scaleHandle.
+ 	self backupAndHideTargetDropShadows.
+ 	target aboutToBeScaledViaHalo.
  	target isFlexMorph ifFalse: [target addFlexShellIfNecessary].
  	growingOrRotating := true.
  	positionOffset := 0 at 0.
  
  	self setProperty: #commandInProgress toValue:
  		(Command new
  			cmdWording: ('resize ' translated, target nameForUndoWording);
  			undoTarget: target renderedMorph selector: #setFlexExtentFromHalo: argument: target extent).
  	originalExtent := target extent
  !

Item was added:
+ ----- Method: Morph>>aboutToBeDraggedViaHalo (in category 'halo notification') -----
+ aboutToBeDraggedViaHalo
+ 	"The receiver is about to be dragged via the halo."!

Item was added:
+ ----- Method: Morph>>aboutToBeGrownViaHalo (in category 'halo notification') -----
+ aboutToBeGrownViaHalo
+ 	"The receiver is about to be grown via the halo."!

Item was added:
+ ----- Method: Morph>>aboutToBeRotatedViaHalo (in category 'halo notification') -----
+ aboutToBeRotatedViaHalo
+ 	"The receiver is about to be rotated via the halo."!

Item was added:
+ ----- Method: Morph>>aboutToBeScaledViaHalo (in category 'halo notification') -----
+ aboutToBeScaledViaHalo
+ 	"The receiver is about to be scaled via the halo."!

Item was added:
+ ----- Method: Morph>>changedViaHalo: (in category 'halo notification') -----
+ changedViaHalo: halo
+ 	"The receiver has been manipulated from a halo in an operation that has completed now."!

Item was changed:
  ----- Method: SystemWindow>>justDroppedInto:event: (in category 'geometry') -----
  justDroppedInto: aMorph event: anEvent
  
  	isCollapsed
  		ifTrue: [self position: ((self position max: 0 at 0) grid: 8 at 8).
  				collapsedFrame := self bounds]
  		ifFalse: [fullFrame := self bounds].
  
  	self beKeyWindow.
  	self hasDropShadow: Preferences menuAppearance3d. "See #startDragFromLabel:."
  			
  	aMorph == self world ifTrue: [self assureLabelAreaVisible].
  
  	(Project uiManager openToolsAttachedToMouseCursor and: (self hasProperty: #initialDrop))
  		ifTrue: [
  			self removeProperty: #initialDrop.
  			(self submorphs detect: [:m | m isKindOf: BottomRightGripMorph] ifNone: [])
  				ifNotNil: [:grip | 
  					grip
  						referencePoint: anEvent position - grip position;
+ 						backupAndHideTargetDropShadows. "See MorphicToolBuilder >> #open:"
+ 					self lookFocused.
+ 					anEvent hand newMouseFocus: grip]].
- 						setProperty: #targetHadDropShadow toValue: true "See MorphicToolBuilder >> #open:".
- 					self
- 						hasDropShadow: false;
- 						lookFocused.
- 					anEvent hand newMouseFocus: grip.]].
  			
  	^super justDroppedInto: aMorph event: anEvent!



More information about the Squeak-dev mailing list