FileApplicationNoteBook.st
changeset 14576 c9b94a8aacb5
parent 14517 65a293fbfe93
child 14660 39afddf6eea3
--- a/FileApplicationNoteBook.st	Fri Jul 04 12:22:18 2014 +0200
+++ b/FileApplicationNoteBook.st	Fri Jul 04 12:22:26 2014 +0200
@@ -4225,22 +4225,6 @@
         ^ nil
     ].
     ^ img.
-!
-
-setupImageView
-    [
-        |img|
-
-"/        imageView withCursor:(Cursor wait) do:[
-            img := self image.
-            img notNil ifTrue:[
-                self image:img.
-                imageView image:img
-            ].
-"/        ].
-    ] fork.
-
-    "Modified: / 25-07-2006 / 09:09:33 / cg"
 ! !
 
 !FileApplicationNoteBook::ImageViewApplication methodsFor:'aspects'!
@@ -4269,6 +4253,47 @@
     super update:something with:aParameter from:changedObject
 ! !
 
+!FileApplicationNoteBook::ImageViewApplication methodsFor:'event handling'!
+
+processEvent:anEvent
+    |view rawKey key|
+
+    view := anEvent view.
+    anEvent isKeyPressEvent ifTrue:[
+        (imageView notNil 
+            and:[view notNil
+            and:[(view == imageView)]]
+        ) ifTrue:[
+            rawKey := anEvent rawKey.
+            key := anEvent key.
+            (rawKey == #CursorDown) ifTrue:[
+                masterApplication selectNextFile; enterAction.
+                ^ true.
+            ].
+            (rawKey == #CursorUp) ifTrue:[
+                masterApplication selectPreviousFile; enterAction.
+                ^ true.
+            ].
+            key == $q ifTrue:[
+                self doClose.
+                ^ true.
+            ].
+            ((key == #Escape) or:[key == $x]) ifTrue:[
+                self topView collapse.
+                ^ true.
+            ].
+            ((key == #Cut) 
+              or:[(key == #BackSpace)
+              or:[key == #Delete]]) ifTrue:[
+                masterApplication deleteFiles.
+                ^ true
+            ].
+            ^ false
+        ]
+    ].
+    ^ false
+! !
+
 !FileApplicationNoteBook::ImageViewApplication methodsFor:'initialization & release'!
 
 postBuildImageView:aWidget
@@ -4277,6 +4302,13 @@
     self imageView wantsFocusWithPointerEnter.
 !
 
+postOpenAsSubcanvasWith:aBuilder 
+    "invoked if the application is embedded in some other view"
+
+    self imageView windowGroup addPreEventHook:self.
+    super postOpenAsSubcanvasWith:aBuilder
+!
+
 postOpenWith:aBuilder 
     "only invoked if the application is not started from a master"
 
@@ -4299,7 +4331,24 @@
         self item:(DirectoryContentsBrowser itemClass fileName:(currentDir construct:fileName))
     ].
     self setupImageView.
+    self imageView windowGroup addPreEventHook:self.
     super postOpenWith:aBuilder
+!
+
+setupImageView
+    [
+        |img|
+
+"/        imageView withCursor:(Cursor wait) do:[
+            img := self image.
+            img notNil ifTrue:[
+                self image:img.
+                imageView image:img
+            ].
+"/        ].
+    ] fork.
+
+    "Modified: / 25-07-2006 / 09:09:33 / cg"
 ! !
 
 !FileApplicationNoteBook::Terminal class methodsFor:'defaults'!
@@ -7343,10 +7392,10 @@
 !FileApplicationNoteBook class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.298 2014-06-17 09:01:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.299 2014-07-04 10:22:26 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.298 2014-06-17 09:01:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.299 2014-07-04 10:22:26 cg Exp $'
 ! !