/***************************************************************************
* statistics.c : berechnet die Zeit, die zum Malen des Moleküls im Ka-	   *
*		 lottenmodus benötigt wurde und zeigt diese in einem	   *
*		 Requester an						   *
***************************************************************************/

#include <intuition/intuition.h>
#include <proto/intuition.h>
#include "messages.h"

extern struct Border OKBorder;
extern struct IntuiText OKText;

static struct Gadget OK = {
	NULL,	    /* next gadget */
	75,80,	      /* origin XY of hit box relative to window TopLeft */
	90,16,	/* hit box width and height */
	GADGHBOX,   /* gadget flags */
	RELVERIFY|ENDGADGET,	  /* activation flags */
	BOOLGADGET,	/* gadget type flags */
	(APTR)&OKBorder, /* gadget border or image to be rendered */
	NULL,	/* alternate imagery for selection */
	&OKText,	/* first IntuiText structure */
	NULL,	/* gadget mutual-exclude long word */
	NULL,	/* SpecialInfo structure */
	1,     /* user-definable data */
	NULL	/* pointer to user-definable data */
};

static SHORT StatVectors2[]={ 0,0,237,0,237,99,0,99,0,0 };

static struct Border StatBorder2={ 1,0,2,0,JAM1,5,StatVectors2,NULL };

static SHORT StatVectors[]={ 0,0,235,0,235,97,0,97,0,0 };

static struct Border StatBorder={ 2,1,1,0,JAM1,5,StatVectors,&StatBorder2 };

static struct Requester StatRequester=
{
  NULL,200,50,240,100,0,0,&OK,&StatBorder,NULL,NULL,0,NULL,NULL,NULL,
  NULL, NULL
};

extern int Nachricht();

void StatRequest(struct Window *win, long Zeit, int anzahl)
{
  long success;
  char dummy[26];
  struct IntuiMessage *message;

  success=Request(&StatRequester,win);
  if(success)
  {
    ReqPrint(&StatRequester,STATISTICS,6,0,-1,10);
    ReqPrint(&StatRequester,STAT_TIME,1,0,10,30);
    sprintf(dummy,"%02d.%02d min",Zeit/60,Zeit % 60);
    ReqPrint(&StatRequester,dummy,3,0,140,30);
    ReqPrint(&StatRequester,STAT_NUM,1,0,10,50);
    sprintf(dummy,"%02d",anzahl);
    ReqPrint(&StatRequester,dummy,3,0,164,50);
/*    if ((message = (struct IntuiMessage *) GetMsg(win->UserPort)) == NULL)
      Wait(1L << win->UserPort->mp_SigBit);
    ReplyMsg(message);
    while (message = (struct IntuiMessage *) GetMsg(win->UserPort))
      ReplyMsg(message);*/
  }
}
