]> code.delx.au - gnu-emacs/blobdiff - src/dispextern.h
Fix typos in docstrings, comments and ChangeLogs.
[gnu-emacs] / src / dispextern.h
index 88373c7dddcde52bcbd94d20580e0f7b9bf9ac53..ca91c5b681207d1a225e726dd4022e7db69dc13c 100644 (file)
@@ -1,14 +1,14 @@
 /* Interface definitions for display code.
    Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002,
-                 2003, 2004, 2005, 2006, 2007, 2008
+                 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
                  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,9 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* New redisplay written by Gerd Moellmann <gerd@gnu.org>.  */
 
@@ -63,10 +61,10 @@ typedef XImage *XImagePtr;
 typedef HDC XImagePtr_or_DC;
 #endif
 
-#ifdef MAC_OS
-#include "macgui.h"
-typedef struct mac_display_info Display_Info;
-/* Mac equivalent of XImage.  */
+#ifdef HAVE_NS
+#include "nsgui.h"
+/* following typedef needed to accomodate the MSDOS port, believe it or not */
+typedef struct ns_display_info Display_Info;
 typedef Pixmap XImagePtr;
 typedef XImagePtr XImagePtr_or_DC;
 #endif
@@ -107,6 +105,8 @@ enum window_part
 /* Number of bits allocated to store fringe bitmap numbers.  */
 #define FRINGE_ID_BITS  16
 
+/* Number of bits allocated to store fringe bitmap height.  */
+#define FRINGE_HEIGHT_BITS 8
 
 \f
 /***********************************************************************
@@ -175,10 +175,10 @@ extern int trace_redisplay_p;
 struct text_pos
 {
   /* Character position.  */
-  int charpos;
+  EMACS_INT charpos;
 
   /* Corresponding byte position.  */
-  int bytepos;
+  EMACS_INT bytepos;
 };
 
 /* Access character and byte position of POS in a functional form.  */
@@ -276,7 +276,7 @@ enum glyph_type
   /* Glyph describes a character.  */
   CHAR_GLYPH,
 
-  /* Glyph describes a composition sequence.  */
+  /* Glyph describes a static composition.  */
   COMPOSITE_GLYPH,
 
   /* Glyph describes an image.  */
@@ -313,7 +313,7 @@ struct glyph
      buffer, this is a position in that buffer.  A value of -1
      together with a null object means glyph is a truncation glyph at
      the start of a row.  */
-  int charpos;
+  EMACS_INT charpos;
 
   /* Lisp object source of this glyph.  Currently either a buffer or
      a string, if the glyph was produced from characters which came from
@@ -368,7 +368,11 @@ struct glyph
      doesn't have a glyph in a font.  */
   unsigned glyph_not_available_p : 1;
 
-#define FACE_ID_BITS   21
+  /* Non-zero means don't display cursor here.  */
+  unsigned avoid_cursor_p : 1;
+
+#define FACE_ID_BITS   20
 
   /* Face of the glyph.  This is a realized face ID,
      an index in the face cache of the frame.  */
@@ -388,8 +392,17 @@ struct glyph
     /* Character code for character glyphs (type == CHAR_GLYPH).  */
     unsigned ch;
 
-    /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH)  */
-    unsigned cmp_id;
+    /* Sub-structures for type == COMPOSITION_GLYPH.  */
+    struct
+    {
+      /* Flag to tell if the composition is automatic or not.  */
+      unsigned automatic : 1;
+      /* ID of the composition.  */
+      unsigned id    : 23;
+      /* Start and end indices of glyphs of the composition.  */
+      unsigned from : 4;
+      unsigned to : 4;
+    } cmp;
 
     /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
     unsigned img_id;
@@ -767,6 +780,12 @@ struct glyph_row
   /* Face of the right fringe glyph.  */
   unsigned right_fringe_face_id : FACE_ID_BITS;
 
