/*************************************/
/*            Jump v1.1              */
/*            =========              */
/* (C) 1995 by Ben Matthew.  Module  */
/* for English Clock v4.3+           */
/* Now reverts back to old screen if */
/* it fails (no more crashing with	 */
/* CED                               */
/*************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <clib/intuition_protos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <intuition/intuition.h>
#include <exec/exec.h>
#include <proto/locale.h>
#include <proto/graphics.h>

extern struct NewWindow win1;
extern char screen[200];
extern char *screen_ptr;
extern struct Menu menu1;
extern struct Window *win_p;
extern struct Screen *pubscreen;
extern void msg(char *msg);
extern BOOL reset_all;

extern short closeall(void);

extern struct Catalog *catalog;
extern struct TextFont *win_font;

BOOL jump(void);

struct QuickMsg {
	struct Message base;
	char id[20];
	char msg[500];
};


BOOL jump(void) {
	/***********************************/
	/* Jump() © 1995 by Ben Matthew    */
	/* $VERS 1.1                       */
	/* Description: Jumps window to    */
	/* next public screen, takes no    */
	/* parameters and returns success  */
	/***********************************/

	char buffer[200];
	struct Screen *dummy;

	NextPubScreen(pubscreen,buffer);
	
	dummy=LockPubScreen(buffer);
	if(dummy) {
		ClearMenuStrip(win_p);
		CloseWindow(win_p);
		UnlockPubScreen(NULL,pubscreen);
		pubscreen=dummy;
		win1.Screen=pubscreen;
		win_p=(struct Window *)OpenWindow(&win1);
		if(!win_p) {
			msg(GetCatalogStr(catalog,29,"Jump went wrong! (Debug: OpenWindow() "));
			closeall();
			exit(NULL);
		}
		SetMenuStrip(win_p,&menu1 );
		if(win_font) SetFont(win_p->RPort,win_font);
		reset_all=TRUE;
	}
	
	return(1);
}
