.
authorclaus
Mon, 03 Jul 1995 04:35:33 +0200
changeset 64 10910b8b003a
parent 63 e560d8279473
child 65 40e27e2606b5
.
2ColTxtV.st
FNmEdtFld.st
FilenameEditField.st
ImageEditView.st
ImageSelBox.st
ImageSelectionBox.st
ImageView.st
ImgEditV.st
TextRuler.st
TwoColumnTextView.st
--- a/2ColTxtV.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/2ColTxtV.st	Mon Jul 03 04:35:33 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.5 1995-05-03 00:42:17 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.6 1995-07-03 02:34:38 claus Exp $
 '!
 
 !TwoColumnTextView class methodsFor:'documentation'!
@@ -58,7 +58,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.5 1995-05-03 00:42:17 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/2ColTxtV.st,v 1.6 1995-07-03 02:34:38 claus Exp $
 "
 ! !
 
@@ -163,8 +163,6 @@
 !TwoColumnTextView methodsFor:'initialization'!
 
 initialize
-    |panel|
-
     super initialize.
 
     textView1 := TextView origin:0.0 @ 0.0
--- a/FNmEdtFld.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/FNmEdtFld.st	Mon Jul 03 04:35:33 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/Attic/FNmEdtFld.st,v 1.10 1995-05-03 00:42:24 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/FNmEdtFld.st,v 1.11 1995-07-03 02:34:42 claus Exp $
 '!
 
 !FilenameEditField class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg2/Attic/FNmEdtFld.st,v 1.10 1995-05-03 00:42:24 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/FNmEdtFld.st,v 1.11 1995-07-03 02:34:42 claus Exp $
 "
 !
 
@@ -100,6 +100,8 @@
      Bug: it completes the last word; it should complete the
 	  word before the cursor."
 
+    <resource: #keyboard ( #FilenameCompletion ) >
+
     |s f matchSet nMatch name words dir|
 
     enabled ifTrue:[
--- a/FilenameEditField.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/FilenameEditField.st	Mon Jul 03 04:35:33 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/FilenameEditField.st,v 1.10 1995-05-03 00:42:24 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/FilenameEditField.st,v 1.11 1995-07-03 02:34:42 claus Exp $
 '!
 
 !FilenameEditField class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg2/FilenameEditField.st,v 1.10 1995-05-03 00:42:24 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/FilenameEditField.st,v 1.11 1995-07-03 02:34:42 claus Exp $
 "
 !
 
@@ -100,6 +100,8 @@
      Bug: it completes the last word; it should complete the
 	  word before the cursor."
 
+    <resource: #keyboard ( #FilenameCompletion ) >
+
     |s f matchSet nMatch name words dir|
 
     enabled ifTrue:[
--- a/ImageEditView.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/ImageEditView.st	Mon Jul 03 04:35:33 1995 +0200
@@ -24,9 +24,32 @@
 
 a View to edit images - in construction
 
-$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.12 1995-05-18 23:27:31 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.13 1995-07-03 02:35:15 claus Exp $
 '!
 
+!ImageEditView class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1993 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    This View will eventually be able to edit bitmap images.
+    For now, it is not.
+"
+! !
+
 !ImageEditView methodsFor:'queries'!
 
 widthOfContents
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ImageSelBox.st	Mon Jul 03 04:35:33 1995 +0200
@@ -0,0 +1,179 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ 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'
+!
+
+!ImageSelectionBox class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    Like a fileSelectionBox, but adds a little preview field.
+    Nice.
+"
+! !
+
+!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:'Size: ' ,
+			       (image width printString , ' x ' , image height printString),
+			       ' Depth: ' , 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'!
+
+initialize
+    |v check lw lh prefY frame previewSize|
+
+    previewSize := 64@64.
+
+    super initialize.
+
+    label := 'Image dialog'.
+    labelField label:(resources string:'select an image file:').
+
+    prefY := buttonPanel preferredExtent y.
+
+    check := CheckBox label:(resources string:'preview') in:self.
+    check model:(preview := false asValue).
+    preview onChangeSend:#showPreview to:self.
+    info := Label label:'' in:self.
+    info adjust:#left.
+
+    lh := check preferredExtent y.
+    lw := check preferredExtent x.
+
+    check
+	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)); 
+	rightInset:(ViewSpacing + lw) negated.
+
+    info
+	origin:(0.0 @ 1.0)       
+	corner:(1.0 @ 1.0).
+    info
+	topInset:(prefY + ViewSpacing + info preferredExtent y + ViewSpacing) negated;
+	bottomInset:(prefY + ViewSpacing); 
+	leftInset:ViewSpacing;
+	rightInset:(ViewSpacing + previewSize x + ViewSpacing) negated.
+
+    StyleSheet is3D ifTrue:[
+	v := View in:self.
+	previewField := Label origin:0.0@0.0 corner:1.0@1.0 in:v.
+	previewField allInset:ViewSpacing//2.
+	frame := v.
+	previewField level:-1.
+	frame level:1.
+    ] ifFalse:[
+	previewField := frame := Label in:self.
+    ].
+    frame
+	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); 
+	leftInset:(ViewSpacing + previewSize x + ViewSpacing) negated;
+	rightInset:ViewSpacing.
+    previewField sizeFixed:true.
+
+    selectionList superView
+	bottomInset:(prefY + ViewSpacing + previewSize y + (frame borderWidth * 2) + ViewSpacing).
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ImageSelectionBox.st	Mon Jul 03 04:35:33 1995 +0200
@@ -0,0 +1,179 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ 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'
+!
+
+!ImageSelectionBox class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    Like a fileSelectionBox, but adds a little preview field.
+    Nice.
+"
+! !
+
+!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:'Size: ' ,
+			       (image width printString , ' x ' , image height printString),
+			       ' Depth: ' , 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'!
+
+initialize
+    |v check lw lh prefY frame previewSize|
+
+    previewSize := 64@64.
+
+    super initialize.
+
+    label := 'Image dialog'.
+    labelField label:(resources string:'select an image file:').
+
+    prefY := buttonPanel preferredExtent y.
+
+    check := CheckBox label:(resources string:'preview') in:self.
+    check model:(preview := false asValue).
+    preview onChangeSend:#showPreview to:self.
+    info := Label label:'' in:self.
+    info adjust:#left.
+
+    lh := check preferredExtent y.
+    lw := check preferredExtent x.
+
+    check
+	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)); 
+	rightInset:(ViewSpacing + lw) negated.
+
+    info
+	origin:(0.0 @ 1.0)       
+	corner:(1.0 @ 1.0).
+    info
+	topInset:(prefY + ViewSpacing + info preferredExtent y + ViewSpacing) negated;
+	bottomInset:(prefY + ViewSpacing); 
+	leftInset:ViewSpacing;
+	rightInset:(ViewSpacing + previewSize x + ViewSpacing) negated.
+
+    StyleSheet is3D ifTrue:[
+	v := View in:self.
+	previewField := Label origin:0.0@0.0 corner:1.0@1.0 in:v.
+	previewField allInset:ViewSpacing//2.
+	frame := v.
+	previewField level:-1.
+	frame level:1.
+    ] ifFalse:[
+	previewField := frame := Label in:self.
+    ].
+    frame
+	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); 
+	leftInset:(ViewSpacing + previewSize x + ViewSpacing) negated;
+	rightInset:ViewSpacing.
+    previewField sizeFixed:true.
+
+    selectionList superView
+	bottomInset:(prefY + ViewSpacing + previewSize y + (frame borderWidth * 2) + ViewSpacing).
+! !
+
--- a/ImageView.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/ImageView.st	Mon Jul 03 04:35:33 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.11 1995-06-27 02:25:10 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.12 1995-07-03 02:35:12 claus Exp $
 '!
 
 !ImageView class methodsFor:'documentation'!
