AbstractFileBrowser.st
changeset 4624 efb881e13889
parent 4618 fa8474922061
child 4629 e8739857466c
--- a/AbstractFileBrowser.st	Thu Feb 27 18:05:09 2003 +0100
+++ b/AbstractFileBrowser.st	Thu Feb 27 18:06:58 2003 +0100
@@ -2168,68 +2168,6 @@
 doCompareTwoFiles
 
     self openDiffView.
-"
-    |files fileName1 fileName2 stream1 stream2 buffer1 buffer2 n1 n2 idx blockSize blockOffset|
-
-    files := self currentFileNameHolder value.
-    fileName1 := files first.
-    fileName2 := files second.
-
-    (fileName1 exists and:[fileName1 isReadable]) ifFalse:[
-        Dialog warn:(resources string:'Cannot read %1' with:fileName1 pathName allBold).
-        ^ self.
-    ].
-    (fileName2 exists and:[fileName2 isReadable]) ifFalse:[
-        Dialog warn:(resources string:'Cannot read %1' with:fileName2 pathName allBold).
-        ^ self.
-    ].
-    [
-        stream1 := fileName1 readStream.
-        stream2 := fileName2 readStream.
-
-        stream1 binary. stream2 binary.
-
-        blockSize := 8192.
-        buffer1 := ByteArray new:blockSize.
-        buffer2 := ByteArray new:blockSize.
-
-        blockOffset := 0.
-
-        [stream1 atEnd] whileFalse:[
-            n1 := stream1 nextBytes:(buffer1 size) into:buffer1 startingAt:1.
-            n2 := stream2 nextBytes:n1 into:buffer2 startingAt:1.
-
-            n1 ~~ n2 ifTrue:[
-self halt.
-            ] ifFalse:[
-                buffer1 ~= buffer2 ifTrue:[
-                    idx := (1 to:n1) findFirst:[:idx | (buffer1 at:idx) ~~ (buffer2 at:idx)].
-                    Dialog information:(resources 
-                                            string:'Files differ at position %1 (0x%2 vs. 0x%3)' 
-                                            with:(blockOffset+idx)
-                                            with:((buffer1 at:idx) hexPrintString:2)
-                                            with:((buffer2 at:idx) hexPrintString:2)
-                                       ).
-                    ^ self.
-                ] 
-            ].
-            blockOffset := blockOffset + n1.
-        ].
-        stream2 atEnd ifFalse:[
-    self halt.
-        ].
-    ] ensure:[
-        stream1 notNil ifTrue:[stream1 close].
-        stream2 notNil ifTrue:[stream2 close].
-    ].
-
-self halt.
-"
-"/    action := [:command | 
-"/                self addToCommandHistory:command for:fileName.
-"/                self executeCommand:command.
-"/              ].
-"/    self askForCommandFor:fileName thenDo:action
 !
 
 doExecuteCommand
@@ -3542,11 +3480,6 @@
 
 canForward
 
-"/    | currentSelection |
-"/
-"/    currentSelection := self currentDirectories value.
-"/    currentSelection size ~~ 1 ifTrue:[ ^ false].
-    
     ^ self dirHistory canForward.
 !
 
@@ -3928,54 +3861,6 @@
                 with:('ppm' -> 'xpmtoppm')
                 with:('gif' -> 'ppmtogif')
             )