+  /* Vertical offset of the left fringe bitmap.  */
+  signed left_fringe_offset : FRINGE_HEIGHT_BITS;
+
+  /* Vertical offset of the right fringe bitmap.  */
+  signed right_fringe_offset : FRINGE_HEIGHT_BITS;
+
   /* 1 means that we must draw the bitmaps of this row.  */
   unsigned redraw_fringe_bitmaps_p : 1;
 
@@ -1161,19 +1180,17 @@ struct glyph_string
   struct face *face;
 
   /* Font in which this string is to be drawn.  */
-  XFontStruct *font;
-
-  /* Font info for this string.  */
-  struct font_info *font_info;
+  struct font *font;
 
-  /* Non-null means this string describes (part of) a composition.
-     All characters from char2b are drawn composed.  */
+  /* Non-null means this string describes (part of) a static
+     composition.  */
   struct composition *cmp;
 
-  /* Index of this glyph string's first character in the glyph
-     definition of CMP.  If this is zero, this glyph string describes
-     the first character of a composition.  */
-  int gidx;
+  /* If not negative, this string describes a compos.  */
+  int cmp_id;
+
+  /* Start and end glyph indices in a glyph-string.  */
+  int cmp_from, cmp_to;
 
   /* 1 means this glyph strings face has to be drawn to the right end
      of the window's drawing area.  */
@@ -1213,7 +1230,7 @@ struct glyph_string
   unsigned padding_p : 1;
 
   /* The GC to use for drawing this glyph string.  */
-#if defined(HAVE_X_WINDOWS) || defined(MAC_OS)
+#if defined(HAVE_X_WINDOWS)
   GC gc;
 #endif
 #if defined(HAVE_NTGUI)
@@ -1243,6 +1260,10 @@ struct glyph_string
   /* Number of clipping areas. */
   int num_clips;
 
+  int underline_position;
+
+  int underline_thickness;
+
   struct glyph_string *next, *prev;
 };
 
@@ -1399,6 +1420,7 @@ struct glyph_string
 enum lface_attribute_index
 {
   LFACE_FAMILY_INDEX = 1,
+  LFACE_FOUNDRY_INDEX,
   LFACE_SWIDTH_INDEX,
   LFACE_HEIGHT_INDEX,
   LFACE_WEIGHT_INDEX,
@@ -1413,7 +1435,6 @@ enum lface_attribute_index
   LFACE_BOX_INDEX,
   LFACE_FONT_INDEX,
   LFACE_INHERIT_INDEX,
-  LFACE_AVGWIDTH_INDEX,
   LFACE_FONTSET_INDEX,
   LFACE_VECTOR_SIZE
 };
@@ -1456,12 +1477,6 @@ struct face
      drawing the characters in this face.  */
   GC gc;
 
-  /* Font used for this face, or null if the font could not be loaded
-     for some reason.  This points to a `font' slot of a struct
-     font_info, and we should not call XFreeFont on it because the
-     font may still be used somewhere else.  */
-  XFontStruct *font;
-
   /* Background stipple or bitmap used for this face.  This is
      an id as returned from load_pixmap.  */
   int stipple;
@@ -1489,17 +1504,7 @@ struct face
   unsigned long strike_through_color;
   unsigned long box_color;
 
-  /* The font's name.  This points to a `name' of a font_info, and it
-     must not be freed.  */
-  char *font_name;
-
-  /* Font info ID for this face's font.  An ID is stored here because
-     pointers to font_info structures may change.  The reason is that
-     they are pointers into a font table vector that is itself
-     reallocated.  */
-  int font_info_id;
-
-  struct font_info *font_info;
+  struct font *font;
 
   /* Fontset ID if for this face's fontset.  Non-ASCII faces derived
      from the same ASCII face have the same fontset.  */
@@ -1527,13 +1532,6 @@ struct face
      drawing shadows.  */
   unsigned use_box_color_for_shadows_p : 1;
 
