/*
 *  XLeScrabble - X version of the popular board game, in french and
 *  for 1 to 4 players.
 *
 * This software comes with NO warranty whatsoever. I therefore take no
 * responsibility for any damages, losses or problems caused through use
 * or misuse of this program.
 *
 * I hereby grant permission for this program to be freely copied and
 * distributed by any means, provided no charge is made for it.
 *
 * Matthew Chapman, csuoq@csv.warwick.ac.uk
 *    Oct 1994.
 */

/* xinit.c - global declarations */

#include "scrab.h"

XtAppContext app_context;
Widget topLevel,sq[MAXPLAYERS][BOARDSIZE][BOARDSIZE];
Widget br[MAXPLAYERS][LONGBAR];
Widget message[MAXPLAYERS];
Widget all,title;
Widget barw[MAXPLAYERS],tilesleft[MAXPLAYERS];
Widget timeleft[MAXPLAYERS],scoretitle,scorebox[MAXPLAYERS];
Widget menuButton[MAXPLAYERS],menu[MAXPLAYERS],menu_item[MAXPLAYERS][MENU_ITEMS];

struct AppData {
    int version,players,timelim,t[4];
    String disp[4],name[4];
    Boolean load;
    String dictfile,permfile,scorefile;
} app_data;

/* buttons */
Widget finish[MAXPLAYERS],change[MAXPLAYERS];
Widget pass[MAXPLAYERS],evaluate[MAXPLAYERS];

Widget title;
Widget blankshell,hi_scoretop[MAXPLAYERS],blankf,blanktitle,a2z[NUMLETTERS];
Widget changeshell,changef,changetitle,changeconfirm,changecancel;
Widget changeletts[BARLEN],topl[MAXPLAYERS],lvtop[MAXPLAYERS],lvdismiss[MAXPLAYERS];
Widget hi_score_ent[MAXPLAYERS][MAXPLAYERS],hi_dismiss[MAXPLAYERS];
Widget bestgotop[MAXPLAYERS],bestgodismiss[MAXPLAYERS],bestgomain[MAXPLAYERS];
Widget keytop[MAXPLAYERS],keydismiss[MAXPLAYERS];
Widget abouttop[MAXPLAYERS],aboutdismiss[MAXPLAYERS];
Widget messtop[MAXPLAYERS];
Widget compw[MAXPLAYERS];

/* extra buttons */
Widget lastgo[MAXPLAYERS],revert[MAXPLAYERS],juggle[MAXPLAYERS];

Display *dpy[MAXPLAYERS];

char bar[MAXPLAYERS][LONGBAR];
Pixmap bgxpm,mark[MAXPLAYERS];
Boolean menu_status[MAXPLAYERS][MENU_ITEMS];

char *colours[] =
{
	"aquamarine1","lightblue","steelblue","navajowhite","red"
};

Boolean is_perm[BOARDSIZE][BOARDSIZE];
Boolean waiting=False,waiting_for_blank,waiting_for_change,finished_go;
char blank_letter;

char cboard[BOARDSIZE][BOARDSIZE];

/* to check for everyone passing */
int num_passed=0;

int type[MAXPLAYERS];

/* for the timer */
int comp,time_limit;
