/* Main-Header File inserted by GenCodeC */
/* Libraries */
#include <libraries/mui.h>
#include <libraries/gadtools.h> /* for BARLABEL in MenuItem */

/* Prototypes */
#include <proto/muimaster.h>
#include <proto/exec.h>
#include <clib/alib_protos.h>
#include <proto/dos.h>

/*  Ansi  */
#include <stdlib.h>
#include <stdio.h>
/* GenCodeC header end */

/* Include generated by GenCodeC */
#include "WicConPrefsGUI.h"

/* Declarations for libraries (inserted by GenCodeC) */
struct Library * MUIMasterBase;
struct ObjApp * App = NULL;	/* Object */
VOID SetHelp(VOID);
extern Object *checks[];
extern ULONG quals[];
extern ULONG masks[];
extern VOID ReadPrefs(VOID);

/* Init() function */
void init( void )
{
	if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
	{
		printf("Can't Open MUIMaster Library\n");
		exit(20);
	}
}
/* GenCodeC init() end */

/* End() function */
void end( void )
{
	CloseLibrary(MUIMasterBase);
	exit(20);
}
/* GenCodeC end() end */

/* Main Function inserted by GenCodeC */
int main(int argc,char **argv)
{
	BOOL	running = TRUE;
	ULONG	signal, x;

	/* Program initialisation : generated by GenCodeC */
	init();

	/* Create Object : generated by GenCodeC */
	if (!(App = CreateApp()))
	{
		printf("Can't Create App\n");
		end();
	}

    set(App->MainWin, MUIA_Window_Sleep, TRUE);
    set(App->BigLV, MUIA_List_Quiet, TRUE);
    SetHelp();
    ReadPrefs();
    set(App->BigLV, MUIA_List_Quiet, FALSE);

	checks[0] = App->LShiftChk;
	checks[1] = App->RShiftChk;
	checks[2] = App->LAltChk;
	checks[3] = App->RAltChk;
	checks[4] = App->CtrlChk;
	checks[5] = App->LAmigaChk;
	checks[6] = App->RAmigaChk;
    checks[7] = App->MidButChk;

    for (x = 0; x < 8; x++) {
        if (quals[0] & masks[x])
            set(checks[x], MUIA_Selected, TRUE);
    }
    set(App->MainWin, MUIA_Window_Sleep, FALSE);

	while (running)
	{
		switch (DoMethod(App->App,MUIM_Application_Input,&signal))
		{
			case MUIV_Application_ReturnID_Quit:
				running = FALSE;
				break;

			/* Insert your code between the "case" statement and comment "end of case ..." */
			/* End computing of IDCMP */
		}
		if (running && signal) Wait(signal);
	}
	DisposeApp(App);
	end();
}

VOID SetHelp(VOID)
{
    set(App->RecordGad, MUIA_ShortHelp, "Record the info below into the selected item.");
    set(App->NewGad, MUIA_ShortHelp, "Create a space for a new item.");
    set(App->RemGad, MUIA_ShortHelp, "Delete the selected item.");
    set(App->NameStr, MUIA_ShortHelp, "The text that will appear in the taskbar button.");
    set(App->PatStr, MUIA_ShortHelp, "An AmigaDOS pattern.");
    set(App->IconPop, MUIA_ShortHelp, "An icon to use in the taskbar button.");
    set(App->ColorStr, MUIA_ShortHelp, "The pen number of the text in the taskbar button.");
    set(App->BGColorStr, MUIA_ShortHelp, "The pen number of the background of the taskbar button.");
    set(App->OffsetStr, MUIA_ShortHelp, "The character in the window title at this position\nis considered the first character.");
    set(App->LShiftChk, MUIA_ShortHelp, "The left 'shift' key.");
    set(App->RShiftChk, MUIA_ShortHelp, "The right 'shift' key.");
    set(App->LAltChk, MUIA_ShortHelp, "The left 'alt' key.");
    set(App->RAltChk, MUIA_ShortHelp, "The right 'alt' key.");
    set(App->CtrlChk, MUIA_ShortHelp, "The 'ctrl' key.");
    set(App->LAmigaChk, MUIA_ShortHelp, "The left 'Amiga' key.");
    set(App->RAmigaChk, MUIA_ShortHelp, "The rigth 'Amiga' key.");
    set(App->ActionMX, MUIA_ShortHelp, "These are the operations WinControl\ncan perform on windows.");
    set(App->SaveGad, MUIA_ShortHelp, "Save the list.");
    set(App->QuitGad, MUIA_ShortHelp, "Quit without saving.");
}
            
