Reformatted.
[chise/xemacs-chise.git.1] / src / redisplay-output.c
index 223a1a0..f61e238 100644 (file)
@@ -2,7 +2,7 @@
    Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
    Copyright (C) 1995, 1996 Ben Wing.
    Copyright (C) 1996 Chuck Thompson.
    Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
    Copyright (C) 1995, 1996 Ben Wing.
    Copyright (C) 1996 Chuck Thompson.
-   Copyright (C) 1999 Andy Piper.
+   Copyright (C) 1999, 2002 Andy Piper.
 
 This file is part of XEmacs.
 
 
 This file is part of XEmacs.
 
@@ -221,7 +221,7 @@ compare_runes (struct window *w, struct rune *crb, struct rune *drb)
   else if (crb->type != drb->type)
     return 0;
   else if (crb->type == RUNE_CHAR &&
   else if (crb->type != drb->type)
     return 0;
   else if (crb->type == RUNE_CHAR &&
-          (crb->object.chr.ch != drb->object.chr.ch))
+          !CHARC_EQ (crb->object.cglyph, drb->object.cglyph))
     return 0;
   else if (crb->type == RUNE_HLINE &&
           (crb->object.hline.thickness != drb->object.hline.thickness ||
     return 0;
   else if (crb->type == RUNE_HLINE &&
           (crb->object.hline.thickness != drb->object.hline.thickness ||
@@ -334,7 +334,7 @@ get_next_display_block (layout_bounds bounds, display_block_dynarr *dba,
       else if (start_pos <= bounds.right_out)
        *next_start = bounds.right_out;
       else
       else if (start_pos <= bounds.right_out)
        *next_start = bounds.right_out;
       else
-       abort ();
+       ABORT ();
     }
 
   for (block = 0; block < Dynarr_length (dba); block++)
     }
 
   for (block = 0; block < Dynarr_length (dba); block++)
@@ -377,7 +377,7 @@ get_cursor_size_and_location (struct window *w, struct display_block *db,
   int defheight, defwidth;
 
   if (Dynarr_length (db->runes) <= cursor_location)
   int defheight, defwidth;
 
   if (Dynarr_length (db->runes) <= cursor_location)
-    abort ();
+    ABORT ();
 
   XSETWINDOW (window, w);
 
 
   XSETWINDOW (window, w);
 
@@ -1317,7 +1317,7 @@ redisplay_output_layout (Lisp_Object domain,
 {
   Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
   Lisp_Object rest, window = DOMAIN_WINDOW (domain);
 {
   Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
   Lisp_Object rest, window = DOMAIN_WINDOW (domain);
-  Emchar_dynarr *buf = Dynarr_new (Emchar);
+  Charc_dynarr *buf;
   struct window *w = XWINDOW (window);
   struct device *d = DOMAIN_XDEVICE (domain);
   int layout_height, layout_width;
   struct window *w = XWINDOW (window);
   struct device *d = DOMAIN_XDEVICE (domain);
   int layout_height, layout_width;
@@ -1334,6 +1334,8 @@ redisplay_output_layout (Lisp_Object domain,
   if (!redisplay_normalize_glyph_area (db, dga))
     return;
 
   if (!redisplay_normalize_glyph_area (db, dga))
     return;
 
+  buf = Dynarr_new (Charc);
+
   /* Highly dodgy optimization. We want to only output the whole
      layout if we really have to. */
   if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
   /* Highly dodgy optimization. We want to only output the whole
      layout if we really have to. */
   if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
@@ -1353,17 +1355,22 @@ redisplay_output_layout (Lisp_Object domain,
          int edges = 0;
          enum edge_style style;
          int ypos = db->ypos;
          int edges = 0;
          enum edge_style style;
          int ypos = db->ypos;
+         int xpos = db->xpos;
          int height = dga->height;
          int height = dga->height;
+         int width = dga->width;
 
 
-         if (dga->xoffset >= 0)
+         /* The bevel_area routines always draw in from the specified
+            area so there is no need to adjust the displayed area to
+            make sure that the lines are visible. */
+         if (dga->xoffset >= 0) 
            edges |= EDGE_LEFT;
            edges |= EDGE_LEFT;
-         if (dga->width - dga->xoffset == layout_width)
+         if (dga->width - dga->xoffset == layout_width) 
            edges |= EDGE_RIGHT;
            edges |= EDGE_RIGHT;
-         if (dga->yoffset >= 0)
+         if (dga->yoffset >= 0) 
            edges |= EDGE_TOP;
          if (dga->height - dga->yoffset == layout_height)
            edges |= EDGE_BOTTOM;
            edges |= EDGE_TOP;
          if (dga->height - dga->yoffset == layout_height)
            edges |= EDGE_BOTTOM;
-
+         
          if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
            style = EDGE_ETCHED_IN;
          else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
          if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_in))
            style = EDGE_ETCHED_IN;
          else if (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (p), Qetched_out))
@@ -1383,9 +1390,8 @@ redisplay_output_layout (Lisp_Object domain,
            style = EDGE_BEVEL_OUT;
 
          MAYBE_DEVMETH (d, bevel_area,
            style = EDGE_BEVEL_OUT;
 
          MAYBE_DEVMETH (d, bevel_area,
-                        (w, findex, db->xpos,
-                         ypos,
-                         dga->width, height, 2, edges, style));
+                        (w, findex, xpos, ypos, width, height,
+                         DEFAULT_WIDGET_SHADOW_WIDTH, edges, style));
        }
     }
 
        }
     }
 
@@ -1453,7 +1459,7 @@ redisplay_output_layout (Lisp_Object domain,
                        struct display_line dl; /* this is fake */
                        Lisp_Object string =
                          IMAGE_INSTANCE_TEXT_STRING (childii);
                        struct display_line dl; /* this is fake */
                        Lisp_Object string =
                          IMAGE_INSTANCE_TEXT_STRING (childii);
-                       unsigned char charsets[NUM_LEADING_BYTES];
+                       Charset_ID charsets[NUM_LEADING_BYTES];
                        struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
 
                        find_charsets_in_bufbyte_string (charsets,
                        struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
 
                        find_charsets_in_bufbyte_string (charsets,
@@ -1461,8 +1467,9 @@ redisplay_output_layout (Lisp_Object domain,
                                                         XSTRING_LENGTH (string));
                        ensure_face_cachel_complete (cachel, window, charsets);
 
                                                         XSTRING_LENGTH (string));
                        ensure_face_cachel_complete (cachel, window, charsets);
 
-                       convert_bufbyte_string_into_emchar_dynarr
-                         (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
+                       convert_bufbyte_string_into_charc_dynarr
+                         (XSTRING_DATA (string), XSTRING_LENGTH (string),
+                          buf);
 
                        redisplay_normalize_display_box (&cdb, &cdga);
                        /* Offsets are now +ve again so be careful
 
                        redisplay_normalize_display_box (&cdb, &cdga);
                        /* Offsets are now +ve again so be careful
@@ -1516,7 +1523,7 @@ redisplay_output_layout (Lisp_Object domain,
 
                case IMAGE_POINTER:
                default:
 
                case IMAGE_POINTER:
                default:
-                 abort ();
+                 ABORT ();
                }
            }
          IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) = 0;
                }
            }
          IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) = 0;
@@ -1628,7 +1635,7 @@ redisplay_clear_region (Lisp_Object locale, face_index findex, int x, int y,
       f = XFRAME (locale);
     }
   else
       f = XFRAME (locale);
     }
   else
-    abort ();
+    ABORT ();
 
   d = XDEVICE (f->device);
 
 
   d = XDEVICE (f->device);