150276Speter/****************************************************************************
2166124Srafan * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
350276Speter *                                                                          *
450276Speter * Permission is hereby granted, free of charge, to any person obtaining a  *
550276Speter * copy of this software and associated documentation files (the            *
650276Speter * "Software"), to deal in the Software without restriction, including      *
750276Speter * without limitation the rights to use, copy, modify, merge, publish,      *
850276Speter * distribute, distribute with modifications, sublicense, and/or sell       *
950276Speter * copies of the Software, and to permit persons to whom the Software is    *
1050276Speter * furnished to do so, subject to the following conditions:                 *
1150276Speter *                                                                          *
1250276Speter * The above copyright notice and this permission notice shall be included  *
1350276Speter * in all copies or substantial portions of the Software.                   *
1450276Speter *                                                                          *
1550276Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1650276Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1750276Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1850276Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
1950276Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2050276Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2150276Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2250276Speter *                                                                          *
2350276Speter * Except as contained in this notice, the name(s) of the above copyright   *
2450276Speter * holders shall not be used in advertising or otherwise to promote the     *
2550276Speter * sale, use or other dealings in this Software without prior written       *
2650276Speter * authorization.                                                           *
2750276Speter ************************************************************************** */
2850276Speter
2950276Speter#ifndef TTY_DISPLAY_H
3050276Speter#define TTY_DISPLAY_H 1
3150276Speter
32166124Srafan/*
33166124Srafan * $Id: tty_display.h,v 1.6 2005/01/01 23:41:12 tom Exp $
34166124Srafan */
3576726Speterextern NCURSES_EXPORT(bool) _nc_tty_beep (void);
3676726Speterextern NCURSES_EXPORT(bool) _nc_tty_check_resize (void);
3776726Speterextern NCURSES_EXPORT(bool) _nc_tty_cursor (int);
3876726Speterextern NCURSES_EXPORT(bool) _nc_tty_flash (void);
3976726Speterextern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int);
4076726Speterextern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int);
4176726Speterextern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool);
4276726Speterextern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *);
4376726Speterextern NCURSES_EXPORT(bool) _nc_tty_start_color (void);
4476726Speterextern NCURSES_EXPORT(void) _nc_tty_display_resume (void);
4576726Speterextern NCURSES_EXPORT(void) _nc_tty_display_suspend (void);
4676726Speterextern NCURSES_EXPORT(void) _nc_tty_dispose (void);	/* frees SP->_term */
4776726Speterextern NCURSES_EXPORT(void) _nc_tty_switch_to (void);
4876726Speterextern NCURSES_EXPORT(void) _nc_tty_update (void);
4950276Speter
5050276Speterstruct tty_display_data {
5150276Speter	int             _fifohold;      /* set if breakout marked           */
5250276Speter	unsigned long   _current_attr;  /* terminal attribute current set   */
5350276Speter	int             _cursrow;       /* physical cursor row (-1=unknown) */
5450276Speter	int             _curscol;       /* physical cursor column           */
5550276Speter
5650276Speter	/* cursor movement costs; units are 10ths of milliseconds */
5750276Speter	int             _char_padding;  /* cost of character put            */
5850276Speter	int             _cr_cost;       /* cost of (carriage_return)        */
5950276Speter	int             _cup_cost;      /* cost of (cursor_address)         */
6050276Speter	int             _home_cost;     /* cost of (cursor_home)            */
6150276Speter	int             _ll_cost;       /* cost of (cursor_to_ll)           */
6250276Speter#if USE_HARD_TABS
6350276Speter	int             _ht_cost;       /* cost of (tab)                    */
6450276Speter	int             _cbt_cost;      /* cost of (backtab)                */
6550276Speter#endif /* USE_HARD_TABS */
6650276Speter	int             _cub1_cost;     /* cost of (cursor_left)            */
6750276Speter	int             _cuf1_cost;     /* cost of (cursor_right)           */
6850276Speter	int             _cud1_cost;     /* cost of (cursor_down)            */
6950276Speter	int             _cuu1_cost;     /* cost of (cursor_up)              */
7050276Speter	int             _cub_cost;      /* cost of (parm_cursor_left)       */
7150276Speter	int             _cuf_cost;      /* cost of (parm_cursor_right)      */
7250276Speter	int             _cud_cost;      /* cost of (parm_cursor_down)       */
7350276Speter	int             _cuu_cost;      /* cost of (parm_cursor_up)         */
7450276Speter	int             _hpa_cost;      /* cost of (column_address)         */
7550276Speter	int             _vpa_cost;      /* cost of (row_address)            */
7650276Speter	/* used in lib_doupdate.c, must be chars */
7750276Speter	int             _ed_cost;       /* cost of (clr_eos)                */
7850276Speter	int             _el_cost;       /* cost of (clr_eol)                */
7950276Speter	int             _el1_cost;      /* cost of (clr_bol)                */
8050276Speter	int             _dch1_cost;     /* cost of (delete_character)       */
8150276Speter	int             _ich1_cost;     /* cost of (insert_character)       */
8250276Speter	int             _dch_cost;      /* cost of (parm_dch)               */
8350276Speter	int             _ich_cost;      /* cost of (parm_ich)               */
8450276Speter	int             _ech_cost;      /* cost of (erase_chars)            */
8550276Speter	int             _rep_cost;      /* cost of (repeat_char)            */
8650276Speter	int             _hpa_ch_cost;   /* cost of (column_address)         */
8750276Speter	int             _cup_ch_cost;   /* cost of (cursor_address)         */
8850276Speter	int             _smir_cost;	/* cost of (enter_insert_mode)      */
8950276Speter	int             _rmir_cost;	/* cost of (exit_insert_mode)       */
9050276Speter	int             _ip_cost;       /* cost of (insert_padding)         */
9150276Speter	/* used in lib_mvcur.c */
9250276Speter	char *          _address_cursor;
9350276Speter	int             _carriage_return_length;
9450276Speter	int             _cursor_home_length;
9550276Speter	int             _cursor_to_ll_length;
9650276Speter
9750276Speter	chtype          _xmc_suppress;  /* attributes to suppress if xmc     */
9850276Speter	chtype          _xmc_triggers;  /* attributes to process if xmc      */
9950276Speter
10050276Speter	bool            _sig_winch;
10150276Speter};
10250276Speter
10350276Speter
10450276Speter#define DelCharCost(count) \
10550276Speter		((parm_dch != 0) \
10650276Speter		? D->_dch_cost \
10750276Speter		: ((delete_character != 0) \
10850276Speter			? (D->_dch1_cost * count) \
10950276Speter			: INFINITY))
11050276Speter
11150276Speter#define InsCharCost(count) \
11250276Speter		((parm_ich != 0) \
11350276Speter		? D->_ich_cost \
11450276Speter		: ((enter_insert_mode && exit_insert_mode) \
11550276Speter		  ? D->_smir_cost + D->_rmir_cost + (D->_ip_cost * count) \
11650276Speter		  : ((insert_character != 0) \
117166124Srafan		    ? ((D->_ich1_cost + D->_ip_cost) * count) \
11850276Speter		    : INFINITY)))
11950276Speter
12050276Speter#if USE_XMC_SUPPORT
121166124Srafan#define UpdateAttrs(c)	if (!SameAttrOf(D->_current_attr, AttrOf(c))) { \
12250276Speter				attr_t chg = D->_current_attr; \
12350276Speter				vidattr(AttrOf(c)); \
12450276Speter				if (magic_cookie_glitch > 0 \
12550276Speter				 && XMC_CHANGES((chg ^ D->_current_attr))) { \
12650276Speter					T(("%s @%d before glitch %d,%d", \
12750276Speter						__FILE__, __LINE__, \
12850276Speter						D->_cursrow, \
12950276Speter						D->_curscol)); \
13050276Speter					_nc_do_xmc_glitch(chg); \
13150276Speter				} \
13250276Speter			}
13350276Speter#else
134166124Srafan#define UpdateAttrs(c)	if (!SameAttrOf(D->_current_attr, AttrOf(c))) \
13550276Speter				vidattr(AttrOf(c));
13650276Speter#endif
13750276Speter
13850276Speter#define XMC_CHANGES(c) ((c) & D->_xmc_suppress)
13950276Speter
14050276Speter#endif /* TTY_DISPLAY_H */
141