--- a/ImageEditView.st Sat Dec 11 02:48:14 1993 +0100
+++ b/ImageEditView.st Sat Jan 08 18:27:48 1994 +0100
@@ -25,7 +25,7 @@
a View to edit images - in construction
-$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.2 1993-12-11 01:45:14 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.3 1994-01-08 17:27:25 claus Exp $
'!
!ImageEditView methodsFor:'queries'!
@@ -44,6 +44,14 @@
^ (image height * magnification y) rounded
! !
+!ImageEditView methodsFor:'accessing'!
+
+image:anImage
+ magnification := 1@1.
+ magnifiedImage := nil.
+ super image:anImage
+! !
+
!ImageEditView methodsFor:'menu actions'!
saveAs
--- a/ImageView.st Sat Dec 11 02:48:14 1993 +0100
+++ b/ImageView.st Sat Jan 08 18:27:48 1994 +0100
@@ -22,7 +22,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.1 1993-10-13 01:02:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.2 1994-01-08 17:27:23 claus Exp $
'!
!ImageView class methodsFor:'startup'!
@@ -30,16 +30,72 @@
startOn:aFileName
"startup an image viewer"
- |top v imageView|
+ |top v imageView img icnW icnH icn magX magY mag wg|
top := StandardSystemView label:aFileName.
+ top iconLabel:aFileName asFilename baseName.
v := HVScrollableView for:self in:top.
v origin:0@0 extent:1.0@1.0.
imageView := v scrolledView.
- imageView image:(Image fromFile:aFileName).
- top realize
+ img := Image fromFile:aFileName.
+ img notNil ifTrue:[
+ imageView image:img.
+
+ "define an icon view showing little version of image.
+ Since some window managers cannot handle this correctly (twm),
+ this is only done when running on an IRIS"
+
+ ((OperatingSystem getSystemType = 'iris') and:[self defaultStyle == #iris]) ifTrue:[
+ icn := self new.
+
+ "for now; should somehow get access to preferred iconview extent ..."
+ icnW := 86.
+ icnH := 68.
+
+ ((img width <= icnW) and:[img height <= icnH]) ifTrue:[
+ icn extent:(img width @ img height).
+ mag := 1 @ 1
+ ] ifFalse:[
+ magX := icnW / img width.
+ magY := icnH / img height.
+
+ "scale image"
+"
+ mag := magX @ magY.
+"
+ "preserve ratio"
+"
+ mag := (magX min:magY) asPoint.
+"
+" "
+ mag := (magX max:magY) asPoint.
+" "
+
+ icn extent:((img width @ img height) * mag) rounded.
+ ].
+ "start icon as a low prio bg process -
+ so megnification and color allocation will not hurt us ..."
+
+ ProcessorScheduler isPureEventDriven ifFalse:[
+ wg := WindowGroup new.
+ icn windowGroup:wg.
+ wg addTopView:icn.
+ wg startup.
+ wg process priority:4.
+ ].
+ top iconView:icn.
+ ].
+ ].
+
+ top open.
+
+ icn notNil ifTrue:[
+ [
+ icn image:(img magnifyBy:mag).
+ ] forkAt:4
+ ].
"ImageView startOn:'bitmaps/garfield.gif'"
! !
@@ -91,13 +147,15 @@
image:anImage
"set the image - show a wait cursor, since image dithering may take a while"
- self cursor:Cursor wait.
image := anImage.
- shown ifTrue:[
- self redraw
+ anImage notNil ifTrue:[
+ self cursor:Cursor wait.
+ shown ifTrue:[
+ self redraw
+ ].
+ self contentsChanged.
+ self cursor:(Cursor normal).
].
- self contentsChanged.
- self cursor:(Cursor normal).
"ImageView new realize image:(Image fromFile:'bitmaps/claus.gif')"
!
--- a/ImgEditV.st Sat Dec 11 02:48:14 1993 +0100
+++ b/ImgEditV.st Sat Jan 08 18:27:48 1994 +0100
@@ -25,7 +25,7 @@
a View to edit images - in construction
-$Header: /cvs/stx/stx/libwidg2/Attic/ImgEditV.st,v 1.2 1993-12-11 01:45:14 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Attic/ImgEditV.st,v 1.3 1994-01-08 17:27:25 claus Exp $
'!
!ImageEditView methodsFor:'queries'!
@@ -44,6 +44,14 @@
^ (image height * magnification y) rounded
! !
+!ImageEditView methodsFor:'accessing'!
+
+image:anImage
+ magnification := 1@1.
+ magnifiedImage := nil.
+ super image:anImage
+! !
+
!ImageEditView methodsFor:'menu actions'!
saveAs
--- a/RoundButton.st Sat Dec 11 02:48:14 1993 +0100
+++ b/RoundButton.st Sat Jan 08 18:27:48 1994 +0100
@@ -48,7 +48,7 @@
!RoundButton methodsFor:'private'!
roundCornerFormWidth:width height:height offset:off
- |form bw wCorn hCorn wCornHalf wCornHalfRest hCornHalf hCornHalfRest
+ |form wCorn hCorn wCornHalf wCornHalfRest hCornHalf hCornHalfRest
left top right bot w h|
"compute a shape form"
--- a/Ruler.st Sat Dec 11 02:48:14 1993 +0100
+++ b/Ruler.st Sat Jan 08 18:27:48 1994 +0100
@@ -24,7 +24,7 @@
a Ruler for page layout.
-$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.4 1993-12-11 01:48:14 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.5 1994-01-08 17:27:48 claus Exp $
written oct 91 by claus
'!
@@ -77,7 +77,7 @@
paperWidthMM := self inchToMillimeter:paperWidth.
pixelPerMM := self millimeterToPixel:1.
pos := 5.
- labelRight := marg + (font widthOf:'cm ').
+ labelRight := marg + (font widthOf:'cm').
x := (pixelPerMM * pos - xOrigin) rounded.
[(x < width) and:[pos <= paperWidthMM]] whileTrue:[
@@ -85,9 +85,9 @@
self displayLineFromX:x y:top
toX:x y:(top + shortLen)
] ifFalse:[
- self displayLineFromX:x y:top
- toX:x y:(top + longLen).
x < labelRight ifFalse:[
+ self displayLineFromX:x y:top
+ toX:x y:(top + longLen).
self displayString:(pos // 10) asInteger printString
x:(x + marg)
y:charY
@@ -105,15 +105,15 @@
pixelPerInch := self inchToPixel:1.
pos := 0.25.
- labelRight := marg + (font widthOf:'inch ').
+ labelRight := marg + (font widthOf:'inch').
x := (pixelPerInch * pos - xOrigin) rounded.
veryShortLen := longLen // 4.
[(x < width) and:[pos <= paperWidth]] whileTrue:[
(mod == 0) ifTrue:[
- self displayLineFromX:x y:top
- toX:x y:(top + longLen).
x < labelRight ifFalse:[
+ self displayLineFromX:x y:top
+ toX:x y:(top + longLen).
self displayString:pos asInteger printString
x:(x + marg)
y:charY
@@ -134,6 +134,7 @@
self displayString:'inch ' x:marg y:charY.
].
self redrawEdges
+
! !
!Ruler methodsFor:'initialization'!