-  /* The Lisp face attributes this face realizes.  All attributes
-     in this vector are non-nil.  */
-  Lisp_Object lface[LFACE_VECTOR_SIZE];
-
-  /* The hash value of this face.  */
-  unsigned hash;
-
   /* Non-zero if text in this face should be underlined, overlined,
      strike-through or have a box drawn around it.  */
   unsigned underline_p : 1;
@@ -1576,6 +1574,20 @@ struct face
   /* If non-zero, use overstrike (to simulate bold-face).  */
   unsigned overstrike : 1;
 
+/* NOTE: this is not used yet, but eventually this impl should be done
+         similarly to overstrike */
+#ifdef HAVE_NS
+  /* If non-zero, use geometric rotation (to simulate italic).  */
+  unsigned synth_ital : 1;
+#endif
+
+  /* The Lisp face attributes this face realizes.  All attributes
+     in this vector are non-nil.  */
+  Lisp_Object lface[LFACE_VECTOR_SIZE];
+
+  /* The hash value of this face.  */
+  unsigned hash;
+
   /* Next and previous face in hash collision list of face cache.  */
   struct face *next, *prev;
 
@@ -1682,7 +1694,7 @@ struct face_cache
    This macro is only meaningful for multibyte character CHAR.  */
 
 #define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT)      \
-  (ASCII_CHAR_P (CHAR)                                 \
+  ((ASCII_CHAR_P (CHAR) || CHAR_BYTE8_P (CHAR))                \
    ? (FACE)->ascii_face->id                            \
    : face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT)))
 
@@ -1780,7 +1792,7 @@ enum display_element_type
   /* A normal character.  */
   IT_CHARACTER,
 
-  /* A composition sequence.  */
+  /* A composition (static and automatic).  */
   IT_COMPOSITION,
 
   /* An image.  */
@@ -1807,7 +1819,6 @@ enum display_element_type
 
 enum prop_idx
 {
-  AUTO_COMPOSED_PROP_IDX,
   FONTIFIED_PROP_IDX,
   FACE_PROP_IDX,
   INVISIBLE_PROP_IDX,
@@ -1821,6 +1832,14 @@ enum prop_idx
   LAST_PROP_IDX
 };
 
