ImageSelectionBox.st
changeset 3150 e3a55f15ef7e
parent 233 4979c1304456
child 4770 6634b540fea2
--- a/ImageSelectionBox.st	Fri Nov 10 07:20:31 2006 +0100
+++ b/ImageSelectionBox.st	Mon Nov 13 17:11:31 2006 +0100
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libwidg2' }"
+
 FileSelectionBox subclass:#ImageSelectionBox
 	instanceVariableNames:'previewField preview info'
 	classVariableNames:''
@@ -64,19 +66,19 @@
     lw := check preferredExtent x.
 
     check
-	origin:(0.0 @ 1.0)       
+	origin:(0.0 @ 1.0)
 	corner:(0.0 @ 1.0).
     check
 	topInset:(prefY + ViewSpacing + previewSize y) negated;
-	bottomInset:(prefY + ViewSpacing + (previewSize y - check preferredExtent y)); 
+	bottomInset:(prefY + ViewSpacing + (previewSize y - check preferredExtent y));
 	rightInset:(ViewSpacing + lw) negated.
 
     info
-	origin:(0.0 @ 1.0)       
+	origin:(0.0 @ 1.0)
 	corner:(1.0 @ 1.0).
     info
 	topInset:(prefY + ViewSpacing + info preferredExtent y + ViewSpacing) negated;
-	bottomInset:(prefY + ViewSpacing); 
+	bottomInset:(prefY + ViewSpacing);
 	leftInset:ViewSpacing;
 	rightInset:(ViewSpacing + previewSize x + ViewSpacing) negated.
 
@@ -91,11 +93,11 @@
 	previewField := frame := Label in:self.
     ].
     frame
-	origin:(1.0 @ 1.0)       
+	origin:(1.0 @ 1.0)
 	corner:(1.0 @ 1.0).
     frame
 	topInset:(prefY + ViewSpacing + previewSize y + (frame borderWidth * 2)) negated;
-	bottomInset:(prefY + frame borderWidth + ViewSpacing); 
+	bottomInset:(prefY + frame borderWidth + ViewSpacing);
 	leftInset:(ViewSpacing + previewSize x + ViewSpacing) negated;
 	rightInset:ViewSpacing.
     previewField sizeFixed:true.
@@ -122,7 +124,7 @@
     info label:nil.
 
     preview value ifFalse:[
-        ^ self
+	^ self
     ].
 
     "
@@ -130,52 +132,52 @@
     "
     fileNameString := self contents.
     (fileNameString notNil and:[fileNameString notEmpty]) ifTrue:[
-        fileName := fileNameString asFilename.    
-        (fileName exists 
-        and:[fileName isDirectory not
-        and:[fileName isReadable]]) 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).
+	    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:[device 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 on:device.
-                            ]
-                        ] do:[
-                            Color getColorsRed:5 green:5 blue:3 on:device.
-                        ].
-                        previewField label:image.
-                        device releaseFixColors.
-                    ] ifFalse:[
-                        previewField label:image.
-                    ]
-                ]
-            ]
-        ]
+		    (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:[device 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 on:device.
+			    ]
+			] do:[
+			    Color getColorsRed:5 green:5 blue:3 on:device.
+			].
+			previewField label:image.
+			device releaseFixColors.
+		    ] ifFalse:[
+			previewField label:image.
+		    ]
+		]
+	    ]
+	]
     ]
 
     "Modified: 7.6.1996 / 12:25:19 / cg"
@@ -184,5 +186,5 @@
 !ImageSelectionBox  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ImageSelectionBox.st,v 1.5 1996-08-02 19:03:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ImageSelectionBox.st,v 1.6 2006-11-13 16:11:30 cg Exp $'
 ! !