@@ -90,7 +90,7 @@
 openOnImage:anImage
     "startup an image viewer on an image"
 
-    |top v imageView img icnW icnH iconView magX magY mag wg lbl|
+    |top v imageView icnW icnH iconView magX magY mag lbl|
 
     anImage isImage ifTrue:[
 	lbl := 'an Image'
--- a/ImgEditV.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/ImgEditV.st	Mon Jul 03 04:35:33 1995 +0200
@@ -24,9 +24,32 @@
 
 a View to edit images - in construction
 
-$Header: /cvs/stx/stx/libwidg2/Attic/ImgEditV.st,v 1.12 1995-05-18 23:27:31 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/ImgEditV.st,v 1.13 1995-07-03 02:35:15 claus Exp $
 '!
 
+!ImageEditView class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1993 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    This View will eventually be able to edit bitmap images.
+    For now, it is not.
+"
+! !
+
 !ImageEditView methodsFor:'queries'!
 
 widthOfContents
--- a/TextRuler.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/TextRuler.st	Mon Jul 03 04:35:33 1995 +0200
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.10 1995-02-27 10:42:53 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/TextRuler.st,v 1.11 1995-07-03 02:35:33 claus Exp $
 written oct 91 by claus
 '!
 
@@ -385,7 +385,7 @@
 initialize
     |leftAlignToggle alignToggle centerToggle rightAlignToggle
      leftTabButton centerTabButton rightTabButton decimalTabButton
-     lineSpacingField panel1 panel2 panel3 scaleHeight h group|
+     lineSpacingField panel1 panel3 scaleHeight h group|
 
     super initialize.
 
--- a/TwoColumnTextView.st	Tue Jun 27 04:25:33 1995 +0200
+++ b/TwoColumnTextView.st	Mon Jul 03 04:35:33 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.5 1995-05-03 00:42:17 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.6 1995-07-03 02:34:38 claus Exp $
 '!
 
 !TwoColumnTextView class methodsFor:'documentation'!
@@ -58,7 +58,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.5 1995-05-03 00:42:17 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/TwoColumnTextView.st,v 1.6 1995-07-03 02:34:38 claus Exp $
 "
 ! !
 
@@ -163,8 +163,6 @@
 !TwoColumnTextView methodsFor:'initialization'!
 
 initialize
-    |panel|
-
     super initialize.
 
     textView1 := TextView origin:0.0 @ 0.0