/*
 * Module:
 *	NeXT
 *
 * Author:
 *	Doug "Kareth" McClure
 *	asd@cc.purdue.edu
 *	XASD@PURCCVM.BITNET
 *
 * Version: 1.0
*/

#import "NeXTView.h"
#import "Thinker.h"
#import "NeXTWraps.h"
#import <appkit/NXImage.h>
#import <appkit/Window.h>
#import <appkit/Panel.h>                // for NXRunAlertPanel()
#import <dpsclient/wraps.h>
#import <libc.h>
#import <math.h>

#define TIME_DELAY	10

@implementation NeXTView

- oneStep
{
  static int count = 0;
  static float xScale = 1.0, dscx = 0.0, dscy = 0.0, setg = 0.0;

  if ( count++ < TIME_DELAY )
    {
      return self;
    }
  count = 0;

  PSsendfloat(setg);
  PSsendfloat(xScale);
  PSsendfloat(xPos);
  PSsendfloat(yPos);
  PSsendfloat(xSize);
  PSsendfloat(ySize);
  psNeXTLogo();

  xScale += dscx;
  if ( xScale >= 1.0 )
    {
      dscx = -0.05;
    }

  if ( xScale <= 0.0 )
    {
      dscx = 0.05;
    }

  setg += dscy;
  if ( setg >= 1.0 )
    {
      dscy = -0.05;
      setg = 1.0;
    }
  
  if ( setg <= 0.0 )
    {
      dscy = 0.05;
      setg = 0.0;
    }
  
  return self;
}


- initFrame:(NXRect *)frameRect
{
  [super initFrame:frameRect];
  [self newSize];

  return self;
}


- sizeTo:(NXCoord)width :(NXCoord)height
{
  [super sizeTo:width :height];
  [self newSize];

  return self;
}


- newSize
{
  xSize = bounds.size.width;
  (xPos = xSize / 2.0);
  xSize = xPos - 146.0;

  ySize = bounds.size.height;
  yPos = (ySize / 2.0) - 166.0;
  ySize = yPos + 10.0;

  return self;
}


@end
