ImageInspectorView.st
author Claus Gittinger <cg@exept.de>
Thu, 11 Nov 2004 10:14:21 +0100
changeset 6129 4203bef24b27
parent 2831 0be3af401639
child 7799 89bbb32c1200
permissions -rw-r--r--
*** empty log message ***

"
 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.
"

"{ Package: 'stx:libtool' }"

InspectorView subclass:#ImageInspectorView
	instanceVariableNames:'imageView'
	classVariableNames:'LastRatio LastExtent'
	poolDictionaries:''
	category:'Interface-Inspector'
!

!ImageInspectorView 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 class allows better inspection of images,
    by adding another subView, which displays the image.
"
! !

!ImageInspectorView class methodsFor:'defaults'!

defaultExtent
    ^ LastExtent ? super defaultExtent

    "Created: / 7.9.1998 / 13:47:45 / cg"
    "Modified: / 7.9.1998 / 14:15:38 / cg"
! !

!ImageInspectorView methodsFor:'accessing'!

inspect:anObject
    super inspect:anObject.
    realized ifFalse:[^ self].
    imageView image:anObject.

    "
     ImageInspectorView inspect:(Image fromScreen:(0@0 corner:800@800))
    "
! !

!ImageInspectorView methodsFor:'initialization'!

destroy
    |imageViewsSuperView|

    imageViewsSuperView := imageView superView.
    LastRatio := 1.0 - 
                 (imageViewsSuperView relativeCorner y - imageViewsSuperView relativeOrigin y).
    LastExtent := self extent.
    super destroy

    "Created: / 7.9.1998 / 13:13:43 / cg"
    "Modified: / 7.9.1998 / 14:15:38 / cg"
!

initialize
    |v newPanel sub|

    super initialize.

    LastRatio isNil ifTrue:[
        LastRatio := 0.3
    ].

    newPanel := VariableVerticalPanel in:self.
    newPanel origin:0.0 @ 0.0 corner:1.0 @ 1.0.
    newPanel snapMode:#both.

    "
     wrap my existing subview into the new
     variable panel
    "
    sub := self subViews first.
    self removeSubView:sub.
    sub origin:0.0@0.0 corner:1.0@LastRatio.
    newPanel addSubView:sub.

    v := HVScrollableView for:ImageView in:newPanel.
    v origin:(0.0 @ LastRatio) corner:(1.0 @ 1.0).
    imageView := v scrolledView.

    LastExtent notNil ifTrue:[
        self extent:LastExtent
    ].

    "
     ImageInspectorView new realize
     ImageInspectorView inspect:(Image fromFile:'bitmaps/claus.gif')
    "

    "Modified: / 7.9.1998 / 14:15:38 / cg"
! !

!ImageInspectorView methodsFor:'queries'!

labelFor:anObject
    |l|

    l := super labelFor:anObject.
    anObject fileName notNil ifTrue:[
        l := l , ' (''' , anObject fileName , ''')'
    ].
    ^ l


! !

!ImageInspectorView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/ImageInspectorView.st,v 1.17 2000-11-07 11:48:19 cg Exp $'
! !