# HG changeset patch # User Claus Gittinger # Date 834165350 -7200 # Node ID e00b0bb1d4398d9f5c16ce1c4e7c961630551906 # Parent 0aadc66e6134c7af089ed75ecaf9bdb8f3fb5523 show photometric diff -r 0aadc66e6134 -r e00b0bb1d439 ImageSelBox.st --- a/ImageSelBox.st Wed Jun 05 20:15:49 1996 +0200 +++ b/ImageSelBox.st Fri Jun 07 18:35:50 1996 +0200 @@ -10,13 +10,11 @@ hereby transferred. " -'From Smalltalk/X, Version:2.10.5 on 28-jun-1995 at 6:45:45 am'! - FileSelectionBox subclass:#ImageSelectionBox - instanceVariableNames:'previewField preview info' - classVariableNames:'' - poolDictionaries:'' - category:'Views-DialogBoxes' + instanceVariableNames:'previewField preview info' + classVariableNames:'' + poolDictionaries:'' + category:'Views-DialogBoxes' ! !ImageSelectionBox class methodsFor:'documentation'! @@ -40,83 +38,6 @@ Like a fileSelectionBox, but adds a little preview field. Nice. " -! - -version - ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ImageSelBox.st,v 1.3 1995-11-11 16:29:01 cg Exp $' -! ! - -!ImageSelectionBox methodsFor:'user actions'! - -selectionChanged - "selections in list show the image" - - super selectionChanged. - self showPreview -! - -showPreview - "show the image as thumbNail" - - |fileNameString fileName image| - - previewField label:nil. - info label:nil. - - preview value ifFalse:[ - ^ self - ]. - - " - show the image in the previewLabel - " - fileNameString := self contents. - (fileNameString notNil and:[fileNameString notEmpty]) ifTrue:[ - fileName := fileNameString asFilename. - (fileName exists - and:[fileName isDirectory not - and:[fileName isReadable]]) ifTrue:[ - - self topView withWaitCursorDo:[ - image := Image fromFile:fileNameString. - image notNil ifTrue:[ - info label:(resources string:'Size: %1 x %2' - with:image width printString - with:image height printString), - (resources string:' Depth: %1' - with:image depth printString). - - (image width <= 64 and:[image height <= 64]) ifFalse:[ - image := image magnifiedPreservingRatioTo:64@64. - ]. - " - for the thumbNail picture, - we can temporarily switch to a rough dither. - (this speeds up the thing quite a bit - " - (image depth > 2 - and:[Color fixColors isNil]) ifTrue:[ - "temporarily go to a 3x3x2 colormap ..." - Object errorSignal handle:[:ex | - 'very low resolution colors' infoPrintNL. - Object errorSignal handle:[:ex | - 'cannot allocate dither colors' infoPrintNL. - ex return - ] do:[ - Color getColorsRed:2 green:2 blue:2. - ] - ] do:[ - Color getColorsRed:5 green:5 blue:3. - ]. - previewField label:image. - Color releaseDitherColors. - ] ifFalse:[ - previewField label:image. - ] - ] - ] - ] - ] ! ! !ImageSelectionBox methodsFor:'initialization'! @@ -183,3 +104,85 @@ bottomInset:(prefY + ViewSpacing + previewSize y + (frame borderWidth * 2) + ViewSpacing). ! ! +!ImageSelectionBox methodsFor:'user actions'! + +selectionChanged + "selections in list show the image" + + super selectionChanged. + self showPreview +! + +showPreview + "show the image as thumbNail" + + |fileNameString fileName image| + + previewField label:nil. + info label:nil. + + preview value ifFalse:[ + ^ self + ]. + + " + show the image in the previewLabel + " + fileNameString := self contents. + (fileNameString notNil and:[fileNameString notEmpty]) ifTrue:[ + fileName := fileNameString asFilename. + (fileName exists + and:[fileName isDirectory not + and:[fileName isReadable]]) ifTrue:[ + + self topView withWaitCursorDo:[ + image := Image fromFile:fileNameString. + image notNil ifTrue:[ + info label:(resources string:'%1 x %2' + with:image width printString + with:image height printString), + (resources string:' Depth:%1' + with:image depth printString), + (resources string:' (%1)' + with:image photometric printString). + + (image width <= 64 and:[image height <= 64]) ifFalse:[ + image := image magnifiedPreservingRatioTo:64@64. + ]. + " + for the thumbNail picture, + we can temporarily switch to a rough dither. + (this speeds up the thing quite a bit + " + (image depth > 2 + and:[Color fixColors isNil]) ifTrue:[ + "temporarily go to a 3x3x2 colormap ..." + Object errorSignal handle:[:ex | + 'very low resolution colors' infoPrintNL. + Object errorSignal handle:[:ex | + 'cannot allocate dither colors' infoPrintNL. + ex return + ] do:[ + Color getColorsRed:2 green:2 blue:2. + ] + ] do:[ + Color getColorsRed:5 green:5 blue:3. + ]. + previewField label:image. + Color releaseDitherColors. + ] ifFalse:[ + previewField label:image. + ] + ] + ] + ] + ] + + "Modified: 7.6.1996 / 12:25:19 / cg" +! ! + +!ImageSelectionBox class methodsFor:'documentation'! + +version + ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ImageSelBox.st,v 1.4 1996-06-07 16:35:50 cg Exp $' +! ! diff -r 0aadc66e6134 -r e00b0bb1d439 ImageSelectionBox.st --- a/ImageSelectionBox.st Wed Jun 05 20:15:49 1996 +0200 +++ b/ImageSelectionBox.st Fri Jun 07 18:35:50 1996 +0200 @@ -10,13 +10,11 @@ hereby transferred. " -'From Smalltalk/X, Version:2.10.5 on 28-jun-1995 at 6:45:45 am'! - FileSelectionBox subclass:#ImageSelectionBox - instanceVariableNames:'previewField preview info' - classVariableNames:'' - poolDictionaries:'' - category:'Views-DialogBoxes' + instanceVariableNames:'previewField preview info' + classVariableNames:'' + poolDictionaries:'' + category:'Views-DialogBoxes' ! !ImageSelectionBox class methodsFor:'documentation'! @@ -40,83 +38,6 @@ Like a fileSelectionBox, but adds a little preview field. Nice. " -! - -version - ^ '$Header: /cvs/stx/stx/libwidg2/ImageSelectionBox.st,v 1.3 1995-11-11 16:29:01 cg Exp $' -! ! - -!ImageSelectionBox methodsFor:'user actions'! - -selectionChanged - "selections in list show the image" - - super selectionChanged. - self showPreview -! - -showPreview - "show the image as thumbNail" - - |fileNameString fileName image| - - previewField label:nil. - info label:nil. - - preview value ifFalse:[ - ^ self - ]. - - " - show the image in the previewLabel - " - fileNameString := self contents. - (fileNameString notNil and:[fileNameString notEmpty]) ifTrue:[ - fileName := fileNameString asFilename. - (fileName exists - and:[fileName isDirectory not - and:[fileName isReadable]]) ifTrue:[ - - self topView withWaitCursorDo:[ - image := Image fromFile:fileNameString. - image notNil ifTrue:[ - info label:(resources string:'Size: %1 x %2' - with:image width printString - with:image height printString), - (resources string:' Depth: %1' - with:image depth printString). - - (image width <= 64 and:[image height <= 64]) ifFalse:[ - image := image magnifiedPreservingRatioTo:64@64. - ]. - " - for the thumbNail picture, - we can temporarily switch to a rough dither. - (this speeds up the thing quite a bit - " - (image depth > 2 - and:[Color fixColors isNil]) ifTrue:[ - "temporarily go to a 3x3x2 colormap ..." - Object errorSignal handle:[:ex | - 'very low resolution colors' infoPrintNL. - Object errorSignal handle:[:ex | - 'cannot allocate dither colors' infoPrintNL. - ex return - ] do:[ - Color getColorsRed:2 green:2 blue:2. - ] - ] do:[ - Color getColorsRed:5 green:5 blue:3. - ]. - previewField label:image. - Color releaseDitherColors. - ] ifFalse:[ - previewField label:image. - ] - ] - ] - ] - ] ! ! !ImageSelectionBox methodsFor:'initialization'! @@ -183,3 +104,85 @@ bottomInset:(prefY + ViewSpacing + previewSize y + (frame borderWidth * 2) + ViewSpacing). ! ! +!ImageSelectionBox methodsFor:'user actions'! + +selectionChanged + "selections in list show the image" + + super selectionChanged. + self showPreview +! + +showPreview + "show the image as thumbNail" + + |fileNameString fileName image| + + previewField label:nil. + info label:nil. + + preview value ifFalse:[ + ^ self + ]. + + " + show the image in the previewLabel + " + fileNameString := self contents. + (fileNameString notNil and:[fileNameString notEmpty]) ifTrue:[ + fileName := fileNameString asFilename. + (fileName exists + and:[fileName isDirectory not + and:[fileName isReadable]]) ifTrue:[ + + self topView withWaitCursorDo:[ + image := Image fromFile:fileNameString. + image notNil ifTrue:[ + info label:(resources string:'%1 x %2' + with:image width printString + with:image height printString), + (resources string:' Depth:%1' + with:image depth printString), + (resources string:' (%1)' + with:image photometric printString). + + (image width <= 64 and:[image height <= 64]) ifFalse:[ + image := image magnifiedPreservingRatioTo:64@64. + ]. + " + for the thumbNail picture, + we can temporarily switch to a rough dither. + (this speeds up the thing quite a bit + " + (image depth > 2 + and:[Color fixColors isNil]) ifTrue:[ + "temporarily go to a 3x3x2 colormap ..." + Object errorSignal handle:[:ex | + 'very low resolution colors' infoPrintNL. + Object errorSignal handle:[:ex | + 'cannot allocate dither colors' infoPrintNL. + ex return + ] do:[ + Color getColorsRed:2 green:2 blue:2. + ] + ] do:[ + Color getColorsRed:5 green:5 blue:3. + ]. + previewField label:image. + Color releaseDitherColors. + ] ifFalse:[ + previewField label:image. + ] + ] + ] + ] + ] + + "Modified: 7.6.1996 / 12:25:19 / cg" +! ! + +!ImageSelectionBox class methodsFor:'documentation'! + +version + ^ '$Header: /cvs/stx/stx/libwidg2/ImageSelectionBox.st,v 1.4 1996-06-07 16:35:50 cg Exp $' +! !