+/* An enumerator for the method of wrapping long lines.  */
+
+enum line_wrap_method
+{
+  TRUNCATE,
+  WORD_WRAP,
+  WINDOW_WRAP
+};
 
 struct it_slice
 {
@@ -1836,7 +1855,6 @@ struct it_slice
 enum it_method {
   GET_FROM_BUFFER = 0,
   GET_FROM_DISPLAY_VECTOR,
-  GET_FROM_COMPOSITION,
   GET_FROM_STRING,
   GET_FROM_C_STRING,
   GET_FROM_IMAGE,
@@ -1846,6 +1864,36 @@ enum it_method {
 
 #define IT_STACK_SIZE 4
 
+/* Iterator for composition (both for static and automatic).  */
+struct composition_it
+{
+  /* Next position at which to check the composition.  */
+  EMACS_INT stop_pos;
+  /* ID number of the composition or glyph-string.  If negative, we
+     are not iterating over a composition now.  */
+  int id;
+  /* If non-negative, character that triggers the automatic
+     composition at `stop_pos', and this is an automatic composition.
+     If negative, this is a static composition.  This is set to -2
+     temporarily if searching of composition reach a limit or a
+     newline.  */
+  int ch;
+  /* If this an automatic composition, how many characters to look back
+     from the position where a character triggering the composition
+     exists.  */
+  int lookback;
+  /* If non-negative, number of glyphs of the glyph-string.  */
+  int nglyphs;
+  /* Number of characters and bytes of the current grapheme cluster.  */
+  int nchars, nbytes;
+  /* Indices of the glyphs for the current grapheme cluster.  */
+  int from, to;
+  /* Width of the current grapheme cluster in units of pixels on a
+     graphic display and in units of canonical characters on a
+     terminal display.  */
+  int width;
+};
+
 struct it
 {
   /* The window in which we iterate over current_buffer (or a string).  */
@@ -1860,11 +1908,11 @@ struct it
 
   /* The next position at which to check for face changes, invisible
      text, overlay strings, end of text etc., which see.  */
-  int stop_charpos;
+  EMACS_INT stop_charpos;
 
   /* Maximum string or buffer position + 1.  ZV when iterating over
      current_buffer.  */
-  int end_charpos;
+  EMACS_INT end_charpos;
 
   /* C string to iterate over.  Non-null means get characters from
      this string, otherwise characters are read from current_buffer
@@ -1877,10 +1925,10 @@ struct it
 
   /* Start and end of a visible region; -1 if the region is not
      visible in the window.  */
-  int region_beg_charpos, region_end_charpos;
+  EMACS_INT region_beg_charpos, region_end_charpos;
 
   /* Position at which redisplay end trigger functions should be run.  */
-  int redisplay_end_trigger_charpos;
+  EMACS_INT redisplay_end_trigger_charpos;
 
   /* 1 means multibyte characters are enabled.  */
   unsigned multibyte_p : 1;
@@ -1896,6 +1944,9 @@ struct it
      this is 1 if we're doing an ellipsis.  Otherwise meaningless.  */
   unsigned ellipsis_p : 1;
 
+  /* True means cursor shouldn't be displayed here.  */
+  unsigned avoid_cursor_p : 1;
+
   /* Display table in effect or null for none.  */
   struct Lisp_Char_Table *dp;
 
@@ -1963,8 +2014,9 @@ struct it
   {
     Lisp_Object string;
     int string_nchars;
-    int end_charpos;
-    int stop_charpos;
+    EMACS_INT end_charpos;
+    EMACS_INT stop_charpos;
+    struct composition_it cmp_it;
     int face_id;
 
     /* Save values specific to a given method.  */
@@ -1978,8 +2030,6 @@ struct it
       /* method == GET_FROM_COMPOSITION */
       struct {
        Lisp_Object object;
-       int c, len;
-       int cmp_id, cmp_len;
       } comp;
       /* method == GET_FROM_STRETCH */
       struct {
@@ -1996,11 +2046,13 @@ struct it
     unsigned multibyte_p : 1;
     unsigned string_from_display_prop_p : 1;
     unsigned display_ellipsis_p : 1;
+    unsigned avoid_cursor_p : 1;
+    enum line_wrap_method line_wrap;
 
     /* properties from display property that are reset by another display property. */
+    short voffset;
     Lisp_Object space_width;
     Lisp_Object font_height;
-    short voffset;
   }
   stack[IT_STACK_SIZE];
 
@@ -2025,9 +2077,6 @@ struct it
      where the `^' can be replaced by a display table entry.  */
   unsigned ctl_arrow_p : 1;
 
-  /* 1 means lines are truncated.  */
-  unsigned truncate_lines_p : 1;
-
   /* Non-zero means that the current face has a box.  */
   unsigned face_box_p : 1;
 
@@ -2063,6 +2112,8 @@ struct it
      descent/ascent (line-height property).  Reset after this glyph.  */
   unsigned constrain_row_ascent_descent_p : 1;
 
+  enum line_wrap_method line_wrap;
+
   /* The ID of the default face to use.  One of DEFAULT_FACE_ID,
      MODE_LINE_FACE_ID, etc, depending on what we are displaying.  */
   int base_face_id;
@@ -2076,13 +2127,15 @@ struct it
      and length in bytes of the composition.  */
   int c, len;
 
-  /* If what == IT_COMPOSITION, identification number and length in
-     chars of a composition.  */
-  int cmp_id, cmp_len;
+  /* If what == IT_COMPOSITION, iterator substructure for the
+     composition.  */
+  struct composition_it cmp_it;
 
-  /* The character to display, possibly translated to multibyte
-     if unibyte_display_via_language_environment is set.  This
-     is set after produce_glyphs has been called.  */
+  /* The character to display, possibly translated to multibyte if
+     multibyte_p is zero or unibyte_display_via_language_environment
+     is set.  This is set after get_next_display_element has been
+     called.  If we are setting it->C directly before calling
+     PRODUCE_GLYPHS, this should be set beforehand too.  */
   int char_to_display;
 
   /* If what == IT_IMAGE, the id of the image to display.  */
@@ -2097,6 +2150,9 @@ struct it
   /* Computed from the value of the `raise' property.  */
   short voffset;
 
+  /* Number of columns per \t.  */
+  short tab_width;
+
   /* Value of the `height' property, if any; nil if none.  */
   Lisp_Object font_height;
 
@@ -2107,9 +2163,6 @@ struct it
   Lisp_Object object;
   struct text_pos position;
 
-  /* Number of columns per \t.  */
-  short tab_width;
-
   /* Width in pixels of truncation and continuation glyphs.  */
   short truncation_pixel_width, continuation_pixel_width;
 
@@ -2214,8 +2267,8 @@ struct it
       && ((IT)->c == '\n'                              \
          || ((IT)->c == '\r' && (IT)->selective)))
 
-/* Call produce_glyphs or produce_glyphs_hook, if set.  Shortcut to
-   avoid the function call overhead.  */
+/* Call produce_glyphs or FRAME_RIF->produce_glyphs, if set.  Shortcut
+   to avoid the function call overhead.  */
 
 #define PRODUCE_GLYPHS(IT)                              \
   do {                                                  \
@@ -2351,19 +2404,6 @@ struct redisplay_interface
                                    int h, int wd));
   void (*destroy_fringe_bitmap) P_ ((int which));
 
-/* Get metrics of character CHAR2B in FONT of type FONT_TYPE.
-   Value is null if CHAR2B is not contained in the font.  */
-  XCharStruct * (*per_char_metric) P_ ((XFontStruct *font, XChar2b *char2b,
-                                       int font_type));
-
-/* Encode CHAR2B using encoding information from FONT_INFO.  CHAR2B is
-   the two-byte form of C.  Encoding is returned in *CHAR2B.  If
-   TWO_BYTE_P is non-null, return non-zero there if font is two-byte.  */
-  int (*encode_char) P_ ((int c, XChar2b *char2b,
-                         struct font_info *font_into,
-                         struct charset *charset,
-                         int *two_byte_p));
-
 /* Compute left and right overhang of glyph string S.
    A NULL pointer if platform does not support this. */
   void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s));
@@ -2716,6 +2756,9 @@ void move_it_vertically P_ ((struct it *, int));
 void move_it_vertically_backward P_ ((struct it *, int));
 void move_it_by_lines P_ ((struct it *, int, int));
 void move_it_past_eol P_ ((struct it *));
+void move_it_in_display_line (struct it *it,
+                             EMACS_INT to_charpos, int to_x,
+                             enum move_operation_enum op);
 int in_display_vector_p P_ ((struct it *));
 int frame_mode_line_height P_ ((struct frame *));
 void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
@@ -2733,11 +2776,12 @@ extern struct frame *last_mouse_frame;
 extern int last_tool_bar_item;
 extern Lisp_Object Vmouse_autoselect_window;
 extern int unibyte_display_via_language_environment;
+extern EMACS_INT underline_minimum_offset;
 
 extern void reseat_at_previous_visible_line_start P_ ((struct it *));
 
 extern int calc_pixel_width_or_height P_ ((double *, struct it *, Lisp_Object,
-                                          /* XFontStruct */ void *, int, int *));
+                                          struct font *, int, int *));
 
 #ifdef HAVE_WINDOW_SYSTEM
 
