/* Compile me to get full executable. */

#include <stdio.h>
#include "NodeGUI.c"

/* Cut the core out of this function and edit it suitably. */

void ProcessWindowNodeWnd( LONG Class, UWORD Code, APTR IAddress )
{
struct Gadget *gad;
switch ( Class )
	{
	case IDCMP_GADGETUP :
		/* Gadget message, gadget = gad. */
		gad = (struct Gadget *)IAddress;
		switch ( gad->GadgetID ) 
			{
			case NodeWnd_InitModem :
				/* Button pressed  , Text of gadget : Init Modem */
				break;
			case NodeWnd_ChatNow :
				/* Button pressed  , Text of gadget : Chat */
				break;
			case NodeWnd_Settings :
				/* Button pressed  , Text of gadget : Settings */
				break;
			case NodeWnd_Information :
				/* Button pressed  , Text of gadget : Info */
				break;
			case NodeWnd_Screen :
				/* Button pressed  , Text of gadget : Watch */
				break;
			case NodeWnd_ChatFlag :
				/* Cycle changed   , Text of gadget :  */
				break;
			case NodeWnd_OffHook :
				/* Cycle changed   , Text of gadget :  */
				break;
			case NodeWnd_Reserve :
				/* Cycle changed   , Text of gadget :  */
				break;
			}
		break;
	case IDCMP_CLOSEWINDOW :
		/* CloseWindow Now */
		break;
	case IDCMP_REFRESHWINDOW :
		GT_BeginRefresh( NodeWnd);
		/* Refresh window. */
	RendWindowNodeWnd( NodeWnd, NodeWndVisualInfo );
		GT_EndRefresh( NodeWnd, TRUE);
	GT_RefreshWindow( NodeWnd, NULL);
	RefreshGList( NodeWndGList, NodeWnd, NULL, ~0);
		break;
	case IDCMP_VANILLAKEY :
		/* Processed key press */
		/* gadgets need processing perhaps. */
		break;
	}
}

/* Cut the core out of this function and edit it suitably. */

void ProcessWindowInfoWin( LONG Class, UWORD Code, APTR IAddress )
{
struct Gadget *gad;
switch ( Class )
	{
	case IDCMP_GADGETUP :
		/* Gadget message, gadget = gad. */
		gad = (struct Gadget *)IAddress;
		switch ( gad->GadgetID ) 
			{
			case InfoWin_LV1_Cycle1 :
				/* Cycle changed   , Text of gadget :  */
				break;
			case InfoWin_LV1 :
				/* ListView pressed, Text of gadget :  */
				break;
			}
		break;
	case IDCMP_CLOSEWINDOW :
		/* CloseWindow Now */
		break;
	case IDCMP_REFRESHWINDOW :
		GT_BeginRefresh( InfoWin);
		/* Refresh window. */
	RendWindowInfoWin( InfoWin, InfoWinVisualInfo );
		GT_EndRefresh( InfoWin, TRUE);
	GT_RefreshWindow( InfoWin, NULL);
	RefreshGList( InfoWinGList, InfoWin, NULL, ~0);
		break;
	}
}

/* Cut the core out of this function and edit it suitably. */

void ProcessWindowSettingsWin( LONG Class, UWORD Code, APTR IAddress )
{
struct Gadget *gad;
switch ( Class )
	{
	case IDCMP_GADGETUP :
		/* Gadget message, gadget = gad. */
		gad = (struct Gadget *)IAddress;
		switch ( gad->GadgetID ) 
			{
			case SettingsWin_ScreenMode :
				/* Button pressed  , Text of gadget : Screen Mode */
				break;
			case SettingsWin_WinOrScreen :
				/* Cycle changed   , Text of gadget :  */
				break;
			case SettingsWin_ModemDebug :
				/* CheckBox changed, Text of gadget : Modem Debug */
				break;
			case SettingsWin_ModemLog :
				/* CheckBox changed, Text of gadget : Modem Log */
				break;
			case SettingsWin_AllowLogins :
				/* CheckBox changed, Text of gadget : Allow Logins */
				break;
			case SettingsWin_SaveWin :
				/* Button pressed  , Text of gadget : Save Windows */
				break;
			case SettingsWin_DeviceConfig :
				/* Button pressed  , Text of gadget : Device Config */
				break;
			case SettingsWin_NodeConfig :
				/* Button pressed  , Text of gadget : Node Config */
				break;
			case SettingsWin_CallersLog :
				/* Button pressed  , Text of gadget : Callers Log */
				break;
			case SettingsWin_DoorLog :
				/* Button pressed  , Text of gadget : Door Log */
				break;
			case SettingsWin_DumpModem :
				/* CheckBox changed, Text of gadget : Dump Modem */
				break;
			}
		break;
	case IDCMP_CLOSEWINDOW :
		/* CloseWindow Now */
		break;
	case IDCMP_REFRESHWINDOW :
		GT_BeginRefresh( SettingsWin);
		/* Refresh window. */
	RendWindowSettingsWin( SettingsWin, SettingsWinVisualInfo );
		GT_EndRefresh( SettingsWin, TRUE);
	GT_RefreshWindow( SettingsWin, NULL);
	RefreshGList( SettingsWinGList, SettingsWin, NULL, ~0);
		break;
	}
}


int main(void)
{
int done=0;
ULONG class;
UWORD code;
struct Gadget *pgsel;
struct IntuiMessage *imsg;
if (OpenLibs()==0)
	{
	OpenDiskFonts();
	if (OpenNodeWndWindow()==0)
		{
		while(done==0)
			{
			Wait(1L << NodeWnd->UserPort->mp_SigBit);
			imsg=GT_GetIMsg(NodeWnd->UserPort);
			while (imsg != NULL )
				{
				class=imsg->Class;
				code=imsg->Code;
				pgsel=(struct Gadget *)imsg->IAddress; /* Only reference if it is a gadget message */
				GT_ReplyIMsg(imsg);
				ProcessWindowNodeWnd(class, code, pgsel);
				/* The next line is just so you can quit, remove when proper method implemented. */
				if (class==IDCMP_CLOSEWINDOW)
					done=1;
				imsg=GT_GetIMsg(NodeWnd->UserPort);
				}
			}
		
		CloseNodeWndWindow();
		}
	else
		printf("Cannot open window.\n");
	CloseLibs();
	}
else
	printf("Cannot open libraries.\n");
}
