X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fredisplay-msw.c;h=5d3f8154394fb2ecdd3810921e8f479d4dabdb5f;hb=f8c889244f022ae695ea8dc67267499286921903;hp=17394f4ad906a88ed8bde8185f9326619f99e46b;hpb=2e3e3f9ee27fec50f45c282d71eaddf7c673bc56;p=chise%2Fxemacs-chise.git- diff --git a/src/redisplay-msw.c b/src/redisplay-msw.c index 17394f4..5d3f815 100644 --- a/src/redisplay-msw.c +++ b/src/redisplay-msw.c @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "faces.h" #include "frame.h" #include "glyphs-msw.h" +#include "gutter.h" #include "redisplay.h" #include "sysdep.h" #include "window.h" @@ -48,18 +49,16 @@ Boston, MA 02111-1307, USA. */ #include "windows.h" #ifdef MULE #include "mule-ccl.h" -#include "mule-charset.h" +#include "character.h" #endif #define MSWINDOWS_EOL_CURSOR_WIDTH 5 /* - * Random forward delarations + * Random forward declarations */ static void mswindows_update_dc (HDC hdc, Lisp_Object font, Lisp_Object fg, Lisp_Object bg, Lisp_Object bg_pmap); -static void mswindows_clear_region (Lisp_Object locale, face_index findex, - int x, int y, int width, int height); static void mswindows_output_vertical_divider (struct window *w, int clear); static void mswindows_redraw_exposed_windows (Lisp_Object window, int x, int y, int width, int height); @@ -77,6 +76,7 @@ static void mswindows_output_pixmap (struct window *w, struct display_line *dl, face_index findex, int cursor_start, int cursor_width, int cursor_height, int offset_bitmap); +void bevel_modeline (struct window *w, struct display_line *dl); typedef struct textual_run { @@ -167,7 +167,7 @@ separate_textual_runs (unsigned char *text_storage, char_converter.reg[1] = byte1; char_converter.reg[2] = byte2; char_converter.ic = 0; /* start at beginning each time */ - ccl_driver (&char_converter, 0, 0, 0, 0); + ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING); byte1 = char_converter.reg[1]; byte2 = char_converter.reg[2]; } @@ -312,7 +312,7 @@ mswindows_output_blank (struct window *w, struct display_line *dl, struct rune * struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, rb->findex); Lisp_Object bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex); - + if (!IMAGE_INSTANCEP (bg_pmap) || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) bg_pmap = Qnil; @@ -351,7 +351,7 @@ mswindows_output_cursor (struct window *w, struct display_line *dl, int xpos, { struct frame *f = XFRAME (w->frame); struct device *d = XDEVICE (f->device); - struct face_cachel *cachel; + struct face_cachel *cachel=0; Lisp_Object font = Qnil; int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)); HDC hdc = FRAME_MSWINDOWS_DC (f); @@ -504,7 +504,7 @@ mswindows_output_string (struct window *w, struct display_line *dl, xpos -= xoffset; /* sort out the destination rectangle */ - height = dl->ascent + dl->descent - dl->clip; + height = DISPLAY_LINE_HEIGHT (dl); rect.left = clip_start; rect.top = dl->ypos - dl->ascent; rect.right = clip_end; @@ -555,7 +555,7 @@ mswindows_output_string (struct window *w, struct display_line *dl, int clear_end = min (xpos + this_width, clip_end); { - mswindows_clear_region (window, findex, clear_start, + redisplay_clear_region (window, findex, clear_start, dl->ypos - dl->ascent, clear_end - clear_start, height); @@ -593,6 +593,7 @@ mswindows_output_dibitmap (struct frame *f, struct Lisp_Image_Instance *p, int need_clipping = (clip_x || clip_y); int yoffset=0; int xoffset=0; + /* do we need to offset the pixmap vertically? this is necessary for background pixmaps. */ if (offset_bitmap) @@ -715,7 +716,7 @@ mswindows_output_pixmap (struct window *w, struct display_line *dl, struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); Lisp_Object window; - int lheight = dl->ascent + dl->descent - dl->clip; + int lheight = DISPLAY_LINE_HEIGHT (dl); int pheight = ((int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p) > lheight ? lheight : IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); int clip_x, clip_y, clip_width, clip_height; @@ -794,7 +795,7 @@ mswindows_output_pixmap (struct window *w, struct display_line *dl, } if (!offset_bitmap) /* i.e. not a bg pixmap */ - mswindows_clear_region (window, findex, clear_x, clear_y, + redisplay_clear_region (window, findex, clear_x, clear_y, clear_width, clear_height); } @@ -966,6 +967,7 @@ mswindows_redraw_exposed_area (struct frame *f, int x, int y, int width, int hei redraw anyhow. */ MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height)); #endif + redraw_exposed_gutters (f, x, y, width, height); if (!f->window_face_cache_reset) { @@ -978,38 +980,36 @@ mswindows_redraw_exposed_area (struct frame *f, int x, int y, int width, int hei /***************************************************************************** - mswindows_bevel_modeline + mswindows_bevel_area - Draw a 3d border around the modeline on window W. + Draw a 3d border around the specified area on window W. ****************************************************************************/ static void -mswindows_bevel_modeline (struct window *w, struct display_line *dl) +mswindows_bevel_area (struct window *w, face_index findex, int x, int y, + int width, int height, int shadow_thickness) { struct frame *f = XFRAME (w->frame); - Lisp_Object color; - int shadow_width = MODELINE_SHADOW_THICKNESS (w); - RECT rect = { WINDOW_MODELINE_LEFT (w), - dl->ypos - dl->ascent - shadow_width, - WINDOW_MODELINE_RIGHT (w), - dl->ypos + dl->descent + shadow_width}; UINT edge; - color = WINDOW_FACE_CACHEL_BACKGROUND (w, MODELINE_INDEX); - mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, color, Qnil); - - if (XINT (w->modeline_shadow_thickness) < 0) - shadow_width = -shadow_width; - - if (shadow_width < -1) + if (shadow_thickness < -1) edge = EDGE_SUNKEN; - else if (shadow_width < 0) + else if (shadow_thickness < 0) edge = BDR_SUNKENINNER; - else if (shadow_width == 1) + else if (shadow_thickness == 1) edge = BDR_RAISEDINNER; else edge = EDGE_RAISED; - - DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, edge, BF_RECT); + + if (shadow_thickness < 0) + shadow_thickness = -shadow_thickness; + + { + RECT rect = { x, y, x + width, y + height }; + Lisp_Object color = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); + mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, color, Qnil); + + DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, edge, BF_RECT); + } } @@ -1087,7 +1087,7 @@ mswindows_ring_bell (struct device *d, int volume, int pitch, int duration) Given a display line, a block number for that start line, output all runes between start and end in the specified display block. - Ripped off with mininmal thought from the corresponding X routine. + Ripped off with minimal thought from the corresponding X routine. ****************************************************************************/ static void mswindows_output_display_block (struct window *w, struct display_line *dl, int block, @@ -1111,18 +1111,14 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b rb = Dynarr_atp (rba, start); if (!rb) - { /* Nothing to do so don't do anything. */ return; - } - else - { - findex = rb->findex; - xpos = rb->xpos; - width = 0; - if (rb->type == RUNE_CHAR) - charset = CHAR_CHARSET (rb->object.chr.ch); - } + + findex = rb->findex; + xpos = rb->xpos; + width = 0; + if (rb->type == RUNE_CHAR) + charset = CHAR_CHARSET (rb->object.chr.ch); if (end < 0) end = Dynarr_length (rba); @@ -1179,9 +1175,9 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b else if (rb->object.chr.ch == '\n') { /* Clear in case a cursor was formerly here. */ - int height = dl->ascent + dl->descent - dl->clip; + int height = DISPLAY_LINE_HEIGHT (dl); - mswindows_clear_region (window, findex, xpos, dl->ypos - dl->ascent, + redisplay_clear_region (window, findex, xpos, dl->ypos - dl->ascent, rb->width, height); elt++; } @@ -1262,7 +1258,14 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b abort (); case IMAGE_SUBWINDOW: - /* #### implement me */ + case IMAGE_WIDGET: + redisplay_output_subwindow (w, dl, instance, xpos, + rb->object.dglyph.xoffset, start_pixpos, + rb->width, findex, cursor_start, + cursor_width, cursor_height); + if (rb->cursor_type == CURSOR_ON) + mswindows_output_cursor (w, dl, xpos, cursor_width, + findex, 0, 1); break; case IMAGE_NOTHING: @@ -1289,7 +1292,7 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b && (f->clear || f->windows_structure_changed || w->shadow_thickness_changed)) - mswindows_bevel_modeline (w, dl); + bevel_modeline (w, dl); Dynarr_free (buf); } @@ -1310,12 +1313,14 @@ mswindows_output_vertical_divider (struct window *w, int clear_unused) int abs_shadow = abs (shadow); int line_width = XINT (w->vertical_divider_line_width); int div_left = WINDOW_RIGHT (w) - window_divider_width (w); + int y1 = WINDOW_TOP (w) + FRAME_TOP_GUTTER_BOUNDS (f); + int y2 = WINDOW_BOTTOM (w) + FRAME_BOTTOM_GUTTER_BOUNDS (f); /* Clear left and right spacing areas */ if (spacing) { - rect.top = WINDOW_TOP (w); - rect.bottom = WINDOW_BOTTOM (w); + rect.top = y1; + rect.bottom = y2; mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, WINDOW_FACE_CACHEL_BACKGROUND (w, DEFAULT_INDEX), Qnil); rect.right = WINDOW_RIGHT (w); @@ -1329,8 +1334,8 @@ mswindows_output_vertical_divider (struct window *w, int clear_unused) } /* Clear divider face */ - rect.top = WINDOW_TOP (w) + abs_shadow; - rect.bottom = WINDOW_BOTTOM (w) - abs_shadow; + rect.top = y1 + abs_shadow; + rect.bottom = y2 - abs_shadow; rect.left = div_left + spacing + abs_shadow; rect.right = rect.left + line_width; if (rect.left < rect.right) @@ -1346,7 +1351,7 @@ mswindows_output_vertical_divider (struct window *w, int clear_unused) /* Draw a shadow around the divider */ if (shadow != 0) { - /* #### This will be fixed to support arbitrary thichkness */ + /* #### This will be fixed to support arbitrary thickness */ InflateRect (&rect, abs_shadow, abs_shadow); DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, shadow > 0 ? EDGE_RAISED : EDGE_SUNKEN, BF_RECT); @@ -1386,69 +1391,15 @@ mswindows_text_width (struct frame *f, struct face_cachel *cachel, given face. ****************************************************************************/ static void -mswindows_clear_region (Lisp_Object locale, face_index findex, int x, int y, - int width, int height) +mswindows_clear_region (Lisp_Object locale, struct device* d, struct frame* f, + face_index findex, int x, int y, + int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, + Lisp_Object background_pixmap) { - struct window *w; - struct frame *f; - Lisp_Object background_pixmap = Qunbound; - Lisp_Object temp; RECT rect = { x, y, x+width, y+height }; - if (!(width && height)) /* We often seem to get called with width==0 */ - return; - - if (WINDOWP (locale)) - { - w = XWINDOW (locale); - f = XFRAME (w->frame); - } - else if (FRAMEP (locale)) + if (!NILP (background_pixmap)) { - w = NULL; - f = XFRAME (locale); - } - else - abort (); - - if (w) - { - temp = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, findex); - - if (IMAGE_INSTANCEP (temp) - && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp))) - { - /* #### maybe we could implement such that a string - can be a background pixmap? */ - background_pixmap = temp; - } - } - else - { - temp = FACE_BACKGROUND_PIXMAP (Vdefault_face, locale); - - if (IMAGE_INSTANCEP (temp) - && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (temp))) - { - background_pixmap = temp; - } - } - - if (!UNBOUNDP (background_pixmap)) - { - Lisp_Object fcolor, bcolor; - - if (w) - { - fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); - bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); - } - else - { - fcolor = FACE_FOREGROUND (Vdefault_face, locale); - bcolor = FACE_BACKGROUND (Vdefault_face, locale); - } - mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, fcolor, bcolor, background_pixmap); @@ -1458,68 +1409,17 @@ mswindows_clear_region (Lisp_Object locale, face_index findex, int x, int y, } else { - Lisp_Object color = (w ? WINDOW_FACE_CACHEL_BACKGROUND (w, findex) : - FACE_BACKGROUND (Vdefault_face, locale)); - mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, color, Qnil); - ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); + mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, fcolor, Qnil); + ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, + &rect, NULL, 0, NULL); } #ifdef HAVE_SCROLLBARS if (WINDOWP (locale)) - mswindows_redisplay_deadbox_maybe (w, &rect); + mswindows_redisplay_deadbox_maybe (XWINDOW (locale), &rect); #endif } -/***************************************************************************** - mswindows_clear_to_window_end - - Clear the area between ypos1 and ypos2. Each margin area and the - text area is handled separately since they may each have their own - background color. - ****************************************************************************/ -static void -mswindows_clear_to_window_end (struct window *w, int ypos1, int ypos2) -{ - int height = ypos2 - ypos1; - - if (height) - { - struct frame *f = XFRAME (w->frame); - Lisp_Object window; - int bflag = (window_needs_vertical_divider (w) ? 0 : 1); - layout_bounds bounds; - - bounds = calculate_display_line_boundaries (w, bflag); - XSETWINDOW (window, w); - - if (window_is_leftmost (w)) - mswindows_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f), - ypos1, FRAME_BORDER_WIDTH (f), height); - - if (bounds.left_in - bounds.left_out > 0) - mswindows_clear_region (window, - get_builtin_face_cache_index (w, Vleft_margin_face), - bounds.left_out, ypos1, - bounds.left_in - bounds.left_out, height); - - if (bounds.right_in - bounds.left_in > 0) - mswindows_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1, - bounds.right_in - bounds.left_in, height); - - if (bounds.right_out - bounds.right_in > 0) - mswindows_clear_region (window, - get_builtin_face_cache_index (w, Vright_margin_face), - bounds.right_in, ypos1, - bounds.right_out - bounds.right_in, height); - - if (window_is_rightmost (w)) - mswindows_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f), - ypos1, FRAME_BORDER_WIDTH (f), height); - } - -} - - /* XXX Implement me! */ static void mswindows_clear_frame (struct frame *f) @@ -1542,11 +1442,11 @@ console_type_create_redisplay_mswindows (void) CONSOLE_HAS_METHOD (mswindows, divider_height); CONSOLE_HAS_METHOD (mswindows, eol_cursor_width); CONSOLE_HAS_METHOD (mswindows, output_vertical_divider); - CONSOLE_HAS_METHOD (mswindows, clear_to_window_end); CONSOLE_HAS_METHOD (mswindows, clear_region); CONSOLE_HAS_METHOD (mswindows, clear_frame); CONSOLE_HAS_METHOD (mswindows, output_begin); CONSOLE_HAS_METHOD (mswindows, output_end); CONSOLE_HAS_METHOD (mswindows, flash); CONSOLE_HAS_METHOD (mswindows, ring_bell); + CONSOLE_HAS_METHOD (mswindows, bevel_area); }