1 /* $OpenBSD: tty_display.h,v 1.3 2001/01/22 18:02:00 millert Exp $ */ 2 3 /**************************************************************************** 4 * Copyright (c) 1998,2000 Free Software Foundation, Inc. * 5 * * 6 * Permission is hereby granted, free of charge, to any person obtaining a * 7 * copy of this software and associated documentation files (the * 8 * "Software"), to deal in the Software without restriction, including * 9 * without limitation the rights to use, copy, modify, merge, publish, * 10 * distribute, distribute with modifications, sublicense, and/or sell * 11 * copies of the Software, and to permit persons to whom the Software is * 12 * furnished to do so, subject to the following conditions: * 13 * * 14 * The above copyright notice and this permission notice shall be included * 15 * in all copies or substantial portions of the Software. * 16 * * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 24 * * 25 * Except as contained in this notice, the name(s) of the above copyright * 26 * holders shall not be used in advertising or otherwise to promote the * 27 * sale, use or other dealings in this Software without prior written * 28 * authorization. * 29 ************************************************************************** */ 30 31 #ifndef TTY_DISPLAY_H 32 #define TTY_DISPLAY_H 1 33 34 extern NCURSES_EXPORT(bool) _nc_tty_beep (void); 35 extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); 36 extern NCURSES_EXPORT(bool) _nc_tty_cursor (int); 37 extern NCURSES_EXPORT(bool) _nc_tty_flash (void); 38 extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int); 39 extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int); 40 extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool); 41 extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *); 42 extern NCURSES_EXPORT(bool) _nc_tty_start_color (void); 43 extern NCURSES_EXPORT(void) _nc_tty_display_resume (void); 44 extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void); 45 extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */ 46 extern NCURSES_EXPORT(void) _nc_tty_switch_to (void); 47 extern NCURSES_EXPORT(void) _nc_tty_update (void); 48 49 struct tty_display_data { 50 int _fifohold; /* set if breakout marked */ 51 unsigned long _current_attr; /* terminal attribute current set */ 52 int _cursrow; /* physical cursor row (-1=unknown) */ 53 int _curscol; /* physical cursor column */ 54 55 /* cursor movement costs; units are 10ths of milliseconds */ 56 int _char_padding; /* cost of character put */ 57 int _cr_cost; /* cost of (carriage_return) */ 58 int _cup_cost; /* cost of (cursor_address) */ 59 int _home_cost; /* cost of (cursor_home) */ 60 int _ll_cost; /* cost of (cursor_to_ll) */ 61 #if USE_HARD_TABS 62 int _ht_cost; /* cost of (tab) */ 63 int _cbt_cost; /* cost of (backtab) */ 64 #endif /* USE_HARD_TABS */ 65 int _cub1_cost; /* cost of (cursor_left) */ 66 int _cuf1_cost; /* cost of (cursor_right) */ 67 int _cud1_cost; /* cost of (cursor_down) */ 68 int _cuu1_cost; /* cost of (cursor_up) */ 69 int _cub_cost; /* cost of (parm_cursor_left) */ 70 int _cuf_cost; /* cost of (parm_cursor_right) */ 71 int _cud_cost; /* cost of (parm_cursor_down) */ 72 int _cuu_cost; /* cost of (parm_cursor_up) */ 73 int _hpa_cost; /* cost of (column_address) */ 74 int _vpa_cost; /* cost of (row_address) */ 75 /* used in lib_doupdate.c, must be chars */ 76 int _ed_cost; /* cost of (clr_eos) */ 77 int _el_cost; /* cost of (clr_eol) */ 78 int _el1_cost; /* cost of (clr_bol) */ 79 int _dch1_cost; /* cost of (delete_character) */ 80 int _ich1_cost; /* cost of (insert_character) */ 81 int _dch_cost; /* cost of (parm_dch) */ 82 int _ich_cost; /* cost of (parm_ich) */ 83 int _ech_cost; /* cost of (erase_chars) */ 84 int _rep_cost; /* cost of (repeat_char) */ 85 int _hpa_ch_cost; /* cost of (column_address) */ 86 int _cup_ch_cost; /* cost of (cursor_address) */ 87 int _smir_cost; /* cost of (enter_insert_mode) */ 88 int _rmir_cost; /* cost of (exit_insert_mode) */ 89 int _ip_cost; /* cost of (insert_padding) */ 90 /* used in lib_mvcur.c */ 91 char * _address_cursor; 92 int _carriage_return_length; 93 int _cursor_home_length; 94 int _cursor_to_ll_length; 95 96 chtype _xmc_suppress; /* attributes to suppress if xmc */ 97 chtype _xmc_triggers; /* attributes to process if xmc */ 98 99 bool _sig_winch; 100 }; 101 102 103 #define DelCharCost(count) \ 104 ((parm_dch != 0) \ 105 ? D->_dch_cost \ 106 : ((delete_character != 0) \ 107 ? (D->_dch1_cost * count) \ 108 : INFINITY)) 109 110 #define InsCharCost(count) \ 111 ((parm_ich != 0) \ 112 ? D->_ich_cost \ 113 : ((enter_insert_mode && exit_insert_mode) \ 114 ? D->_smir_cost + D->_rmir_cost + (D->_ip_cost * count) \ 115 : ((insert_character != 0) \ 116 ? (D->_ich1_cost * count) \ 117 : INFINITY))) 118 119 #if USE_XMC_SUPPORT 120 #define UpdateAttrs(c) if (D->_current_attr != AttrOf(c)) { \ 121 attr_t chg = D->_current_attr; \ 122 vidattr(AttrOf(c)); \ 123 if (magic_cookie_glitch > 0 \ 124 && XMC_CHANGES((chg ^ D->_current_attr))) { \ 125 T(("%s @%d before glitch %d,%d", \ 126 __FILE__, __LINE__, \ 127 D->_cursrow, \ 128 D->_curscol)); \ 129 _nc_do_xmc_glitch(chg); \ 130 } \ 131 } 132 #else 133 #define UpdateAttrs(c) if (D->_current_attr != AttrOf(c)) \ 134 vidattr(AttrOf(c)); 135 #endif 136 137 #define XMC_CHANGES(c) ((c) & D->_xmc_suppress) 138 139 #endif /* TTY_DISPLAY_H */ 140