/**
 * Global variables
 * (C) Nettle developers 2000-2002
 *
 * $Id: globals,v 1.56 2003/10/26 15:16:18 ijeffray Exp $
 */

#include "generic.h"
#include "globals.h"

#include "nettle.h"
#include "zapredraw.h"

const char *application_name     =APPLICATION_NAME;
const char *application_icon_name=APPLICATION_ICON_NAME;
bool quit_flag                   =false;

struct os_spriteop_area *sprite_area;

char zap_font[256]       =ZAP_FONT;
char zap_lowres_font[256]=ZAP_LOWRES_FONT;

int *zap_font_area;
int *zap_lowres_font_area;
struct zapredraw_block redraw;

int *zapredraw_area       =0;
int zapredraw_area_number =0;
int size_of_zapredraw_area=0;

colour_t palette[16]=
{
0x00000000, 0x0000D000, 0x00D00000, 0x00D0D000,
0xF0000000, 0xD000D000, 0xD0D00000, 0xD0D0D000,
0x60606000, 0x4040FF00, 0x00FF0000, 0x00FFFF00,
0xFF404000, 0xFF40FF00, 0xFFFF0000, 0xFFFFFF00
};

const colour_t default_palette[16]=
{
0x00000000, 0x0000D000, 0x00D00000, 0x00D0D000,
0xF0000000, 0xD000D000, 0xD0D00000, 0xD0D0D000,
0x60606000, 0x4040FF00, 0x00FF0000, 0x00FFFF00,
0xFF404000, 0xFF40FF00, 0xFFFF0000, 0xFFFFFF00
};

struct coords eig, screensize;
int toolheight;
/* This would be 'nice' to fill-out, but really annoying to do for OS < 3.8 */
/* struct wimp_gadgetsizes gadgetsizes; */

int task_handle;
int wimp_version;
int iconbar_handle;
int menu_window, menu_icon; /* for use with the currently-open menu */
int colourpicker_handle;
int drag_window_handle=0;

/* Template windows */
int win_info;
int win_choices;
int win_paneterm;
int win_panecols;
int win_panehot;
int win_hotpane;
int win_hotedit;
int win_panemisc;
int win_open;
int win_resize;
int win_save;
int win_spoolsave;
int win_sizebar;
int win_termterm;

int menu_open=0;
int resize_handle=0;

int choices_file_version_number      =0;
bool logging                         =LOGGING;
char line_editor                     =LINE_EDITOR;
bool pass_f12                        =PASS_F12;
bool cursor_blink                    =CURSOR_BLINK;
bool blinking                        =BLINKING;
bool dont_require_ctrl               =DONT_REQUIRE_CTRL;
bool scroll_on_keypress              =SCROLL_ON_KEYPRESS;
cursor_t cursor_type                 =cursor_solid;

int line_editor_size                 =LINE_EDITOR_SIZE;
enum nettle_terminal default_terminal=NETTLE_TERMINAL_VT220;
struct coords defaultsize            ={TERMINAL_WIDTH, TERMINAL_HEIGHT};
int defaultscroll                    =SCROLLBACK_LINES;

struct session_struct *sessions       =NULL;
struct session_struct *current_session=NULL;

bool want_blink                         =false;
bool selection_in_progress              =false;
struct session_struct *selection_session=NULL;
int selection_start                     =0;
int selection_end                       =0;
int selection_adjust_dragging           =0;

bool we_own_clipboard                   = false;

const struct session_struct *cursor_session=NULL;
int nextcursortime;
bool cursor_state = false;
colour_t zap_palette[16];

struct session_struct *terminal_menu_session = NULL;

struct session_struct *mouse_handling_session = NULL;

struct session_struct *options_session = NULL;

const char terminal_name[NO_OF_TERMINAL_TYPES][MESSAGE_MAX_TERMINAL]=
{
  "vt100",
  "vt102",
  "vt220",
  "vt320",
  "vt420",
  "vt510",
  "rxvt",
  "xterm",
  "xterm-color",
  "linux"
};
