Back to index

tetex-bin  3.0
tty_display.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc.              *
00003  *                                                                          *
00004  * Permission is hereby granted, free of charge, to any person obtaining a  *
00005  * copy of this software and associated documentation files (the            *
00006  * "Software"), to deal in the Software without restriction, including      *
00007  * without limitation the rights to use, copy, modify, merge, publish,      *
00008  * distribute, distribute with modifications, sublicense, and/or sell       *
00009  * copies of the Software, and to permit persons to whom the Software is    *
00010  * furnished to do so, subject to the following conditions:                 *
00011  *                                                                          *
00012  * The above copyright notice and this permission notice shall be included  *
00013  * in all copies or substantial portions of the Software.                   *
00014  *                                                                          *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
00017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
00018  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
00019  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
00020  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
00021  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
00022  *                                                                          *
00023  * Except as contained in this notice, the name(s) of the above copyright   *
00024  * holders shall not be used in advertising or otherwise to promote the     *
00025  * sale, use or other dealings in this Software without prior written       *
00026  * authorization.                                                           *
00027  ************************************************************************** */
00028 
00029 #ifndef TTY_DISPLAY_H
00030 #define TTY_DISPLAY_H 1
00031 
00032 /*
00033  * $Id: tty_display.h,v 1.5 2003/08/02 22:59:07 Philippe.Blain Exp $
00034  */
00035 extern NCURSES_EXPORT(bool) _nc_tty_beep (void);
00036 extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void);
00037 extern NCURSES_EXPORT(bool) _nc_tty_cursor (int);
00038 extern NCURSES_EXPORT(bool) _nc_tty_flash (void);
00039 extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int);
00040 extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int);
00041 extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool);
00042 extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *);
00043 extern NCURSES_EXPORT(bool) _nc_tty_start_color (void);
00044 extern NCURSES_EXPORT(void) _nc_tty_display_resume (void);
00045 extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void);
00046 extern NCURSES_EXPORT(void) _nc_tty_dispose (void);     /* frees SP->_term */
00047 extern NCURSES_EXPORT(void) _nc_tty_switch_to (void);
00048 extern NCURSES_EXPORT(void) _nc_tty_update (void);
00049 
00050 struct tty_display_data {
00051        int             _fifohold;      /* set if breakout marked           */
00052        unsigned long   _current_attr;  /* terminal attribute current set   */
00053        int             _cursrow;       /* physical cursor row (-1=unknown) */
00054        int             _curscol;       /* physical cursor column           */
00055 
00056        /* cursor movement costs; units are 10ths of milliseconds */
00057        int             _char_padding;  /* cost of character put            */
00058        int             _cr_cost;       /* cost of (carriage_return)        */
00059        int             _cup_cost;      /* cost of (cursor_address)         */
00060        int             _home_cost;     /* cost of (cursor_home)            */
00061        int             _ll_cost;       /* cost of (cursor_to_ll)           */
00062 #if USE_HARD_TABS
00063        int             _ht_cost;       /* cost of (tab)                    */
00064        int             _cbt_cost;      /* cost of (backtab)                */
00065 #endif /* USE_HARD_TABS */
00066        int             _cub1_cost;     /* cost of (cursor_left)            */
00067        int             _cuf1_cost;     /* cost of (cursor_right)           */
00068        int             _cud1_cost;     /* cost of (cursor_down)            */
00069        int             _cuu1_cost;     /* cost of (cursor_up)              */
00070        int             _cub_cost;      /* cost of (parm_cursor_left)       */
00071        int             _cuf_cost;      /* cost of (parm_cursor_right)      */
00072        int             _cud_cost;      /* cost of (parm_cursor_down)       */
00073        int             _cuu_cost;      /* cost of (parm_cursor_up)         */
00074        int             _hpa_cost;      /* cost of (column_address)         */
00075        int             _vpa_cost;      /* cost of (row_address)            */
00076        /* used in lib_doupdate.c, must be chars */
00077        int             _ed_cost;       /* cost of (clr_eos)                */
00078        int             _el_cost;       /* cost of (clr_eol)                */
00079        int             _el1_cost;      /* cost of (clr_bol)                */
00080        int             _dch1_cost;     /* cost of (delete_character)       */
00081        int             _ich1_cost;     /* cost of (insert_character)       */
00082        int             _dch_cost;      /* cost of (parm_dch)               */
00083        int             _ich_cost;      /* cost of (parm_ich)               */
00084        int             _ech_cost;      /* cost of (erase_chars)            */
00085        int             _rep_cost;      /* cost of (repeat_char)            */
00086        int             _hpa_ch_cost;   /* cost of (column_address)         */
00087        int             _cup_ch_cost;   /* cost of (cursor_address)         */
00088        int             _smir_cost; /* cost of (enter_insert_mode)      */
00089        int             _rmir_cost; /* cost of (exit_insert_mode)       */
00090        int             _ip_cost;       /* cost of (insert_padding)         */
00091        /* used in lib_mvcur.c */
00092        char *          _address_cursor;
00093        int             _carriage_return_length;
00094        int             _cursor_home_length;
00095        int             _cursor_to_ll_length;
00096 
00097        chtype          _xmc_suppress;  /* attributes to suppress if xmc     */
00098        chtype          _xmc_triggers;  /* attributes to process if xmc      */
00099 
00100        bool            _sig_winch;
00101 };
00102 
00103 
00104 #define DelCharCost(count) \
00105               ((parm_dch != 0) \
00106               ? D->_dch_cost \
00107               : ((delete_character != 0) \
00108                      ? (D->_dch1_cost * count) \
00109                      : INFINITY))
00110 
00111 #define InsCharCost(count) \
00112               ((parm_ich != 0) \
00113               ? D->_ich_cost \
00114               : ((enter_insert_mode && exit_insert_mode) \
00115                 ? D->_smir_cost + D->_rmir_cost + (D->_ip_cost * count) \
00116                 : ((insert_character != 0) \
00117                   ? ((D->_ich1_cost + D->_ip_cost) * count) \
00118                   : INFINITY)))
00119 
00120 #if USE_XMC_SUPPORT
00121 #define UpdateAttrs(c)      if (D->_current_attr != AttrOf(c)) { \
00122                             attr_t chg = D->_current_attr; \
00123                             vidattr(AttrOf(c)); \
00124                             if (magic_cookie_glitch > 0 \
00125                              && XMC_CHANGES((chg ^ D->_current_attr))) { \
00126                                    T(("%s @%d before glitch %d,%d", \
00127                                           __FILE__, __LINE__, \
00128                                           D->_cursrow, \
00129                                           D->_curscol)); \
00130                                    _nc_do_xmc_glitch(chg); \
00131                             } \
00132                      }
00133 #else
00134 #define UpdateAttrs(c)      if (D->_current_attr != AttrOf(c)) \
00135                             vidattr(AttrOf(c));
00136 #endif
00137 
00138 #define XMC_CHANGES(c) ((c) & D->_xmc_suppress)
00139 
00140 #endif /* TTY_DISPLAY_H */