#define __VER__ 			"39"
#define __REV__	 			"11"
#define __NAME__			"Gallery"
#define __AUTHOR__		"Markus Hillenbrand"

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

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stream.h>

#include <clib/utility_protos.h>

#include "GUIC_AmigaGuide.hpp"
#include "GUIC_Application.hpp"
#include "GUIC_Error.hpp"
#include "GUIC_Event.hpp"
#include "GUIC_Exceptions.hpp"
#include "GUIC_FileExamine.hpp"
#include "GUIC_FontRequester.hpp"
#include "GUIC_Message.hpp"
#include "GUIC_Screen.hpp"
#include "GUIC_ScreenRequester.hpp"
#include "GUIC_System.hpp"

#include "HTMLWindow.hpp"
#include "MainWindow.hpp"
#include "PrefsWindow.hpp"
#include "CompareWindow.hpp"

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

STRPTR V = "$VER: " __NAME__ " " __VER__ "." __REV__ " (" __DATE__ ")";

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

VOID main (LONG argc, STRPTR argv[])
{
	GUIC_SystemC::checkStackSize(50000);
	
	GUIC_ApplicationC 			app(__NAME__);
	GUIC_AmigaGuideC			amigaGuide("Gallery.guide");
	GUIC_ScreenRequesterC	screenRequester;
	GUIC_FontRequesterC		fontRequester;
	GUIC_ScreenC					screen("Workbench");
	
	app.setAuthor		(__AUTHOR__);
	app.setVersion	(__VER__);
	app.setRevision	(__REV__);
	app.setDate		(__DATE__);
	app.setTime		(__TIME__);
	
	app.setInitializer	(TRUE);

	screen.setPicture			("gfx/back.iff");
	screen.setName				("Gallery - (c) by Markus Hillenbrand");
	screen.setPublicMode		(TRUE);
	screen.setPublicName	("Gallery");

	PrefsWindowC		pWindow		(app, screen, screenRequester, fontRequester);
	HTMLWindowC		hWindow		(app, screen, pWindow);
	ManagerWindowC	gWindow		(app, screen, pWindow);
	CompareWindowC	cWindow		(app, screen, pWindow);
	MainWindowC 		mWindow	(app, screen, pWindow, hWindow, gWindow, cWindow);
	
	app.add(amigaGuide);
	app.add(screen);
	
	app.start();

	pWindow.setPrefs();	/* This mist be done after app.start() to enable all saved settings */
	
	screen.add(mWindow);
//	screen.add(gWindow);

	BOOL running = TRUE;
	GUIC_EventC *event = 0;

	while (running && (event = app.wait()) )
		{
		if (event->id == GUIC_CloseWindow)
			{
			if (event->window == (GUIC_WindowC *) &mWindow)
				{
				GUIC_MessageC	message	("Gallery", "Do you really want to quit ?", "Yes|No");
				if (1 == message.request(*event->window)) running = FALSE;
				}
			else pWindow.windowClosed(event->window);
			}
		}

	app.stop();
}

