home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / ctw11.zip / CTW-1.1 / ctwP.h < prev    next >
C/C++ Source or Header  |  1992-02-24  |  5KB  |  200 lines

  1. # include <X11/copyright.h>
  2.  
  3. /* $XConsortium: TemplateP.h,v 1.4 89/07/21 01:41:48 kit Exp $ */
  4. /* Copyright    Massachusetts Institute of Technology    1987, 1988 */
  5.  
  6. #ifndef _CtwP_h
  7. #define _CtwP_h
  8.  
  9. # include "ctw.h"
  10. /* include superclass private header file */
  11. #include <X11/CoreP.h>
  12.  
  13. /* define unique representation types not found in <X11/StringDefs.h> */
  14.  
  15. #define XtRCtwResource "CtwResource"
  16.  
  17. typedef struct {
  18. /* private: */
  19.     int    dummy;
  20. } CtwClassPart;
  21.  
  22. typedef struct _CtwClassRec {
  23.     CoreClassPart    core_class;
  24.     CtwClassPart    ctw_class;
  25. } CtwClassRec;
  26.  
  27. extern CtwClassRec ctwClassRec;
  28.  
  29. # define    BEL        0x07
  30. # define    ESC        0x1b
  31. # define    XON        ('q' & 0x1f)
  32. # define    XOFF        ('s' & 0x1f)
  33.  
  34. # define    MAX_ESCBUF    128
  35.  
  36. /**********************************************************************/
  37. /*   Structure containing stats.                      */
  38. /**********************************************************************/
  39. # define COLLECT_STATS    1
  40. # if COLLECT_STATS
  41. struct stats {
  42.     unsigned long    lines_scrolled;
  43.     unsigned long    lines_jumped;
  44.     unsigned long    scroll_ups;
  45.     } ctw_stats;
  46. # endif
  47.  
  48. /**********************************************************************/
  49. /*   Definitions for the multi-click code.                  */
  50. /**********************************************************************/
  51. # define    CLICK_CHAR    0
  52. # define    CLICK_WORD    1
  53. # define    CLICK_LINE    2
  54.  
  55. /**********************************************************************/
  56. /*   Define  a  'byte'. A byte represents a character on the screen.  */
  57. /*   Its  4-bytes  wide containing an 8-bit character, plus a 'font'  */
  58. /*   indicator.   This  is  used  to  indicate  whether  we  have  a  */
  59. /*   line-drawing  character  at that position. Another byte is used  */
  60. /*   to   encode  color  information.  One  more  byte  for  display  */
  61. /*   attributes  (such  as  bold,  reverse  video). And one which is  */
  62. /*   spare for now.                              */
  63. /**********************************************************************/
  64. # define    VB_LINE        0x01
  65. # define    VB_REVERSE    0x02
  66. # define    VB_BOLD        0x04
  67. # define    VB_FLASHING    0x08
  68. # define    VB_UNDERLINE    0x10
  69. # define    VB_SELECT    0x20
  70.  
  71. typedef struct vbyte_t {
  72.     union {
  73.         unsigned long    lbyte;
  74.         struct vb {
  75.             unsigned char    byte;
  76.             unsigned char    attr;
  77.             unsigned char    color;
  78.             unsigned char    spare;
  79.             } vbyte;
  80.         } u;
  81.     } vbyte_t;
  82. # define    vb_byte        u.vbyte.byte
  83. # define    vb_attr        u.vbyte.attr
  84. # define    vb_color    u.vbyte.color
  85. # define    vb_spare    u.vbyte.spare
  86. # define    vb_all        u.lbyte
  87.  
  88. /**********************************************************************/
  89. /*   Color manipulation macros.                          */
  90. /**********************************************************************/
  91. # define    FG_COLOR    0xf0
  92. # define    BG_COLOR    0x0f
  93. # define    FG(x)        ((x) << 4)
  94. # define    BG(x)        (x)
  95. # define    GET_FG(x)    ((x) >> 4)
  96. # define    GET_BG(x)    ((x) & 0x0f)
  97.  
  98. enum cursor_type {
  99.     CURSOR_OFF,
  100.     CURSOR_ON,
  101.     CURSOR_SORT_OF,
  102.     CURSOR_HIDDEN
  103.     };
  104.  
  105. typedef struct {
  106.     /* resources */
  107.     Pixel        window_background;
  108.     String        table;
  109.     Pixel        cursor_color;
  110.     int        rows;
  111.     int        columns;
  112.     XtCallbackList    kbd_callback;
  113.     Boolean        sun_function_keys;
  114.     int        max_lines;
  115.     XtCallbackList    resize_callback;
  116.     XtCallbackList    top_callback;
  117.     XtCallbackList    mouse_callback;
  118.     XtCallbackList    appl_callback;
  119.     char        *geometry;
  120.     int        flashrate;
  121.     char        *font;
  122.     char        *font1;
  123.     char        *font2;
  124.     char        *font3;
  125.     char        *font4;
  126.     char        *font5;
  127.     char        *font6;
  128.     Pixel        hilite_fg;
  129.     Pixel        hilite_bg;
  130.     int        multiClickTime;
  131.  
  132. /* private: */
  133.     XFontStruct    *fontp;
  134.     XFontStruct    *line_fontp;    /* Font for line-drawing graphics. */
  135.     /***********************************************/
  136.     /*   Need  to  keep  track  of size of window  */
  137.     /*   allocated  so  if  window  is resized to  */
  138.     /*   be  larger  than what we have we need to  */
  139.     /*   allocate a new window.               */
  140.     /***********************************************/
  141.     int    win_width_allocated;
  142.     int    win_height_allocated;
  143.  
  144.     /***********************************************/
  145.     /*   Graphics contexts                   */
  146.     /***********************************************/
  147.     GC    gc;        /* Normal text.        */
  148.     GC    line_gc;    /* Line-drawing GC.    */
  149.     GC    cursor_gc;    /* For drawing cursor.    */
  150.  
  151.     int    font_height;
  152.     int    font_width;
  153.     int    char_set;
  154.  
  155.     int    x, y;
  156.     int    saved_x, saved_y;
  157.     int    cursor_visible;
  158.     XtIntervalId    cursor_timer;
  159.     enum cursor_type    cursor_state;
  160.     int    have_focus;    /* Used for cursor flashing.    */
  161.  
  162.     char    escbuf[MAX_ESCBUF];    /* Used to assemble escape sequences*/
  163.     char    *escp;
  164.  
  165.     int    num_exposures;    /* Number of Exposure events to wait for. */
  166.  
  167.     int    old_top_line;
  168.     int    top_line;
  169.  
  170.     int    scroll_top;    /* Top and bottom scrolling region lines. */
  171.     int    scroll_bot;
  172.  
  173.     int    old_rows;
  174.     int    old_columns;
  175.     vbyte_t    *memory;    /* Pointer to originally allocated */
  176.                 /* memory.               */
  177.     vbyte_t    **orig_lines;    /* Array of lines pointers.       */
  178.     vbyte_t    **lines;    /* Array of lines corresponding to screen */
  179.  
  180.     Time    timestamp;    /* Time of last event.    */
  181.     char    *sel_string;    /* Copy of selected text.    */
  182.     int    sel_length;
  183.     int    sel_start_x, sel_start_y; /* Starting co-ordinate of hilite*/
  184.     int    sel_cur_x, sel_cur_y;    /* Current motion position.    */
  185.     int    num_clicks;    /* Number of button clicks for selecting text */
  186.     /***********************************************/
  187.     /*   ANSI escape attributes.               */
  188.     /***********************************************/
  189.     int    old_color;
  190.     vbyte_t    attr;        /* Current display attributes.        */
  191.     int    flags[CTW_MAX_ATTR];
  192. } CtwPart;
  193.  
  194. typedef struct _CtwRec {
  195.     CorePart        core;
  196.     CtwPart        ctw;
  197. } CtwRec;
  198.  
  199. #endif /* _CtwP_h */
  200.