|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* window.h Constants, prototypes etc. for the window routines.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* $Id: window.h,v 1.16 2007-10-10 20:18:20 al-guest Exp $
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* This file is part of the minicom communications package,
|
|
Packit |
15a96c |
* Copyright 1991-1996 Miquel van Smoorenburg.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* This program is free software; you can redistribute it and/or
|
|
Packit |
15a96c |
* modify it under the terms of the GNU General Public License
|
|
Packit |
15a96c |
* as published by the Free Software Foundation; either version
|
|
Packit |
15a96c |
* 2 of the License, or (at your option) any later version.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* You should have received a copy of the GNU General Public License along
|
|
Packit |
15a96c |
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit |
15a96c |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit |
15a96c |
*
|
|
Packit |
15a96c |
* fmg 1/11/94 colors
|
|
Packit |
15a96c |
* fmg 8/20/97 added stuff for history search section
|
|
Packit |
15a96c |
* fmg 8/21/97 added kludged F_key support for RedHat4.1
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#include <stddef.h>
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* One character is contained in a "ELM"
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
typedef struct _elm {
|
|
Packit |
15a96c |
wchar_t value;
|
|
Packit |
15a96c |
char attr;
|
|
Packit |
15a96c |
char color;
|
|
Packit |
15a96c |
} ELM;
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Control struct of a window
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
typedef struct _win {
|
|
Packit |
15a96c |
int x1, y1, x2, y2; /* Coordinates */
|
|
Packit |
15a96c |
int sy1, sy2; /* Scrolling region */
|
|
Packit |
15a96c |
int xs, ys; /* x and y size */
|
|
Packit |
15a96c |
char border; /* type of border */
|
|
Packit |
15a96c |
char cursor; /* Does it have a cursor */
|
|
Packit |
15a96c |
char attr; /* Current attribute of window */
|
|
Packit |
15a96c |
char color; /* Current color of window */
|
|
Packit |
15a96c |
char autocr; /* With '\n', do an automatic '\r' */
|
|
Packit |
15a96c |
char doscroll; /* Automatically scroll up */
|
|
Packit |
15a96c |
char wrap; /* Wrap around edge */
|
|
Packit |
15a96c |
char direct; /* Direct write to screen ? */
|
|
Packit |
15a96c |
short curx, cury; /* current x and y */
|
|
Packit |
15a96c |
char o_cursor;
|
|
Packit |
15a96c |
short o_curx;
|
|
Packit |
15a96c |
short o_cury;
|
|
Packit |
15a96c |
char o_attr;
|
|
Packit |
15a96c |
char o_color; /* Position & attributes before window was opened */
|
|
Packit |
15a96c |
ELM *map; /* Map of contents */
|
|
Packit |
15a96c |
ELM *histbuf; /* History buffer. */
|
|
Packit |
15a96c |
int histlines; /* How many lines we keep in the history buffer */
|
|
Packit |
15a96c |
int histline; /* Current line in the history buffer. */
|
|
Packit |
15a96c |
} WIN;
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Stdwin is the whole screen
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
extern WIN *stdwin; /* Whole screen */
|
|
Packit |
15a96c |
extern int LINES, COLS; /* Size of sreen */
|
|
Packit |
15a96c |
extern int usecolor; /* Use ansi color escape sequences */
|
|
Packit |
15a96c |
extern int useattr; /* Use attributes (reverse, bold etc. ) */
|
|
Packit |
15a96c |
extern int dirflush; /* Direct flush after write */
|
|
Packit |
15a96c |
extern int screen_ibmpc; /* Literal pass-through of all characters? */
|
|
Packit |
15a96c |
extern int screen_iso; /* Literal pass-through of all characters? */
|
|
Packit |
15a96c |
extern int w_init; /* Already initialized? */
|
|
Packit |
15a96c |
extern char *_tptr;
|
|
Packit |
15a96c |
extern int use_status; /* Turned on in main() */
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* fmg 1/11/94 colors */
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
extern int mfcolor; /* Menu Foreground Color */
|
|
Packit |
15a96c |
extern int mbcolor; /* Menu Background Color */
|
|
Packit |
15a96c |
extern int tfcolor; /* Terminal Foreground Color */
|
|
Packit |
15a96c |
extern int tbcolor; /* Terminal Background Color */
|
|
Packit |
15a96c |
extern int sfcolor; /* Status Bar Foreground Color */
|
|
Packit |
15a96c |
extern int sbcolor; /* Status Bar Background Color */
|
|
Packit |
15a96c |
extern const char *J_col[]; /* Color's names */
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Possible attributes.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define XA_NORMAL 0
|
|
Packit |
15a96c |
#define XA_BLINK 1
|
|
Packit |
15a96c |
#define XA_BOLD 2
|
|
Packit |
15a96c |
#define XA_REVERSE 4
|
|
Packit |
15a96c |
#define XA_STANDOUT 8
|
|
Packit |
15a96c |
#define XA_UNDERLINE 16
|
|
Packit |
15a96c |
#define XA_ALTCHARSET 32
|
|
Packit |
15a96c |
#define XA_BLANK 64
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Possible colors
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define BLACK 0
|
|
Packit |
15a96c |
#define RED 1
|
|
Packit |
15a96c |
#define GREEN 2
|
|
Packit |
15a96c |
#define YELLOW 3
|
|
Packit |
15a96c |
#define BLUE 4
|
|
Packit |
15a96c |
#define MAGENTA 5
|
|
Packit |
15a96c |
#define CYAN 6
|
|
Packit |
15a96c |
#define WHITE 7
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#define COLATTR(fg, bg) (((fg) << 4) + (bg))
|
|
Packit |
15a96c |
#define COLFG(ca) ((ca) >> 4)
|
|
Packit |
15a96c |
#define COLBG(ca) ((ca) % 16)
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Possible borders.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define BNONE 0
|
|
Packit |
15a96c |
#define BSINGLE 1
|
|
Packit |
15a96c |
#define BDOUBLE 2
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Scrolling directions.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define S_UP 1
|
|
Packit |
15a96c |
#define S_DOWN 2
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Cursor types.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define CNONE 0
|
|
Packit |
15a96c |
#define CNORMAL 1
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Title Positions
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define TLEFT 0
|
|
Packit |
15a96c |
#define TMID 1
|
|
Packit |
15a96c |
#define TRIGHT 2
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Function prototypes.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
int wxgetch(void);
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
void mc_wflush(void);
|
|
Packit |
15a96c |
WIN *mc_wopen(int x1, int y1, int x2, int y2, int border,
|
|
Packit |
15a96c |
int attr, int fg, int bg, int direct, int hl, int rel);
|
|
Packit |
15a96c |
void mc_wclose(WIN *win, int replace);
|
|
Packit |
15a96c |
void mc_wleave(void);
|
|
Packit |
15a96c |
void mc_wreturn(void);
|
|
Packit |
15a96c |
void mc_wresize(WIN *w, int x, int y);
|
|
Packit |
15a96c |
void mc_wredraw(WIN *w, int newdirect);
|
|
Packit |
15a96c |
void mc_wscroll(WIN *win, int dir);
|
|
Packit |
15a96c |
void mc_wlocate(WIN *win, int x, int y);
|
|
Packit |
15a96c |
void mc_wputc(WIN *win, wchar_t c);
|
|
Packit |
15a96c |
void mc_wdrawelm(WIN *win, int y, ELM *e);
|
|
Packit |
15a96c |
void mc_wputs(WIN *win, const char *s);
|
|
Packit |
15a96c |
int mc_wprintf(WIN *, const char *, ...)
|
|
Packit |
15a96c |
__attribute__((format(printf, 2, 3)));
|
|
Packit |
15a96c |
void mc_wbell(void);
|
|
Packit |
15a96c |
void mc_wcursor(WIN *win, int type);
|
|
Packit |
15a96c |
void mc_wtitle(WIN *w, int pos , const char *s);
|
|
Packit |
15a96c |
void mc_wcurbar(WIN *w, int y , int attr);
|
|
Packit |
15a96c |
int mc_wselect(int x, int y, const char *const *choices,
|
|
Packit |
15a96c |
void (*const *funlist)(void) ,
|
|
Packit |
15a96c |
const char *title , int attr , int fg , int bg );
|
|
Packit |
15a96c |
void mc_wclrch(WIN *w, int n);
|
|
Packit |
15a96c |
void mc_wclrel(WIN *w);
|
|
Packit |
15a96c |
void mc_wclreol(WIN *w);
|
|
Packit |
15a96c |
void mc_wclrbol(WIN *w);
|
|
Packit |
15a96c |
void mc_wclreos(WIN *w);
|
|
Packit |
15a96c |
void mc_wclrbos(WIN *w);
|
|
Packit |
15a96c |
void mc_winclr(WIN *w);
|
|
Packit |
15a96c |
void mc_winsline(WIN *w);
|
|
Packit |
15a96c |
void mc_wdelline(WIN *w);
|
|
Packit |
15a96c |
void mc_winschar(WIN *w);
|
|
Packit |
15a96c |
void mc_winschar2(WIN *w, wchar_t c, int move);
|
|
Packit |
15a96c |
void mc_wdelchar(WIN *w);
|
|
Packit |
15a96c |
int mc_wgets(WIN *win, char *s, int linemax, int totmax);
|
|
Packit |
15a96c |
int mc_wgetwcs(WIN *win, wchar_t *s, int linemax, int totmax);
|
|
Packit |
15a96c |
void win_end(void);
|
|
Packit |
15a96c |
#ifdef BBS
|
|
Packit |
15a96c |
int win_init(char *term, int lines);
|
|
Packit |
15a96c |
#else
|
|
Packit |
15a96c |
int win_init(int fg, int bg, int attr);
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
/* fmg 8/20/97: both needed by history search section */
|
|
Packit |
15a96c |
void mc_wdrawelm_inverse( WIN *w, int y, ELM *e);
|
|
Packit |
15a96c |
void mc_wdrawelm_var(WIN *w, ELM *e, wchar_t *buf);
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Some macro's that can be used as functions.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
#define mc_wsetregion(w, z1, z2) (((w)->sy1=(w)->y1+(z1)),((w)->sy2=(w)->y1+(z2)))
|
|
Packit |
15a96c |
#define mc_wresetregion(w) ( (w)->sy1 = (w)->y1, (w)->sy2 = (w)->y2 )
|
|
Packit |
15a96c |
#define mc_wgetattr(w) ( (w)->attr )
|
|
Packit |
15a96c |
#define mc_wsetattr(w, a) ( (w)->attr = (a) )
|
|
Packit |
15a96c |
#define mc_wsetfgcol(w, fg) ( (w)->color = ((w)->color & 15) + ((fg) << 4))
|
|
Packit |
15a96c |
#define mc_wsetbgcol(w, bg) ( (w)->color = ((w)->color & 240) + (bg) )
|
|
Packit |
15a96c |
#define mc_wsetam(w) ( (w)->wrap = 1 )
|
|
Packit |
15a96c |
#define mc_wresetam(w) ( (w)->wrap = 0 )
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/*
|
|
Packit |
15a96c |
* Allright, now the macro's for our keyboard routines.
|
|
Packit |
15a96c |
*/
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#define K_BS 8
|
|
Packit |
15a96c |
#define K_ESC 27
|
|
Packit |
15a96c |
#define K_STOP 256
|
|
Packit |
15a96c |
#define K_F1 257
|
|
Packit |
15a96c |
#define K_F2 258
|
|
Packit |
15a96c |
#define K_F3 259
|
|
Packit |
15a96c |
#define K_F4 260
|
|
Packit |
15a96c |
#define K_F5 261
|
|
Packit |
15a96c |
#define K_F6 262
|
|
Packit |
15a96c |
#define K_F7 263
|
|
Packit |
15a96c |
#define K_F8 264
|
|
Packit |
15a96c |
#define K_F9 265
|
|
Packit |
15a96c |
#define K_F10 266
|
|
Packit |
15a96c |
#define K_F11 277
|
|
Packit |
15a96c |
#define K_F12 278
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#define K_HOME 267
|
|
Packit |
15a96c |
#define K_PGUP 268
|
|
Packit |
15a96c |
#define K_UP 269
|
|
Packit |
15a96c |
#define K_LT 270
|
|
Packit |
15a96c |
#define K_RT 271
|
|
Packit |
15a96c |
#define K_DN 272
|
|
Packit |
15a96c |
#define K_END 273
|
|
Packit |
15a96c |
#define K_PGDN 274
|
|
Packit |
15a96c |
#define K_INS 275
|
|
Packit |
15a96c |
#define K_DEL 276
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#define NUM_KEYS 23
|
|
Packit |
15a96c |
#define KEY_OFFS 256
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Here's where the meta keycode start. (512 + keycode). */
|
|
Packit |
15a96c |
#define K_META 512
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
#ifndef EOF
|
|
Packit |
15a96c |
# define EOF ((int) -1)
|
|
Packit |
15a96c |
#endif
|
|
Packit |
15a96c |
#define K_ERA '\b'
|
|
Packit |
15a96c |
#define K_KILL ((int) -2)
|
|
Packit |
15a96c |
|
|
Packit |
15a96c |
/* Internal structure. */
|
|
Packit |
15a96c |
struct key {
|
|
Packit |
15a96c |
char *cap;
|
|
Packit |
15a96c |
char len;
|
|
Packit |
15a96c |
};
|
|
Packit |
15a96c |
|