/* Display.c
 *   Contains functions for displaying text, eg help, messages, errors
 *   and choices (returning 1 for Yes or 2 for No)
 */
#include <intuition/intuition.h>
#include <exec/memory.h>
#include <stdio.h>
#include <string.h>
#include "mm2.h"

#define MINWINWIDTH 170

/* Prototypes */
Prototype void DisplayE(char **);
Prototype void DisplayT(char **);
Prototype void DisplayH(char **);
Prototype int DisplayC(char **);
Prototype int Display(char **,int,int,int);

extern struct IntuitionBase *IntuitionBase;

/*====================================================================*/
void DisplayE(char **txt)
  {
  Display(txt, 2, 0, 3);
  }
/*====================================================================*/
void DisplayT(char **txt)
  {
  Display(txt, 1, 1, 0);
  }
/*====================================================================*/
void DisplayH(char **txt)
  {
  Display(txt, 1, 2, 3);
  }
/*====================================================================*/
DisplayC(char **txt)
  {
  return Display(txt, 0, 2, 3);
  }
/*====================================================================*/

Display(char **txt, int Mode, int FColour, int BColour)
{
  struct EasyStruct reqnochoice = {
    sizeof( struct EasyStruct ),
    0,
    "MemoMaster V2.1",
    "%s",
    "Okay"
  };
  struct EasyStruct reqchoice = {
    sizeof( struct EasyStruct ),
    0,
    "MemoMaster V2.1",
    "%s",
    "Yes|No"
  };
  char *text;
  char msg[1024];

  strcpy(msg,"");
  text = *txt;
  while (*txt != NULL)
  {
    sprintf(msg,"%s%s\n",msg,*txt++);
  }

  if (Mode == 0)
  {
    if (EasyRequest(mm_w,&reqchoice,NULL,msg))
      return(1);
    else
      return(2);
  }
  else
    EasyRequest(mm_w,&reqnochoice,NULL,msg);
}

