most clipBoard stuff moved to the device
authorClaus Gittinger <cg@exept.de>
Thu, 13 Feb 1997 13:46:51 +0100
changeset 1342 d2bcd2e582aa
parent 1341 026bdf39f4ea
child 1343 6399da90054b
most clipBoard stuff moved to the device (thats where it belongs to ...)
DSurface.st
DisplaySurface.st
--- a/DSurface.st	Thu Feb 13 13:44:40 1997 +0100
+++ b/DSurface.st	Thu Feb 13 13:46:51 1997 +0100
@@ -1547,7 +1547,7 @@
 
 getSelection
     "return the object selection - either the local one, or the displays
-     selection buffer."
+     clipBoard buffer."
 
     |sel|
 
@@ -1558,12 +1558,12 @@
     ].
     ^ sel
 
-    "Modified: 12.12.1996 / 14:08:48 / cg"
+    "Modified: 13.2.1997 / 13:18:50 / cg"
 !
 
 getTextSelection
     "return the text selection - either the local one, or the displays
-     selection buffer."
+     clipBoard buffer."
 
     |sel|
 
@@ -1574,158 +1574,36 @@
     ].
     ^ sel
 
-    "Modified: 12.12.1996 / 14:08:52 / cg"
+    "Modified: 13.2.1997 / 13:19:26 / cg"
 !
 
-selectionAsString
-    "our current selection as a string"
-
-    |o s|
-
-    o := device getCopyBuffer.
-    s := o.
-    o isString ifFalse:[
-        o isNil ifTrue:[
-            s := ''
-        ] ifFalse:[
-            (o isKindOf:StringCollection) ifTrue:[
-                s := o asStringWithCRsFrom:1 to:(o size) compressTabs:false withCR:false.
-                s := s string.
-            ] ifFalse:[
-                o isString ifTrue:[
-                    s := o string
-                ] ifFalse:[
-                    s := o storeString
-                ]
-            ]
-        ]
-    ].
-    ^ s
-
-    "Modified: 12.12.1996 / 14:08:55 / cg"
-!
-
-selectionClear:selectionID
-    "someone else has the selection"
-
-    "
-     workaround a bug in olvwm: it clears selections
-     on window raise. In this case, keep my last own selection
-    "
-
-    device setLastCopyBuffer:(device getCopyBuffer).
-    device setCopyBuffer:nil
-
-    "Modified: 12.12.1996 / 14:09:01 / cg"
-!
-
-selectionNotify:propertyID target:targetID selection:selectionID from:windowID
+pasteFromClipBoard:aString
     "this is sent from the display as a reply to a request for a
      selection. The view should be prepared to paste the received
      string (it asked for it so that should not be a problem)"
 
-    |s|
-
-    "workaround a bug in olvwm:
-     it looses selection when bringing a view
-     up front
-    "
-    propertyID == 0 ifTrue:[
-        "invalid olvwm behavior"
-        s := device getLastCopyBuffer
-    ] ifFalse:[
-        targetID == (device atomIDOfSTRING) ifTrue:[
-            "
-             a returned string
-            "
-            s := device getTextProperty:propertyID from:windowID.
-            s notNil ifTrue:[
-                (s endsWith:Character cr) ifTrue:[
-                    s := s asStringCollection copyWith:''
-                ]
-            ]
-        ] ifFalse:[
-            "
-             a returned object
-            "
-            s := device getObjectProperty:propertyID from:windowID.
-        ].
-    ].
-    s notNil ifTrue:[
-        self paste:s
-    ]
-
-    "Modified: 12.12.1996 / 14:09:06 / cg"
-!
-
-selectionRequest:propertyID target:targetID selection:selectionID from:windowID
-    "someone asks for our selection"
-
-    |o s stream|
+    self paste:aString
 
