home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / src / dispextern.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-13  |  5.9 KB  |  212 lines

  1. /* Interface definitions for display code.
  2.    Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU Emacs.
  5.  
  6. GNU Emacs is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU Emacs is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Emacs; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef DISPEXTERN_DOT_H
  21. #define DISPEXTERN_DOT_H
  22.  
  23. #ifdef emacs
  24. /* Nonzero means don't assume anything about current
  25.    contents of actual terminal screen */
  26. extern int screen_garbaged;
  27.  
  28. /* Nonzero means last display completed and cursor is really at
  29.    cursX, cursY.  Zero means it was preempted. */
  30. extern int display_completed;
  31.  
  32. /* Nonzero if window sizes or contents have changed
  33.    since last redisplay that finished */
  34. extern int windows_or_buffers_changed;
  35.  
  36. #endif /* emacs */
  37.  
  38. #if defined(HAVE_X_WINDOWS) && defined(emacs)
  39. #include <X11/Xlib.h>
  40. #endif
  41.  
  42. struct face
  43. {
  44.   unsigned char underline;
  45.   unsigned char hilited;
  46.   unsigned char modif;
  47. #ifdef HAVE_X_WINDOWS
  48.   GC         facegc;
  49. #ifdef emacs
  50.   XFontStruct *    font;
  51. #else
  52.   void *    font;
  53. #endif
  54.   unsigned long    foreground;
  55.   unsigned long    background;
  56.   Pixmap    back_pixmap;
  57.   unsigned int    pixmap_w, pixmap_h /* , pixmap_depth */;
  58. #endif /* HAVE_X_WINDOWS */
  59. };
  60.  
  61. enum run_type
  62. {
  63.   unused_run,
  64.   glyph,
  65.   column_glyph,
  66.   font,
  67.   space,
  68.   window            /* indicate a window change */
  69. };
  70.  
  71. struct run
  72. {
  73.   enum run_type type;
  74.   int length;            /* Length in glyphs */
  75.   struct face *faceptr;
  76.   struct window* w;        /* window starting here */
  77.   int bufp;            /* position in buffer */
  78.   Lisp_Object class;        /* extent containing, if any */
  79.   int begin_p;            /* 1 begin glyph 0 if end glyph*/
  80. #ifdef HAVE_X_WINDOWS
  81.   int pix_length;        /* Length in pixels */
  82. #endif
  83. #ifdef LINE_INFO_COLUMN
  84.   int lineinfo_glyph_index;    /* Since glyphs in the lineinfo column don't
  85.                    go into the glyphs array (because they
  86.                    don't take up screen space) we need to
  87.                    store them somewhere. */
  88. #endif
  89. };
  90.  
  91. /* This structure is used for the actual display of text on a screen.
  92.  
  93.    There are two instantiations of it:  the glyphs currently displayed,
  94.    and the glyphs we desire to display.  The latter object is generated
  95.    from buffers being displayed. */
  96.  
  97. struct screen_glyphs
  98.   {
  99. #ifdef MULTI_SCREEN
  100.     struct screen *screen;    /* Screen these glyphs belong to. */
  101. #endif /* MULTI_SCREEN */
  102.     int height;
  103.     int width;
  104.  
  105.     int *used;            /* Vector of widths (in chars) of lines. */
  106.     GLYPH **glyphs;        /* glyphs[Y][X] is the GLYPH at X,Y. */
  107.     GLYPH *total_contents;    /* The actual contents. `glyphs' points here */
  108.     char *enable;        /* Vector indicating meaningful contents. */
  109.     int   *bufp;        /* Buffer offset of this line's first char. */
  110.     int *nruns;            /* N runs of differently displayed text. */
  111.     struct run **face_list;
  112.     struct run *faces;
  113.  
  114.     int short_cut_taken;    /* 1 if any short_cut was taken during redisplay */
  115.  
  116. #ifdef HAVE_X_WINDOWS
  117.     short *top_left_x;        /* Pixel position of top left corner */
  118.     short *top_left_y;
  119.     short *pix_width;        /* Pixel width of line. */
  120.     short *pix_height;        /* Pixel height of line. */
  121.     short *max_ascent;        /* Pixel value of max font->ascent of line. */
  122. #endif    /* HAVE_X_WINDOWS */
  123.   };
  124.  
  125. #define GLYPH_CLASS_VECTOR_SIZE 100
  126.  
  127. #ifdef emacs
  128.  
  129. struct glyphs_from_chars
  130.   {
  131.     UCHAR c;
  132.     GLYPH *glyphs;
  133. #ifdef LINE_INFO_COLUMN
  134.     Lisp_Object info_column_glyphs;
  135. #endif
  136.     int columns;
  137.     struct face *faceptr;
  138.     Lisp_Object begin_class[GLYPH_CLASS_VECTOR_SIZE];
  139.     Lisp_Object end_class[GLYPH_CLASS_VECTOR_SIZE];
  140.     short n_nonfont;
  141.     int next_visible;
  142.     UCHAR begin_or_end;        /* 0:none, 1:end, 2:begin, 3:both */
  143. #ifdef HAVE_X_WINDOWS
  144.     int begin_columns;
  145.     int begin_pixel_width;
  146.     int end_columns;
  147.     int end_pixel_width;
  148.     int pixel_width;
  149.     int pixel_height;
  150. #endif
  151.     /* The chars in the buffer being processed that lie between
  152.        [run_pos_lower, run_pos_upper] are promised to be in the same run,
  153.        and to be separated from begin and/or end glyphs, provided they fit
  154.        on the same line. This means that there are NO pixel-maps 
  155.        (sometimes called glyphs in other contexts) or font changes in the 
  156.        display of the chars in this range. It is NOT promised to be a 
  157.        maximal such range. */
  158.     int run_pos_lower;
  159.     int run_pos_upper;
  160.   };
  161.  
  162. #endif /* emacs */
  163.  
  164. #ifdef HAVE_X_WINDOWS
  165. struct glyph_dimensions
  166.   {
  167.     int top_left_x;
  168.     int top_left_y;
  169.     int width;
  170.     int height;
  171.     int run;
  172.   };
  173. #endif /* HAVE_X_WINDOWS */
  174.  
  175. #define GLYPH_LINE_SIZE(s) ((int) SCREEN_DESIRED_GLYPHS (s)->glyphs[1]   \
  176.                 - (int) SCREEN_DESIRED_GLYPHS (s)->glyphs[0])
  177. #define RUN_LINE_SIZE(s) ((int) SCREEN_DESIRED_GLYPHS (s)->face_list[1]     \
  178.                 - (int) SCREEN_DESIRED_GLYPHS (s)->face_list[0])
  179.  
  180.  
  181. #ifdef HAVE_X_WINDOWS
  182. /* The window width preceding the truncation glyph */
  183. #define TRUNCATE_WIDTH(s) (SCREEN_IS_X (s)            \
  184.             ? (MAX_LINE_WIDTH (s)            \
  185.                - builtin_truncator_pixmap.width)    \
  186.             : max_width - 1)
  187. /* The window width preceding the continuer glyph */
  188. #define CONTINUE_WIDTH(s) (SCREEN_IS_X (s)            \
  189.             ? (MAX_LINE_WIDTH (s) -            \
  190.                builtin_continuer_pixmap.width)    \
  191.             : max_width - 1)
  192. #endif
  193.  
  194. #ifdef emacs
  195.  
  196. extern void get_display_line ();
  197. extern struct face default_face;
  198.  
  199. extern char *message_buf;
  200. extern int message_buf_size;
  201. extern int in_display;
  202.  
  203. extern struct face *change_attributes ();
  204. extern void mark_attributes ();
  205. extern struct face *copy_attributes ();
  206. extern struct glyph_dimensions *get_glyph_dimensions ();
  207. extern struct glyphs_from_chars *glyphs_from_bufpos ();
  208.  
  209. #endif /* emacs */
  210.  
  211. #endif /* DISPEXTERN_DOT_H */
  212.