/*
 * SplatInfoManager
 * description: a subclass of EKInfoManager for doing a few special things
 * 		with the info panel
 * history:
 *	5/10/93 [Erik Kay] - created
 *	5/23/93 [Erik Kay] - animateToAuthor cycles through the various effects
 */
 
#import "SplatInfoManager.h"

@implementation SplatInfoManager

- init
{
    id img;
    NXRect r;
    NXSize sz, sz2;
    NXPoint pt;
    
    [super init];
    
    // We've got a small problem in that my author tiff is 64x64 and the app
    // tiff is of course 48x48.  So basically I'm going to make a new author
    // tiff that's 64x64, with the 48x48 image centered within it.
    // Perhaps this functionality should be in the base class
    img = appTIFF;
    [img getSize:&sz2];
    [authorTIFF getSize:&sz];
    appTIFF = [[NXImage alloc] initSize:&sz];
    [appTIFF lockFocus];
    PSsetgray(0.667);
    NXSetRect(&r,0,0,sz.width,sz.height);
    NXRectFill(&r);
    pt.x = (sz.width - sz2.width)/2;
    pt.y = (sz.height - sz2.height)/2;
    [img composite:NX_SOVER toPoint:&pt];
    [appTIFF unlockFocus];
    [img free];
    animationSteps = 20;
    
    return self;
}

// Actually do the animation to the author tiff.
// The implementation here cycles through the various effects provided by
// EKInfoManager.

- animateToAuthor:(int)i
{
    static int counter = -1; // which effect we're going to be doing

    if (i == 1) {
	counter ++;
	if (counter > 4)
	    counter = 0;
    }
    switch (counter) {
	case 0:
	    [self dissolveTo:authorTIFF step:i];
	    break;
	case 1:
	    [self slideTo:authorTIFF step:i];
	    break;
	case 2:
	    [self circleTo:authorTIFF step:i];
	    break;
	case 3:
	    [self checkerTo:authorTIFF step:i];
	    break;
	case 4:
	    [self randomTo:authorTIFF step:i];
	    break;
	default:
	    break;
    }
    return self;
}

@end
