/***********************************************************************

	       Get a Number routines for StripANSI v1.2

			Written by Syd L. Bolton
		©1992 Legendary Design Technologies Inc.

	Date:	Nov 15, 1992  Time: 12:01 am   Revision: 001
 ***********************************************************************/

#include "getnum.h"

get_num()
{
struct IntuiMessage *message;
ULONG class;
int gn_exit=0;

sprintf(GNGadget1SIBuff,"%d",tabspc);

NewGNWin.TopEdge=Window->TopEdge+72;
NewGNWin.LeftEdge=Window->LeftEdge+195;

if(!(GNWindow=OpenWindow(&NewGNWin))) {
	return(-1);
	}

ActivateGadget(&GNGadget1,GNWindow,NULL);

do {
	WaitPort(GNWindow->UserPort);
		while ( ( message=(struct IntuiMessage *)
			GetMsg(GNWindow->UserPort) ) != NULL)
		{
		class=message->Class;
		ReplyMsg(message); 

		if (class==GADGETUP) gn_exit=gnum_gad(message);
		}
	} while (gn_exit==0);
CloseWindow(GNWindow);
return(gn_exit);
}

gnum_gad(message)
struct IntuiMessage *message;
{
struct Gadget *igad;
int gadgid;

igad=(struct Gadget *)message->IAddress;
gadgid=igad->GadgetID;

switch(gadgid) {
	case 1: 
	case 3:	tabspc=atoi(GNGadget1SIBuff);
		return(1);

	case 2: return(-1);

	default: break;
	}
return(0);
}
