(Fcharset_name): Define `byte_offset' in non-UTF-2000 configuration.
[chise/xemacs-chise.git-] / src / redisplay.h
index 0d609bc..57c0004 100644 (file)
@@ -139,7 +139,7 @@ struct rune
     /* CHAR */
     struct
     {
-      Emchar ch;               /* Cbaracter of this rune. */
+      Emchar ch;               /* Character of this rune. */
     } chr;
 
     /* HLINE */
@@ -233,6 +233,32 @@ typedef struct
   Dynarr_declare (glyph_block);
 } glyph_block_dynarr;
 
+/*************************************************************************/
+/*                              display lines                             */
+/*************************************************************************/
+
+/*  Modeline commentary: IMO the modeline is handled very badly, we
+  special case virtually *everything* in the redisplay routines for
+  the modeline. The fact that dl->bufpos can be either a buffer
+  position or a char count highlights this. There is no abstraction at
+  all that I can find and it means that the code is made very ugly as
+  a result. Either we should treat the modeline *entirely* separately,
+  or we should abstract to something that applies equally well to the
+  modeline and to buffer text, the things are not enormously different
+  after all and handling them identically at some level would
+  eliminate some bugs that still exist (mainly to do with modeline
+  handling). This problem doesn't help trying to implement gutters
+  which are somewhere in between buffer text and modeline text.
+
+  Redisplay commentary: Everything in redisplay is tied very tightly
+  to the things that are being displayed, and the context,
+  e.g. buffers and windows. According to Chuck this is so that we can
+  get speed, which seems fine to me, however this usage is extended
+  too far down the redispay routines IMO. At some level there should
+  be functions that know how to display strings with extents and
+  faces, regardless of buffer etc. After all the window system does
+  not care. <andy@xemacs.org> */
+
 typedef struct display_line display_line;
 struct display_line
 {
@@ -256,7 +282,7 @@ struct display_line
   int cursor_elt;                      /* rune block of TEXT display
                                           block cursor is at or -1 */
   char used_prop_data;                 /* can't incrementally update if line
-                                          used propogation data */
+                                          used propagation data */
 
   layout_bounds bounds;                        /* line boundary positions */
 
@@ -268,8 +294,17 @@ struct display_line
   /* Dynamic arrays of left and right glyph blocks */
   glyph_block_dynarr *left_glyphs;
   glyph_block_dynarr *right_glyphs;
+
+  face_index   left_margin_findex;
+  face_index   right_margin_findex;
+  face_index   default_findex;
 };
 
+#define DISPLAY_LINE_HEIGHT(dl) \
+(dl->ascent + dl->descent - dl->clip)
+#define DISPLAY_LINE_YPOS(dl) \
+(dl->ypos - dl->ascent)
+
 typedef struct
 {
   Dynarr_declare (display_line);
@@ -350,6 +385,11 @@ extern int frame_changed;
 extern int glyphs_changed;
 extern int glyphs_changed_set;
 
+/* True if any displayed subwindow is in need of updating
+   somewhere. */
+extern int subwindows_changed;
+extern int subwindows_changed_set;
+
 /* True if an icon is in need of updating somewhere. */
 extern int icon_changed;
 extern int icon_changed_set;
@@ -377,6 +417,10 @@ extern int asynch_device_change_pending;
 extern int toolbar_changed;
 extern int toolbar_changed_set;
 
+/* non-nil if any gutter has changed */
+extern int gutter_changed;
+extern int gutter_changed_set;
+
 /* non-nil if any window has changed since the last time redisplay completed */
 extern int windows_changed;
 
@@ -389,23 +433,23 @@ extern int windows_structure_changed;
    if each has already been called and don't bother doing most of the
    work if it is currently set. */
 
-#define MARK_TYPE_CHANGED(object) do {                                 \
-  if (!object##_changed_set) {                                         \
-    Lisp_Object _devcons_, _concons_;                                  \
-    DEVICE_LOOP_NO_BREAK (_devcons_, _concons_)                                \
-      {                                                                        \
-        Lisp_Object _frmcons_;                                         \
-        struct device *_d_ = XDEVICE (XCAR (_devcons_));               \
-        DEVICE_FRAME_LOOP (_frmcons_, _d_)                             \
-         {                                                             \
-           struct frame *_f_ = XFRAME (XCAR (_frmcons_));              \
-            _f_->object##_changed = 1;                                 \
-           _f_->modiff++;                                              \
-         }                                                             \
-        _d_->object##_changed = 1;                                     \
-      }                                                                        \
-    object##_changed = 1;                                              \
-    object##_changed_set = 1; }                                                \
+#define MARK_TYPE_CHANGED(object) do {                         \
+  if (!object##_changed_set) {                                 \
+    Lisp_Object MTC_devcons, MTC_concons;                      \
+    DEVICE_LOOP_NO_BREAK (MTC_devcons, MTC_concons)            \
+      {                                                                \
+        Lisp_Object MTC_frmcons;                               \
+        struct device *MTC_d = XDEVICE (XCAR (MTC_devcons));   \
+        DEVICE_FRAME_LOOP (MTC_frmcons, MTC_d)                 \
+         {                                                     \
+           struct frame *MTC_f = XFRAME (XCAR (MTC_frmcons));  \
+            MTC_f->object##_changed = 1;                       \
+           MTC_f->modiff++;                                    \
+         }                                                     \
+        MTC_d->object##_changed = 1;                           \
+      }                                                                \
+    object##_changed = 1;                                      \
+    object##_changed_set = 1; }                                        \
   }  while (0)
 
 #define MARK_BUFFERS_CHANGED MARK_TYPE_CHANGED (buffers)
@@ -416,21 +460,25 @@ extern int windows_structure_changed;
 #define MARK_MODELINE_CHANGED MARK_TYPE_CHANGED (modeline)
 #define MARK_POINT_CHANGED MARK_TYPE_CHANGED (point)
 #define MARK_TOOLBAR_CHANGED MARK_TYPE_CHANGED (toolbar)
+#define MARK_GUTTER_CHANGED MARK_TYPE_CHANGED (gutter)
 #define MARK_GLYPHS_CHANGED MARK_TYPE_CHANGED (glyphs)
+#define MARK_SUBWINDOWS_CHANGED MARK_TYPE_CHANGED (subwindows)
 
 /* Anytime a console, device or frame is added or deleted we need to reset
    these flags. */
-#define RESET_CHANGED_SET_FLAGS                                                \
-  do {                                                                 \
-    buffers_changed_set = 0;                                           \
-    clip_changed_set = 0;                                              \
-    extents_changed_set = 0;                                           \
-    icon_changed_set = 0;                                              \
-    menubar_changed_set = 0;                                           \
-    modeline_changed_set = 0;                                          \
-    point_changed_set = 0;                                             \
-    toolbar_changed_set = 0;                                           \
-    glyphs_changed_set = 0;                                            \
+#define RESET_CHANGED_SET_FLAGS                \
+  do {                                 \
+    buffers_changed_set = 0;           \
+    clip_changed_set = 0;              \
+    extents_changed_set = 0;           \
+    icon_changed_set = 0;              \
+    menubar_changed_set = 0;           \
+    modeline_changed_set = 0;          \
+    point_changed_set = 0;             \
+    toolbar_changed_set = 0;           \
+    gutter_changed_set = 0;            \
+    glyphs_changed_set = 0;            \
+    subwindows_changed_set = 0;                \
   } while (0)
 
 \f
@@ -438,7 +486,7 @@ extern int windows_structure_changed;
 /*                       redisplay global variables                      */
 /*************************************************************************/
 
-/* redisplay structre used by various utility routines. */
+/* redisplay structure used by various utility routines. */
 extern display_line_dynarr *cmotion_display_lines;
 
 /* Nonzero means truncate lines in all windows less wide than the frame. */
@@ -473,7 +521,7 @@ extern Lisp_Object Vglobal_mode_string;
 extern int display_arg;
 
 /* Type of display specified.  Defined in emacs.c. */
-extern char *display_use;
+extern CONST char *display_use;
 
 /* Nonzero means reading single-character input with prompt
    so put cursor on minibuffer after the prompt.  */
@@ -510,6 +558,10 @@ void free_display_structs (struct window_mirror *mir);
 Bufbyte *generate_formatted_string (struct window *w, Lisp_Object format_str,
                                     Lisp_Object result_str, face_index findex,
                                     int type);
+void generate_displayable_area (struct window *w, Lisp_Object disp_string,
+                               int xpos, int ypos, int width, int height,
+                               display_line_dynarr* dl,
+                               Bufpos start_pos, face_index default_face);
 int real_current_modeline_height (struct window *w);
 int pixel_to_glyph_translation (struct frame *f, int x_coord,
                                int y_coord, int *col, int *row,
@@ -547,6 +599,15 @@ int compute_line_start_cache_dynarr_usage (line_start_cache_dynarr *dyn,
 int get_next_display_block (layout_bounds bounds,
                            display_block_dynarr *dba, int start_pos,
                            int *next_start);
+void redisplay_output_subwindow (struct window *w, struct display_line *dl,
+                                Lisp_Object image_instance, int xpos,
+                                int xoffset, int start_pixpos, int width,
+                                face_index findex, int cursor_start, 
+                                int cursor_width, int cursor_height);
+void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height);
+void redisplay_clear_to_window_end (struct window *w, int ypos1, int ypos2);
+void redisplay_clear_region (Lisp_Object window, face_index findex, int x,
+                            int y, int width, int height);
 void redisplay_clear_bottom_of_window (struct window *w,
                                       display_line_dynarr *ddla,
                                       int min_start, int max_end);