-    "
-     the code below has been hacked in a hurry -
-     it MUST go into the XWorkstation class,
-     since PseudoV should stay independend of any particular
-     implementation (i.e. indep. of the display device)
-     Expect this stuff to vanish in the next version ...
-    "
-    targetID == (device atomIDOfLENGTH) ifTrue:[
-        "the other one wants to know the size of our selection ..."
-        s := self selectionAsString.
-        device
-            setLengthProperty:propertyID 
-            value:s size 
-            for:windowID.
-        device
-            sendSelectionNotifySelection:selectionID
-            property:propertyID
-            target:targetID
-            from:drawableId
-            to:windowID.
-        ^ self
-    ].
-    (targetID == device atomIDOfSTRING or:[
-     targetID == (device atomIDOf:'COMPOUND_TEXT')]) ifTrue:[
-        s := self selectionAsString.
-        device 
-            sendSelection:s 
-            property:propertyID 
-            target:targetID 
-            from:drawableId 
-            to:windowID.
-        ^ self
-    ].
-
-    o := device getCopyBuffer.
-    stream := WriteStream on:(ByteArray new:200).
-    o storeBinaryOn:stream.
-    device 
-        sendSelection:(stream contents) 
-        property:propertyID 
-        target:(device atomIDOf:'ST_OBJECT' create:true) 
-        from:drawableId 
-        to:windowID
-
-    "Modified: 12.12.1996 / 14:09:11 / cg"
+    "Created: 13.2.1997 / 13:06:11 / cg"
 !
 
 setSelection:something
     "set the object selection - both the local one, and tell the display
-     that we have changed it."
+     that we have changed it (i.e. place it into the clipBoard)."
 
     device setLastCopyBuffer:nil.
     device setCopyBuffer:something.
+
     (device setSelection:something owner:drawableId) ifFalse:[
         'DisplaySurface [warning]: selection failed' errorPrintCR
     ]
 
-    "Modified: 10.1.1997 / 17:48:34 / cg"
+    "Modified: 13.2.1997 / 13:19:51 / cg"
 !
 
 setTextSelection:something
     "set the text selection - both the local one, and tell the display
-     that we have changed it."
+     that we have changed it (i.e. place it into the clipBoard)."
 
     |s|
 
@@ -1739,7 +1617,7 @@
         'DisplaySurface [warning]: selection failed' errorPrintCR
     ]
 
-    "Modified: 10.1.1997 / 17:48:43 / cg"
+    "Modified: 13.2.1997 / 13:20:00 / cg"
 ! !
 
 !DisplaySurface methodsFor:'user notification'!
@@ -1765,5 +1643,5 @@
 !DisplaySurface class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/DSurface.st,v 1.24 1997-02-12 18:28:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/DSurface.st,v 1.25 1997-02-13 12:46:51 cg Exp $'
 ! !
--- a/DisplaySurface.st	Thu Feb 13 13:44:40 1997 +0100
+++ b/DisplaySurface.st	Thu Feb 13 13:46:51 1997 +0100
@@ -1547,7 +1547,7 @@
 
 getSelection
     "return the object selection - either the local one, or the displays
-     selection buffer."
+     clipBoard buffer."
 
     |sel|
 
@@ -1558,12 +1558,12 @@
     ].
     ^ sel
 
-    "Modified: 12.12.1996 / 14:08:48 / cg"
+    "Modified: 13.2.1997 / 13:18:50 / cg"
 !
 
 getTextSelection
     "return the text selection - either the local one, or the displays
-     selection buffer."
+     clipBoard buffer."
 
     |sel|
 
@@ -1574,158 +1574,36 @@
     ].
     ^ sel
 
-    "Modified: 12.12.1996 / 14:08:52 / cg"
+    "Modified: 13.2.1997 / 13:19:26 / cg"
 !
 
-selectionAsString
-    "our current selection as a string"
-
-    |o s|
-
-    o := device getCopyBuffer.
-    s := o.
-    o isString ifFalse:[
-        o isNil ifTrue:[
-            s := ''
-        ] ifFalse:[
-            (o isKindOf:StringCollection) ifTrue:[
-                s := o asStringWithCRsFrom:1 to:(o size) compressTabs:false withCR:false.
-                s := s string.
-            ] ifFalse:[
-                o isString ifTrue:[
-                    s := o string
-                ] ifFalse:[
-                    s := o storeString
-                ]
-            ]
-        ]
-    ].
-    ^ s
-
-    "Modified: 12.12.1996 / 14:08:55 / cg"
-!
-
-selectionClear:selectionID
-    "someone else has the selection"
-
-    "
-     workaround a bug in olvwm: it clears selections
-     on window raise. In this case, keep my last own selection
-    "
-
-    device setLastCopyBuffer:(device getCopyBuffer).
-    device setCopyBuffer:nil
-
-    "Modified: 12.12.1996 / 14:09:01 / cg"
-!
-
-selectionNotify:propertyID target:targetID selection:selectionID from:windowID
+pasteFromClipBoard:aString
     "this is sent from the display as a reply to a request for a
      selection. The view should be prepared to paste the received
      string (it asked for it so that should not be a problem)"
 