@@ -2810,10 +2854,6 @@ void compute_fringe_widths P_ ((struct frame *, int));
 void w32_init_fringe P_ ((struct redisplay_interface *));
 void w32_reset_fringes P_ ((void));
 #endif
-#ifdef MAC_OS
-void mac_init_fringe P_ ((struct redisplay_interface *));
-#endif
-
 /* Defined in image.c */
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2879,10 +2919,10 @@ char *choose_face_font P_ ((struct frame *, Lisp_Object *, Lisp_Object,
                            int *));
 int ascii_face_of_lisp_face P_ ((struct frame *, int));
 void prepare_face_for_display P_ ((struct frame *, struct face *));
-int xstricmp P_ ((const unsigned char *, const unsigned char *));
+int xstrcasecmp P_ ((const unsigned char *, const unsigned char *));
 int lookup_face P_ ((struct frame *, Lisp_Object *));
-int lookup_non_ascii_face P_ ((struct frame *, int, struct face *));
 int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
+int lookup_basic_face P_ ((struct frame *, int));
 int smaller_face P_ ((struct frame *, int, int));
 int face_with_height P_ ((struct frame *, int, int));
 int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int));
@@ -2892,7 +2932,7 @@ void recompute_basic_faces P_ ((struct frame *));
 int face_at_buffer_position P_ ((struct window *w, EMACS_INT pos,
                                 EMACS_INT region_beg, EMACS_INT region_end,
                                 EMACS_INT *endptr, EMACS_INT limit,
-                                int mouse));
+                                int mouse, int base_face_id));
 int face_for_overlay_string P_ ((struct window *w, EMACS_INT pos,
                                 EMACS_INT region_beg, EMACS_INT region_end,
                                 EMACS_INT *endptr, EMACS_INT limit,
@@ -2908,8 +2948,8 @@ void free_realized_face P_ ((struct frame *, struct face *));
 extern Lisp_Object Qforeground_color, Qbackground_color;
 extern Lisp_Object Qframe_set_background_mode;
 extern char unspecified_fg[], unspecified_bg[];
-extern Lisp_Object split_font_name_into_vector P_ ((Lisp_Object));
-extern Lisp_Object build_font_name_from_vector P_ ((Lisp_Object));
+
+extern Lisp_Object Vface_remapping_alist;
 
 /* Defined in xfns.c  */
 
@@ -2919,9 +2959,6 @@ void gamma_correct P_ ((struct frame *, XColor *));
 #ifdef WINDOWSNT
 void gamma_correct P_ ((struct frame *, COLORREF *));
 #endif
-#ifdef MAC_OS
-void gamma_correct P_ ((struct frame *, unsigned long *));
-#endif
 
 #ifdef HAVE_WINDOW_SYSTEM
 
@@ -2936,6 +2973,15 @@ extern void start_hourglass P_ ((void));
 extern void cancel_hourglass P_ ((void));
 extern int hourglass_started P_ ((void));
 extern int display_hourglass_p;
+extern int hourglass_shown_p;
+struct atimer;                 /* Defined in atimer.h.  */
+/* If non-null, an asynchronous timer that, when it expires, displays
+   an hourglass cursor on all frames.  */
+extern struct atimer *hourglass_atimer;
+
+/* Each GUI implements these.  FIXME: move into RIF. */
+extern void show_hourglass P_ ((struct atimer *));
+extern void hide_hourglass P_ ((void));
 
 /* Returns the background color of IMG, calculating one heuristically if
    necessary.  If non-zero, XIMG is an existing XImage object to use for
@@ -3086,7 +3132,8 @@ enum resource_types
   RES_TYPE_FLOAT,
   RES_TYPE_BOOLEAN,
   RES_TYPE_STRING,
-  RES_TYPE_SYMBOL
+  RES_TYPE_SYMBOL,
+  RES_TYPE_BOOLEAN_NUMBER
 };
 
 extern Lisp_Object x_get_arg P_ ((Display_Info *, Lisp_Object,