--- a/XWorkstat.st Fri Apr 04 22:13:37 1997 +0200
+++ b/XWorkstat.st Sat Apr 05 01:34:10 1997 +0200
@@ -3365,7 +3365,7 @@
dndMessage:event data:data view:targetView
"handle a DND drag&drop protocol message"
- |sensor dropType dropValue names i1 i2|
+ |sensor dropType dropValue names i1 i2 t dropObject|
dropType := data doubleWordAt:1.
@@ -3380,32 +3380,45 @@
DndLink
DndExe
) at:dropType+1 ifAbsent:#DndNotDnd.
-Transcript showCR:dropType.
self
getProperty:(self atomIDOf:'DndSelection')
from:rootId
into:[:type :value |
+ t := type.
dropValue := value
].
+ t ~~ (self atomIDOfSTRING) ifTrue:[
+'oops - expected a string propertyValue in drop' printCR.
+ ].
+
dropType == #DndFiles ifTrue:[
"/ actually, a list of fileNames
names := OrderedCollection new.
i1 := 1.
[i1 ~~ 0] whileTrue:[
- dropValue inspect.
i2 := dropValue indexOf:(Character value:0) startingAt:i1.
i2 ~~ 0 ifTrue:[
- names add:(dropValue copyFrom:i2 to:(i2-1)).
+ names add:(dropValue copyFrom:i1 to:(i2-1)).
i1 := i2 + 1.
] ifFalse:[
i1 := i2
].
].
dropValue := names.
+ dropObject := dropValue collect:[:nm | DropObject newFile:(nm asFilename)].
+ ] ifFalse:[
+ ((dropType == #DndFile) or:[dropType == #DndDir]) ifTrue:[
+ dropObject := DropObject newFile:(dropValue asFilename).
+ ] ifFalse:[
+ dropObject := DropObject new:dropValue.
+ ]
].
+ "/ convert to dropObject(s)
+
+
(sensor := targetView sensor) notNil ifTrue:[
sensor dropMessage:dropType data:dropValue view:targetView
] ifFalse:[
@@ -3415,7 +3428,7 @@
]
"Created: 4.4.1997 / 17:59:37 / cg"
- "Modified: 4.4.1997 / 18:46:54 / cg"
+ "Modified: 5.4.1997 / 01:32:29 / cg"
!
gravityNotifyView:aView
@@ -8827,6 +8840,6 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.226 1997-04-04 16:53:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.227 1997-04-04 23:34:10 cg Exp $'
! !
XWorkstation initialize!
--- a/XWorkstation.st Fri Apr 04 22:13:37 1997 +0200
+++ b/XWorkstation.st Sat Apr 05 01:34:10 1997 +0200
@@ -3365,7 +3365,7 @@
dndMessage:event data:data view:targetView
"handle a DND drag&drop protocol message"
- |sensor dropType dropValue names i1 i2|
+ |sensor dropType dropValue names i1 i2 t dropObject|
dropType := data doubleWordAt:1.
@@ -3380,32 +3380,45 @@
DndLink
DndExe
) at:dropType+1 ifAbsent:#DndNotDnd.
-Transcript showCR:dropType.
self
getProperty:(self atomIDOf:'DndSelection')
from:rootId
into:[:type :value |
+ t := type.
dropValue := value
].
+ t ~~ (self atomIDOfSTRING) ifTrue:[
+'oops - expected a string propertyValue in drop' printCR.
+ ].
+
dropType == #DndFiles ifTrue:[
"/ actually, a list of fileNames
names := OrderedCollection new.
i1 := 1.
[i1 ~~ 0] whileTrue:[
- dropValue inspect.
i2 := dropValue indexOf:(Character value:0) startingAt:i1.
i2 ~~ 0 ifTrue:[
- names add:(dropValue copyFrom:i2 to:(i2-1)).
+ names add:(dropValue copyFrom:i1 to:(i2-1)).
i1 := i2 + 1.
] ifFalse:[
i1 := i2
].
].
dropValue := names.
+ dropObject := dropValue collect:[:nm | DropObject newFile:(nm asFilename)].
+ ] ifFalse:[
+ ((dropType == #DndFile) or:[dropType == #DndDir]) ifTrue:[
+ dropObject := DropObject newFile:(dropValue asFilename).
+ ] ifFalse:[
+ dropObject := DropObject new:dropValue.
+ ]
].
+ "/ convert to dropObject(s)
+
+
(sensor := targetView sensor) notNil ifTrue:[
sensor dropMessage:dropType data:dropValue view:targetView
] ifFalse:[
@@ -3415,7 +3428,7 @@
]
"Created: 4.4.1997 / 17:59:37 / cg"
- "Modified: 4.4.1997 / 18:46:54 / cg"
+ "Modified: 5.4.1997 / 01:32:29 / cg"
!
gravityNotifyView:aView
@@ -8827,6 +8840,6 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.226 1997-04-04 16:53:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.227 1997-04-04 23:34:10 cg Exp $'
! !
XWorkstation initialize!