-    |s|
-
-    "workaround a bug in olvwm:
-     it looses selection when bringing a view
-     up front
-    "
-    propertyID == 0 ifTrue:[
-        "invalid olvwm behavior"
-        s := device getLastCopyBuffer
-    ] ifFalse:[
-        targetID == (device atomIDOfSTRING) ifTrue:[
-            "
-             a returned string
-            "
-            s := device getTextProperty:propertyID from:windowID.
-            s notNil ifTrue:[
-                (s endsWith:Character cr) ifTrue:[
-                    s := s asStringCollection copyWith:''
-                ]
-            ]
-        ] ifFalse:[
-            "
-             a returned object
-            "
-            s := device getObjectProperty:propertyID from:windowID.
-        ].
-    ].
-    s notNil ifTrue:[
-        self paste:s
-    ]
-
-    "Modified: 12.12.1996 / 14:09:06 / cg"
-!
-
-selectionRequest:propertyID target:targetID selection:selectionID from:windowID
-    "someone asks for our selection"
-
-    |o s stream|
+    self paste:aString
 
-    "
-     the code below has been hacked in a hurry -
-     it MUST go into the XWorkstation class,
-     since PseudoV should stay independend of any particular
-     implementation (i.e. indep. of the display device)
-     Expect this stuff to vanish in the next version ...
-    "
-    targetID == (device atomIDOfLENGTH) ifTrue:[
-        "the other one wants to know the size of our selection ..."
-        s := self selectionAsString.
-        device
-            setLengthProperty:propertyID 
-            value:s size 
-            for:windowID.
-        device
-            sendSelectionNotifySelection:selectionID
-            property:propertyID
-            target:targetID
-            from:drawableId
-            to:windowID.
-        ^ self
-    ].
-    (targetID == device atomIDOfSTRING or:[
-     targetID == (device atomIDOf:'COMPOUND_TEXT')]) ifTrue:[
-        s := self selectionAsString.
-        device 
-            sendSelection:s 
-            property:propertyID 
-            target:targetID 
-            from:drawableId 
-            to:windowID.
-        ^ self
-    ].
-
-    o := device getCopyBuffer.
-    stream := WriteStream on:(ByteArray new:200).
-    o storeBinaryOn:stream.
-    device 
-        sendSelection:(stream contents) 
-        property:propertyID 
-        target:(device atomIDOf:'ST_OBJECT' create:true) 
-        from:drawableId 
-        to:windowID
-
-    "Modified: 12.12.1996 / 14:09:11 / cg"
+    "Created: 13.2.1997 / 13:06:11 / cg"
 !
 
 setSelection:something
     "set the object selection - both the local one, and tell the display
-     that we have changed it."
+     that we have changed it (i.e. place it into the clipBoard)."
 
     device setLastCopyBuffer:nil.
     device setCopyBuffer:something.
+
     (device setSelection:something owner:drawableId) ifFalse:[
         'DisplaySurface [warning]: selection failed' errorPrintCR
     ]
 
-    "Modified: 10.1.1997 / 17:48:34 / cg"
+    "Modified: 13.2.1997 / 13:19:51 / cg"
 !
 
 setTextSelection:something
     "set the text selection - both the local one, and tell the display
-     that we have changed it."
+     that we have changed it (i.e. place it into the clipBoard)."
 
     |s|
 
@@ -1739,7 +1617,7 @@
         'DisplaySurface [warning]: selection failed' errorPrintCR
     ]
 
-    "Modified: 10.1.1997 / 17:48:43 / cg"
+    "Modified: 13.2.1997 / 13:20:00 / cg"
 ! !
 
 !DisplaySurface methodsFor:'user notification'!
@@ -1765,5 +1643,5 @@
 !DisplaySurface class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.24 1997-02-12 18:28:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.25 1997-02-13 12:46:51 cg Exp $'
 ! !