-    
-"/    |img tempFileXPM tempFilePPM tempFileGIF|
-"/
-"/    [
-"/        self withActivityIndicationDo:[
-"/            self currentFileNameHolder value do:[:fileName |
-"/                fileName isDirectory ifFalse:[
-"/                    self notify:('Convert to GIF:',  fileName baseName).
-"/                    img := Image fromFile:(fileName pathName).
-"/                    img notNil ifTrue:[
-"/                        tempFileXPM  := Filename newTemporary withSuffix:'xpm'.
-"/                        tempFilePPM := tempFileXPM withSuffix:'ppm'.
-"/                        tempFileGIF := tempFileXPM withSuffix:'gif'.
-"/                        [
-"/                            img saveOn:tempFileXPM using:XPMReader.
-"/
-"/
-"/                            (OperatingSystem 
-"/                                    executeCommand:('xpmtoppm %1 > %2' 
-"/                                                        bindWith:tempFileXPM pathName
-"/                                                        with:tempFilePPM pathName))
-"/                            ifFalse:[
-"/                                self warn:'Cannot convert to ppm format'.
-"/                            ] ifTrue:[
-"/                                (OperatingSystem 
-"/                                        executeCommand:('ppmtogif %1 > %2' 
-"/                                                            bindWith:tempFilePPM pathName
-"/                                                            with:tempFileGIF pathName))
-"/                                ifFalse:[
-"/                                    self warn:'Cannot convert to gif format'.
-"/                                ] ifTrue:[
-"/                                    tempFileGIF moveTo:(fileName withSuffix:'gif').
-"/                                    self updateAndSelect:nil.
-"/                                ].
-"/                            ].
-"/                        ] ensure:[
-"/                            tempFileXPM delete.
-"/                            tempFilePPM delete.
-"/                            tempFileGIF delete.
-"/                        ]
-"/                    ] ifFalse:[
-"/                        self warn:'Unknown format/not an image: ' , fileName asString
-"/                    ]
-"/                ]
-"/            ].
-"/            self notify:''.
-"/        ]
-"/    ] fork.
 !
 
 convertImageToPNG
@@ -3985,54 +3870,6 @@
                 with:('ppm' -> 'xpmtoppm')
                 with:('png' -> 'ppmtopng')
             )
-
-"/    |img tempFileXPM tempFilePPM tempFilePNG|
-"/
-"/    [
-"/        self withActivityIndicationDo:[
-"/            self currentFileNameHolder value do:[:fileName |
-"/                fileName isDirectory ifFalse:[
-"/                    self notify:('Convert to PNG:',  fileName baseName).
-"/                    img := Image fromFile:(fileName pathName).
-"/                    img notNil ifTrue:[
-"/                        tempFileXPM  := Filename newTemporary withSuffix:'xpm'.
-"/                        tempFilePPM := tempFileXPM withSuffix:'ppm'.
-"/                        tempFilePNG := tempFileXPM withSuffix:'png'.
-"/                        [
-"/                            img saveOn:tempFileXPM using:XPMReader.
-"/
-"/
-"/                            (OperatingSystem 
-"/                                    executeCommand:('xpmtoppm %1 > %2' 
-"/                                                        bindWith:tempFileXPM pathName
-"/                                                        with:tempFilePPM pathName))
-"/                            ifFalse:[
-"/                                self warn:'Cannot convert to ppm format'.
-"/                            ] ifTrue:[
-"/                                (OperatingSystem 
-"/                                        executeCommand:('ppmtopng %1 > %2' 
-"/                                                            bindWith:tempFilePPM pathName
-"/                                                            with:tempFilePNG pathName))
-"/                                ifFalse:[
-"/                                    self warn:'Cannot convert to gif format'.
-"/                                ] ifTrue:[
-"/                                    tempFilePNG moveTo:(fileName withSuffix:'png').
-"/                                    self updateAndSelect:nil.
-"/                                ].
-"/                            ].
-"/                        ] ensure:[
-"/                            tempFileXPM delete.
-"/                            tempFilePPM delete.
-"/                            tempFilePNG delete.
-"/                        ]
-"/                    ] ifFalse:[
-"/                        self warn:'Unknown format/not an image: ' , fileName asString
-"/                    ]
-"/                ]
-"/            ].
-"/            self notify:''.
-"/        ]
-"/    ] fork.
 !
 
 convertImageUsingChain:chainOfConversions
@@ -4728,7 +4565,7 @@
                                 viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top.
                                 i := img.
                                 top extent:200@200.
-                                top label:(img fileName asFilename directoryName asFilename baseName , '/' , img fileName asFilename baseName).
+                                top label:(img fileName asFilename directoryName asFilename baseName , Filename separator asString , img fileName asFilename baseName).
                                 top openAndWait.
 
                                 (i width > 200 or:[i height > 200]) ifTrue:[
@@ -5997,5 +5834,5 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.102 2003-02-27 10:44:58 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.103 2003-02-27 17:06:58 penk Exp $'
 ! !