added: #setPrimarySelection
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 17 Apr 2012 21:04:16 +0200
changeset 4419 a7436b36c0a0
parent 4418 fe4542d78ad8
child 4420 8f0164295ef8
added: #setPrimarySelection changed:7 methods
TextView.st
--- a/TextView.st	Tue Apr 17 12:33:45 2012 +0200
+++ b/TextView.st	Tue Apr 17 21:04:16 2012 +0200
@@ -1610,6 +1610,7 @@
     ].
 
     self validateNewSelection.
+    self setPrimarySelection.
     self selectionChanged.
 
     "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
@@ -1647,6 +1648,7 @@
     clickCol := movedCol
 
     "Modified: / 05-04-2011 / 17:13:35 / cg"
+    "Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 keyPress:key x:x y:y
@@ -4057,12 +4059,14 @@
 "/        self redrawLine:l. 
 "/        self redrawLine:l+1.
         self validateNewSelection.
+        self setPrimarySelection.
         self redrawFromLine:l to:l+1.
         self makeSelectionVisible.
     ].
 
-    "Created: 1.3.1996 / 23:35:08 / cg"
-    "Modified: 18.3.1996 / 17:18:15 / cg"
+    "Created: / 01-03-1996 / 23:35:08 / cg"
+    "Modified: / 18-03-1996 / 17:18:15 / cg"
+    "Modified: / 17-04-2012 / 21:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 expandSelectionLeft
@@ -4093,11 +4097,13 @@
             c1 := 1
         ].
         self validateNewSelection.
+        self setPrimarySelection.
         self redrawLine:l from:c1 to:c2. 
         self makeSelectionVisible.
     ].
 
-    "Modified: 18.3.1996 / 17:05:46 / cg"
+    "Modified: / 18-03-1996 / 17:05:46 / cg"
+    "Modified: / 17-04-2012 / 21:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 expandSelectionRight
@@ -4123,12 +4129,14 @@
         ].
 
         self validateNewSelection.
+        self setPrimarySelection.
         self redrawLine:l from:c to:c+1.
         self makeSelectionVisible.
     ].
 
-    "Created: 1.3.1996 / 23:33:17 / cg"
-    "Modified: 6.3.1996 / 13:54:10 / cg"
+    "Created: / 01-03-1996 / 23:33:17 / cg"
+    "Modified: / 06-03-1996 / 13:54:10 / cg"
+    "Modified: / 17-04-2012 / 21:01:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 expandSelectionUp
@@ -4156,13 +4164,15 @@
             ].
         ].
         self validateNewSelection.
+        self setPrimarySelection.
         "/ self redrawLine:l. 
         "/ self redrawLine:l+1. 
         self redrawFromLine:l to:l+1.
         self makeSelectionVisible.
     ].
 
-    "Modified: 6.3.1996 / 14:12:06 / cg"
+    "Modified: / 06-03-1996 / 14:12:06 / cg"
+    "Modified: / 17-04-2012 / 21:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 hasSelection
@@ -4283,6 +4293,7 @@
         selectionEndLine := endLine.
         selectionEndCol := endCol.
         self validateNewSelection.
+        self setPrimarySelection.
 
         (selectionStartLine == selectionEndLine) ifTrue:[
             self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
@@ -4306,7 +4317,8 @@
      v selectFromLine:2 col:2 toLine:10 col:15
     "
 
-    "Modified: 2.1.1997 / 13:32:25 / cg"
+    "Modified: / 02-01-1997 / 13:32:25 / cg"
+    "Modified: / 17-04-2012 / 21:00:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectFromLine:startLine toLine:endLine
@@ -4427,6 +4439,8 @@
 
 selectionChanged
     "can be redefined for notification or special actions"
+
+    "Modified: / 17-04-2012 / 20:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectionEndCol
@@ -4445,6 +4459,18 @@
     ^ selectionStartLine
 !
 
+setPrimarySelection
+    "can be redefined for notification or special actions"
+
+    device notNil ifTrue:[
+        "On X11, be nice and set the PRIMARY selection.
+         (#setPrimaryText:ownerView: is void in DeviceWorkstation)"
+        device setPrimaryText: self selectionAsString ownerView: self.
+    ].
+
+    "Created: / 17-04-2012 / 20:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 st80SelectMode
     st80SelectMode notNil ifTrue:[^ st80SelectMode].
     ^ self class st80SelectMode
@@ -4526,11 +4552,11 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.334 2012-03-23 13:03:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.335 2012-04-17 19:04:16 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.334 2012-03-23 13:03:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.335 2012-04-17 19:04:16 vrany Exp $'
 ! !
 
 TextView initialize!