#define __VERSION__ 	"39"
#define __REVISION__ 	"1"
#define __NAME__			"Picview"
#define __AUTHOR__		"Markus Hillenbrand"

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

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

#include "GUICINCLUDE:GUIC_System.hpp"
#include "GUICINCLUDE:GUIC_Application.hpp"
#include "GUICINCLUDE:GUIC_Screen.hpp"
#include "GUICINCLUDE:GUIC_Event.hpp"
#include "GUICINCLUDE:GUIC_Exceptions.hpp"
#include "GUICINCLUDE:GUIC_ProgramArgs.hpp"

#include "PictureWindow.hpp"

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

STRPTR V = "$VER: " __NAME__ " " __VERSION__ "." __REVISION__ " (" __DATE__ ")";

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

VOID main (LONG argc, STRPTR argv[])
{
	GUIC_SystemC::checkStackSize(50000);

	LONG result[] = { 0,0 };
	STRPTR templ = "PUBSCREEN/A,PICTURE/A";
	GUIC_ProgramArgsC args;
	if (! args.fit(templ, result)) { cerr << "Usage: " << templ << endl; return; }
	
	STRPTR screenName = (STRPTR) result[0];
	STRPTR pictureName = (STRPTR) result[1];
	
	GUIC_ApplicationC app(__NAME__);

	GUIC_ScreenC			screen( screenName );
	PictureWindowC 	pWindow (app, screen);
	
	screen.add(pWindow);

	pWindow.setCloseGadgetMode(TRUE);
	pWindow.activate();
	pWindow.setScaled(FALSE);
	pWindow.setCentered(FALSE);
	
	app.add(screen);
	app.start();

	pWindow.showPicture( pictureName );
	
	BOOL running = TRUE;
	GUIC_EventC *event = 0;

	LONG count = 0;
	
	while (running && (event = app.wait()) )
		{
		if (event->id == GUIC_CloseWindow) running = FALSE;
		}

	app.stop();
}

