/*
 *  Copyright (c) 1992, 1995 John E. Davis  (davis@space.mit.edu)
 *  All Rights Reserved.
 */
#ifndef _JED_KEYMAP_H_
#define _JED_KEYMAP_H_  
/*Jed Keymap routines.
 *   
 *  The main problem here is how to associate a sequence of characters to a
 *  given function in as fast a way as possible.  In addition, I require that
 *  the procedure be memory efficient as well as allowing the user the
 *  flexability to redefine the keys and add new keymaps.
 * 
 *  To do this, I define a key map to be an array of keys.  There may be many
 *  keymaps (global, local, etc...).    A key structure is defined.
 */
#ifdef HAS_MOUSE
typedef struct
{
   int x, y;			       /* row column of mouse event */
   
#define JMOUSE_UP		1
#define JMOUSE_DOWN		2
#define JMOUSE_DRAG		3
#define JMOUSE_DOUBLE_CLICK	4
#define JMOUSE_TRIPLE_CLICK	5
#define JMOUSE_IGNORE_EVENT	6      /* generated by button up on multiclick. */

   unsigned char type;
   /* Note: The specific values for JMOUSE_BUTTON_? are exploited by the 
    * mouse mapping code in mouse.c
    */
#define JMOUSE_BUTTON_1		0x01
#define JMOUSE_BUTTON_2		0x02
#define JMOUSE_BUTTON_3		0x04
#define JMOUSE_SHIFT		0x08
#define JMOUSE_CTRL		0x10
   unsigned char button;	       /* button that triggered event */
   unsigned char state;		       /* button info BEFORE event */
} JMouse_Type;

extern int jed_mouse_cmd (void);
extern void jed_set_default_mouse_hook (char *, char *);
extern void jed_set_current_mouse_window (void);
extern int jed_mouse_add_event (JMouse_Type *);
extern void jed_flush_mouse_queue (void);
extern void jed_mouse_get_event_info (void);
extern void jed_map_mouse_buttons (int *, int *);
#endif


extern SLKeyMap_List_Type *Global_Map, *Mini_Map;

extern void init_keymaps(void);
extern int digit_arg(void);
extern void do_jed(void);
extern void jed(void);
extern int do_key(void);
extern int kbd_quit(void);
extern FVOID_STAR Last_Key_Function;
extern int *Repeat_Factor;
extern char *find_key(int *);
extern char *what_keymap(void);
extern int which_key(char *);
extern void use_keymap(char *);
extern void set_abort_char(int *);
extern int next_function_list(char *);
extern int open_function_list(char *);

extern char *Read_This_Character;      /* alternate keyboard buffer */
extern void add_to_completion(char *);
extern int is_internal(char *);
extern void dump_bindings (char *);

extern void create_keymap (char *);
extern char Key_Buffer[13];
extern char Jed_Key_Buffer[13];
extern char *Key_Bufferp;
extern int beep (void);
extern void set_current_kbd_command (char *);
extern char Current_Kbd_Command_String[32];
extern char Last_Kbd_Command_String[32];

extern int Jed_Max_Hits;
#endif

