The Trunk: Morphic-eem.1734.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-eem.1734.mcz

commits-2
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1734.mcz

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

Name: Morphic-eem.1734
Author: eem
Time: 4 March 2021, 10:26:06.868233 am
UUID: 065775fd-9942-4e59-99b9-0e9378c0590e
Ancestors: Morphic-mt.1733

DropEvent cleanup related to Files-eem.187.

=============== Diff against Morphic-mt.1733 ===============

Item was removed:
- ----- Method: HandMorph>>collectDropFilesAndDirectories: (in category 'private events') -----
- collectDropFilesAndDirectories: numFiles
-
- ^ (1 to: numFiles) collect: [:index |
- (FileDirectory requestDropDirectory: index)
- ifNil: [FileStream requestDropStream: index]]!

Item was changed:
  ----- Method: HandMorph>>generateDropFilesEvent: (in category 'private events') -----
  generateDropFilesEvent: evtBuf
  "Generate the appropriate mouse event for the given raw event buffer."
 
  | position buttons modifiers stamp numFiles dragType |
  stamp := evtBuf second.
  stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
  dragType := evtBuf third.
  position := evtBuf fourth @ evtBuf fifth.
  buttons := MouseEvent redButton. "hacked because necessary for correct mouseMoveDragging handling"
  modifiers := evtBuf sixth.
  buttons := buttons bitOr: (modifiers bitShift: 3).
  numFiles := evtBuf seventh.
 
  dragType caseOf: {
  [1] -> [ "dragEnter"
  externalDropMorph := TransferMorph new
  dragTransferType: #filesAndDirectories;
  source: self;
  passenger: (numFiles = 0 "Usually, numFiles and drop paths are delivered on dragDrop only. Still reserving this possibility for able host implementations."
  ifTrue: [self flag: #vmCapabilityMissing. 'Unknown host content' translated]
+ ifFalse: [FileDirectory dropFilesAndDirectories: numFiles]);
- ifFalse: [self collectDropFilesAndDirectories: numFiles]);
  yourself.
 
  "During the drag operation, the host system is responsible for displaying the cursor."
  self grabMorph: externalDropMorph.
  self showTemporaryCursor: Cursor blank.
  externalDropMorph bottomRight: self topLeft. "Southeast area of the cursor is blocked by drawings from the source application. Display our drop morph at the opposite corner of the cursor." ].
  [2] -> [ "dragMove"
  ^ MouseMoveEvent new
  setType: #mouseMove
  startPoint: self position
  endPoint: position
  trail: "{self position. position}"(self mouseDragTrailFrom: evtBuf)
  buttons: buttons
  hand: self
  stamp: stamp ].
  [3]  -> [ "dragLeave"
  externalDropMorph ifNotNil: #abandon.
  externalDropMorph := nil.
  self showTemporaryCursor: nil ].
  [4] -> [ "dragDrop"
  | oldButtons |
  externalDropMorph ifNil: [
  "dragDrop has been sent without prior dragging. This happens when the VM is configured as singleton application and has been called again (aka #launchDrop)."
  ^ self error: 'Launch drop for singleton Squeak not yet implemented.'].
 
  self showTemporaryCursor: nil.
  externalDropMorph passenger isString ifTrue: [
  self flag: #vmCapabilityMissing. "See above."
+ externalDropMorph passenger: (FileDirectory dropFilesAndDirectories: numFiles)].
- externalDropMorph passenger: (self collectDropFilesAndDirectories: numFiles)].
  externalDropMorph := nil.
 
  (Smalltalk classNamed: #DropFilesEvent) ifNotNil: [:eventClass |
  | classicEvent |
  "Generate classic DropFilesEvent, providing backward compatibility."
  classicEvent := eventClass new
  setPosition: position
  contents: numFiles
  hand: self.
  self processEvent: classicEvent.
  classicEvent wasHandled ifTrue: [^ nil]].
 
  oldButtons := lastEventBuffer fifth
  bitOr: (lastEventBuffer sixth bitShift: 3).
  ^ MouseButtonEvent new
  setType: #mouseUp
  position: position
  which: (oldButtons bitXor: buttons)
  buttons: buttons
  nClicks: 0
  hand: self
  stamp: stamp ].
  [5] -> [ "drag request"
  "For dnd out. Not properly implemented at the moment."
  self shouldBeImplemented] }.
  ^ nil!