// COPYRIGHT (C) 1990-1999.  All Rights Reserved. - INTL2.CPP
// Zinc Software Incorporated.  Pleasant Grove, Utah  USA
// May be freely copied, used and distributed.

#include <zaf.hpp>
#include "intl2.inc"

int ZafApplication::Main(void)
{
	// Ensure main() is linked properly.
	LinkMain();

	// Establish access to external objects and data.
	ZafStorage *storage = new ZafStorage(ZAF_ITEXT("intl2.znc"), ZAF_FILE_READ);
	if (storage->Error())
	{
		zafErrorSystem->ReportError(ZAF_NULLP(ZafWindowObject),
			ZAF_ITEXT("Error"), ZAF_DIALOG_OK,
			ZAF_ITEXT("intl2.znc could not be found."));
		delete storage;
		return (-1);
	}

	zafObjectPersistence = new UserPersist(storage);

	// Load the window.
	ZafWindow *window = new ZafWindow(ZAF_ITEXT("International"), *zafObjectPersistence);
	zafWindowManager->Center(window);
	zafWindowManager->Add(window);


	// Get the user input.
	Control();

	delete zafObjectPersistence;
	zafObjectPersistence = ZAF_NULLP(ZafObjectPersistence);
	delete storage;

	// Return success.
	return (0);
}
