/*--------------------------------*-C-*---------------------------------*
 * File:	xsetup.h
 *
 * Copyright 1992 John Bovey, University of Kent at Canterbury.
 *
 * You can do what you like with this source code as long as you don't try
 * to make money out of it and you include an unaltered copy of this
 * message (including the copyright).
 *
 * This module has been heavily modified by R. Nation
 * <nation@rocket.sanders.lockheed.com>
 * No additional restrictions are applied
 *
 * Additional modifications by mj olesen <olesen@me.QueensU.CA>
 * No additional restrictions are applied.
 *
 * As usual, the author accepts no responsibility for anything, nor does
 * he guarantee anything whatsoever.
 *----------------------------------------------------------------------*/
#ifndef _XSETUP_H
#define _XSETUP_H

#ifdef KANJI
# define TERM_NAME	"kterm"
# define APL_CLASS	"XTerm"	/* class name */
# define APL_NAME	"kxvt"	/* normal name */
# define APL_SUBCLASS	"KXvt"	/* also check resources under this name */
#else
# define TERM_NAME	"xterm"
# define APL_CLASS	"XTerm"	/* class name */
# define APL_NAME	"rxvt"	/* normal name */
# define APL_SUBCLASS	"RXvt"	/* also check resources under this name */
#endif

#define NEW_NAMES	0	/* don't change these values, they must */
#define NEW_ICON_NAME	1	/* match the normal XTerm convention for */
#define NEW_TITLE_NAME	2	/* interactive name setting */

typedef struct {
   int fwidth, fheight;	/* font width and height [pixels] */
   int width,  height;	/* window size [pixels] */
   int ncol, nrow;	/* window size [characters] */
   int focus;		/* window has focus */
   int saveLines;	/* number of lines that fit in scrollback */
   int hist_count;	/* number of line actually scrolled */
   int hist_start;	/* scrollback view starts here */
   Window parent;	/* parent (main) window */
   Window vt;		/* vt100 window */
   GC gc;		/* GC for drawing text */
   XFontStruct	*font;	/* main font structure */
#ifdef KANJI
   XFontStruct	*kanji;	/* Kanji font structure */
#endif
} TermWin_t;

extern TermWin_t TermWin;

/* gap between the text and window edges */
#define TermWin_internalBorder	2

extern Display		*Xdisplay;

#define Xscreen		DefaultScreen(Xdisplay)
#define Xdepth		DefaultDepth(Xdisplay,Xscreen)
#define Xcmap		DefaultColormap(Xdisplay,Xscreen)

extern unsigned long Options;
#define	Opt_console	(1LU<<0)
#define Opt_loginShell	(1LU<<1)
#define Opt_iconic	(1LU<<2)
#define Opt_visualBell	(1LU<<3)
#define Opt_mapAlert	(1LU<<4)
#define Opt_reverseVideo (1LU<<5)
#define Opt_utmpInhibit	(1LU<<6)
#define Opt_sbSlider	(1LU<<7)
#define Opt_sbArrows	(1LU<<8)
#define Opt_sbRight	(1LU<<9)
#define Opt_scrollBar	(Opt_sbSlider|Opt_sbArrows|Opt_sbRight)
#define Opt_meta8	(1LU<<10)

/* place holder used for parsing command-line options */
#define Opt_Boolean	(1LU<<31)

/*
 *
 */

extern const char *display_name;
extern const char *rs_name;	/* client instance (resource name) */

#if (XlibSpecificationRelease <= 6)
typedef unsigned long Pixel;
#endif

#define COLORFG		0
#define COLORBG		1

/* 0-7: black, red, green, yellow, blue, magenta, cyan, white */
#define COLORMIN	2
#define COLORMAX	(COLORMIN+7)
#define COLOR_BLACK	(COLORMIN)
#ifdef NO_BOLDCOLOR
# define COLOR_WHITE	(COLORMAX)
#else	/* NO_BOLDCOLOR */
# define BOLDMIN	(COLORMAX+1)
# define BOLDMAX	(BOLDMIN+7)
# define COLOR_WHITE	(BOLDMAX)
#endif	/* NO_BOLDCOLOR */
#define NCOLORS	(COLOR_WHITE+1)
#ifndef NO_CURSORCOLOR
# define CURSORCOLOR	(NCOLORS)
# ifndef NO_CURSORCOLOR2
#  define CURSORCOLOR2	(CURSORCOLOR + 1)
#  define NCURSOR	2
# else	/* NO_CURSORCOLOR2 */
#  define NCURSOR	1
# endif	/* NO_CURSORCOLOR2 */
#else	/* NO_CURSORCOLOR */
# define NCURSOR	0
#endif	/* NO_CURSORCOLOR */
#define SCROLLCOLOR		(NCOLORS + NCURSOR)
#define TOPSHADOWCOLOR		(SCROLLCOLOR + 1)
#define BOTTOMSHADOWCOLOR	(SCROLLCOLOR + 2)
#define NSCROLLCOLORS	3

#define RESTORE_FG	39	/* restore default fg color */
#define RESTORE_BG	49	/* restore default bg color */

extern const char *rs_color [NCOLORS + NCURSOR + NSCROLLCOLORS];
extern Pixel pixel_colors [NCOLORS + NCURSOR + NSCROLLCOLORS];

#undef NFONTS
#define NFONTS		5

extern KeySym ks_bigfont;
extern KeySym ks_smallfont;

extern const char *rs_font [NFONTS];
#ifdef KANJI
extern const char *rs_kfont [NFONTS];
#endif

#ifdef PRINTPIPE
extern const char *rs_print_pipe;
extern KeySym ks_printscreen;
#endif
#ifndef NO_MULTIPLE_CLICK
extern const char *rs_cutchars;
#endif

extern KeySym ks_pageup;
extern KeySym ks_pagedown;
#ifdef MAPALERT_OPTION
extern KeySym ks_alert;
#endif

#ifdef __cplusplus
extern "C" {
#endif
   extern const char *my_basename (const char *string);
   extern void	init_display (int argc, char *argv[], char *cmd_argv[]);
   extern void	resize_window (void);
   extern void	xterm_seq (int op, const char *str);
   extern void	print_error (const char *fmt, ...);
   extern void	new_font (int dirn);
   extern void	set_width (unsigned int ncol);
#ifdef __cplusplus
}
#endif

#endif	/* whole file */
/*----------------------- end-of-file (C header) -----------------------*/
