lifted mkeyboardMacro handling from Workspace to EditTextView
authorClaus Gittinger <cg@exept.de>
Tue, 02 Oct 2001 18:30:08 +0200
changeset 2416 56acdd9e31b5
parent 2415 188fc1577a8d
child 2417 c23c7c09c2a9
lifted mkeyboardMacro handling from Workspace to EditTextView
EditTextView.st
--- a/EditTextView.st	Fri Sep 28 16:29:31 2001 +0200
+++ b/EditTextView.st	Tue Oct 02 18:30:08 2001 +0200
@@ -3234,11 +3234,26 @@
                           #'F*' #'f*')>
 
     |sensor n fKeyMacros shifted i
-     selStartLine selEndLine selStartCol selEndCol sel event|
+     selStartLine selEndLine selStartCol selEndCol sel event cmdMacro|
 
     event := WindowGroup lastEventQuerySignal query.
     shifted := event hasShift.
 
+    cmdMacro := UserPreferences current functionKeySequences at:key ifAbsent:nil.
+    cmdMacro notNil ifTrue:[
+        AbortSignal handle:[:ex |
+            self warn:'error occurred in keyboard macro'.
+            ex return.
+        ] do:[
+            Parser 
+                evaluate:cmdMacro asString
+                receiver:self
+                notifying:nil
+                compile:false.
+        ].
+        ^ self
+    ].
+
     (key == #BackSpace
      or:[key == #BasicBackspace]) ifTrue:[
         selectionStartLine notNil ifTrue:[
@@ -4013,10 +4028,8 @@
                         ('Again (for all)'      multipleAgain)  
                   ).
     ] ifFalse:[
-        undoAction notNil ifTrue:[
-        ].
-
         items := #(
+                        ('Undo'    undo                    )
                         ('Again'   again            Again  )
                         ('-'                               )
                         ('Copy'    copySelection    Copy   )
@@ -4027,12 +4040,6 @@
                         ('='                               )
                         ('Others'  others                  )
                   ).
-        undoAction notNil ifTrue:[
-            items := #(
-                        ('Undo'     undo                   )
-                      ) , items
-        ].
-
     ].
 
     m := PopUpMenu itemList:items resources:resources.
@@ -4063,7 +4070,7 @@
     self hasSelectionForCopy not ifTrue:[
         m disable:#copySelection.
     ].
-    self hasSelection not ifTrue:[
+    self hasSelection ifFalse:[
         m disable:#cut.
     ].
     (undoAction isNil) ifTrue:[
@@ -4967,5 +4974,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.253 2001-09-24 08:04:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.254 2001-10-02 16:30:08 cg Exp $'
 ! !