flash view in readonly mode, when modification is attempted.
authorClaus Gittinger <cg@exept.de>
Fri, 22 May 1998 13:52:44 +0200
changeset 1548 d4a3d61388dc
parent 1547 57b45c785615
child 1549 b64b2dd7d5df
flash view in readonly mode, when modification is attempted.
ETxtView.st
EditTextView.st
--- a/ETxtView.st	Thu May 21 15:58:01 1998 +0200
+++ b/ETxtView.st	Fri May 22 13:52:44 1998 +0200
@@ -2658,7 +2658,9 @@
     ].
 
     (key isMemberOf:Character) ifTrue:[
-        readOnly ifFalse:[
+        readOnly ifTrue:[
+            self flash
+        ] ifFalse:[
             typeOfSelection == #paste ifTrue:[
                 "pasted selection will NOT be replaced by keystroke"
                 self unselect
@@ -3269,7 +3271,10 @@
 
     |line col history sel|
 
-    (self checkModificationsAllowed) ifFalse:[^ self].
+    (self checkModificationsAllowed) ifFalse:[
+        self flash.
+        ^ self
+    ].
 
     sel := self selection.
     sel notNil ifTrue:[
@@ -3324,7 +3329,6 @@
     <resource: #keyboard (#Again #Copy #Cut #Paste #Accept #Find #GotoLine #SaveAs #Print)>
     <resource: #programMenu>
 
-
     |items m sub shortKeys sensor|
 
     ((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[
@@ -3369,14 +3373,13 @@
     sub checkToggleAt:#insertMode: put:insertMode.
 
     readOnly ifTrue:[
-        m disable:#paste
+        m disableAll:#(paste pasteOrReplace cut indent autoIndent: insertMode:)
     ].
     self hasSelection not ifTrue:[
         m disable:#copySelection.
     ].
     (self hasSelection not or:[readOnly]) ifTrue:[
         m disable:#cut.
-        sub disable:#indent.
     ].
     acceptEnabled == false ifTrue:[
         m disable:#accept
@@ -3392,7 +3395,10 @@
 
     |sel|
 
-    self checkModificationsAllowed ifFalse:[^ self].
+    self checkModificationsAllowed ifFalse:[
+        self flash.
+        ^ self
+    ].
 
     sel := self getTextSelection.
     self unselect.  
@@ -3444,7 +3450,10 @@
 
     |sel|
 
-    self checkModificationsAllowed ifFalse:[^ self].
+    self checkModificationsAllowed ifFalse:[
+        self flash.
+        ^ self
+    ].
 
     sel := self getTextSelection.
     self pasteOrReplace:sel.
@@ -4173,5 +4182,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ETxtView.st,v 1.156 1998-05-21 13:53:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ETxtView.st,v 1.157 1998-05-22 11:52:44 cg Exp $'
 ! !
--- a/EditTextView.st	Thu May 21 15:58:01 1998 +0200
+++ b/EditTextView.st	Fri May 22 13:52:44 1998 +0200
@@ -2658,7 +2658,9 @@
     ].
 
     (key isMemberOf:Character) ifTrue:[
-        readOnly ifFalse:[
+        readOnly ifTrue:[
+            self flash
+        ] ifFalse:[
             typeOfSelection == #paste ifTrue:[
                 "pasted selection will NOT be replaced by keystroke"
                 self unselect
@@ -3269,7 +3271,10 @@
 
     |line col history sel|
 
-    (self checkModificationsAllowed) ifFalse:[^ self].
+    (self checkModificationsAllowed) ifFalse:[
+        self flash.
+        ^ self
+    ].
 
     sel := self selection.
     sel notNil ifTrue:[
@@ -3324,7 +3329,6 @@
     <resource: #keyboard (#Again #Copy #Cut #Paste #Accept #Find #GotoLine #SaveAs #Print)>
     <resource: #programMenu>
 
-
     |items m sub shortKeys sensor|
 
     ((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[
@@ -3369,14 +3373,13 @@
     sub checkToggleAt:#insertMode: put:insertMode.
 
     readOnly ifTrue:[
-        m disable:#paste
+        m disableAll:#(paste pasteOrReplace cut indent autoIndent: insertMode:)
     ].
     self hasSelection not ifTrue:[
         m disable:#copySelection.
     ].
     (self hasSelection not or:[readOnly]) ifTrue:[
         m disable:#cut.
-        sub disable:#indent.
     ].
     acceptEnabled == false ifTrue:[
         m disable:#accept
@@ -3392,7 +3395,10 @@
 
     |sel|
 
-    self checkModificationsAllowed ifFalse:[^ self].
+    self checkModificationsAllowed ifFalse:[
+        self flash.
+        ^ self
+    ].
 
     sel := self getTextSelection.
     self unselect.  
@@ -3444,7 +3450,10 @@
 
     |sel|
 
-    self checkModificationsAllowed ifFalse:[^ self].
+    self checkModificationsAllowed ifFalse:[
+        self flash.
+        ^ self
+    ].
 
     sel := self getTextSelection.
     self pasteOrReplace:sel.
@@ -4173,5 +4182,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.156 1998-05-21 13:53:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.157 1998-05-22 11:52:44 cg Exp $'
 ! !