Mercurial > hg > xemacs-beta
comparison src/redisplay-msw.c @ 284:558f606b08ae r21-0b40
Import from CVS: tag r21-0b40
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:34:13 +0200 |
parents | c42ec1d1cded |
children | 57709be46d1b |
comparison
equal
deleted
inserted
replaced
283:fa3d41851a08 | 284:558f606b08ae |
---|---|
48 #include "windows.h" | 48 #include "windows.h" |
49 #ifdef MULE | 49 #ifdef MULE |
50 #include "mule-ccl.h" | 50 #include "mule-ccl.h" |
51 #include "mule-charset.h" | 51 #include "mule-charset.h" |
52 #endif | 52 #endif |
53 | |
54 /* MSWINDOWS_DIVIDER_LINE_WIDTH is the width of the line drawn in the gutter. | |
55 MSWINDOWS_DIVIDER_SPACING is the amount of blank space on each side of the line. | |
56 MSWINDOWS_DIVIDER_WIDTH = MSWINDOWS_DIVIDER_LINE_WIDTH + 2*MSWINDOWS_DIVIDER_SPACING | |
57 */ | |
58 #define MSWINDOWS_DIVIDER_LINE_WIDTH 7 | |
59 #define MSWINDOWS_DIVIDER_SPACING 0 | |
60 #define MSWINDOWS_DIVIDER_WIDTH (MSWINDOWS_DIVIDER_LINE_WIDTH + 2 * MSWINDOWS_DIVIDER_SPACING) | |
61 | 53 |
62 #define MSWINDOWS_EOL_CURSOR_WIDTH 5 | 54 #define MSWINDOWS_EOL_CURSOR_WIDTH 5 |
63 | 55 |
64 /* | 56 /* |
65 * Random forward delarations | 57 * Random forward delarations |
69 static void mswindows_clear_region (Lisp_Object locale, face_index findex, | 61 static void mswindows_clear_region (Lisp_Object locale, face_index findex, |
70 int x, int y, int width, int height); | 62 int x, int y, int width, int height); |
71 static void mswindows_output_vertical_divider (struct window *w, int clear); | 63 static void mswindows_output_vertical_divider (struct window *w, int clear); |
72 static void mswindows_redraw_exposed_windows (Lisp_Object window, int x, | 64 static void mswindows_redraw_exposed_windows (Lisp_Object window, int x, |
73 int y, int width, int height); | 65 int y, int width, int height); |
66 static void mswindows_output_dibitmap (struct frame *f, | |
67 struct Lisp_Image_Instance *p, | |
68 int x, int y, | |
69 int clip_x, int clip_y, | |
70 int clip_width, int clip_height, | |
71 int width, int height, | |
72 int pixmap_offset, | |
73 int offset_bitmap); | |
74 static void mswindows_output_pixmap (struct window *w, struct display_line *dl, | 74 static void mswindows_output_pixmap (struct window *w, struct display_line *dl, |
75 Lisp_Object image_instance, int xpos, | 75 Lisp_Object image_instance, int xpos, |
76 int xoffset, int start_pixpos, int width, | 76 int xoffset, int start_pixpos, int width, |
77 face_index findex, int cursor_start, | 77 face_index findex, int cursor_start, |
78 int cursor_width, int cursor_height); | 78 int cursor_width, int cursor_height, |
79 int offset_bitmap); | |
79 | 80 |
80 typedef struct textual_run | 81 typedef struct textual_run |
81 { | 82 { |
82 Lisp_Object charset; | 83 Lisp_Object charset; |
83 unsigned char *ptr; | 84 unsigned char *ptr; |
218 Lisp_Object bg, Lisp_Object bg_pmap) | 219 Lisp_Object bg, Lisp_Object bg_pmap) |
219 { | 220 { |
220 if (!NILP (font)) | 221 if (!NILP (font)) |
221 SelectObject(hdc, FONT_INSTANCE_MSWINDOWS_HFONT (XFONT_INSTANCE (font))); | 222 SelectObject(hdc, FONT_INSTANCE_MSWINDOWS_HFONT (XFONT_INSTANCE (font))); |
222 | 223 |
223 #if defined(DEBUG_XEMACS) | |
224 /* evil kludge! - #### do we need this? - cygwin does for some | |
225 reason --andyp */ | |
226 if (!NILP (fg) && !COLOR_INSTANCEP (fg)) | |
227 { | |
228 /* this break under mule */ | |
229 #if 0 | |
230 fprintf (stderr, "Help! mswindows_update_dc got a bogus fg value! fg = "); | |
231 debug_print (fg); | |
232 #endif | |
233 fg = Qnil; | |
234 } | |
235 | |
236 if (!NILP (bg) && !COLOR_INSTANCEP (bg)) | |
237 { | |
238 /* this break under mule */ | |
239 #if 0 | |
240 fprintf (stderr, "Help! mswindows_update_dc got a bogus fg value! bg = "); | |
241 debug_print (bg); | |
242 #endif | |
243 bg = Qnil; | |
244 } | |
245 #endif | |
246 | 224 |
247 if (!NILP (fg)) | 225 if (!NILP (fg)) |
248 SetTextColor (hdc, COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (fg))); | 226 { |
249 | 227 SetTextColor (hdc, COLOR_INSTANCE_MSWINDOWS_COLOR |
228 (XCOLOR_INSTANCE (fg))); | |
229 } | |
250 if (!NILP (bg)) | 230 if (!NILP (bg)) |
251 SetBkColor (hdc, COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (bg))); | 231 { |
232 SetBkMode (hdc, OPAQUE); | |
233 SetBkColor (hdc, COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (bg))); | |
234 } | |
235 else | |
236 { | |
237 SetBkMode (hdc, TRANSPARENT); | |
238 } | |
252 } | 239 } |
253 | 240 |
254 | 241 |
255 /***************************************************************************** | 242 /***************************************************************************** |
256 mswindows_output_hline | 243 mswindows_output_hline |
283 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) | 270 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) |
284 bg_pmap = Qnil; | 271 bg_pmap = Qnil; |
285 | 272 |
286 if (!NILP(bg_pmap)) | 273 if (!NILP(bg_pmap)) |
287 { | 274 { |
275 /* blank the background in the appropriate color */ | |
276 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, cachel->foreground, | |
277 cachel->background, Qnil); | |
278 | |
288 mswindows_output_pixmap (w, dl, bg_pmap, | 279 mswindows_output_pixmap (w, dl, bg_pmap, |
289 rb->xpos, rb->object.dglyph.xoffset, | 280 rb->xpos, 0 /*rb->object.dglyph.xoffset*/, |
290 start_pixpos, rb->width, rb->findex, | 281 start_pixpos, rb->width, rb->findex, |
291 0, 0, 0); | 282 0, 0, 0, TRUE); |
292 } | 283 } |
293 else | 284 else |
294 { | 285 { |
295 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, | 286 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, |
296 cachel->background, Qnil); | 287 cachel->background, Qnil); |
429 Lisp_Object bg_pmap; | 420 Lisp_Object bg_pmap; |
430 int len = Dynarr_length (buf); | 421 int len = Dynarr_length (buf); |
431 unsigned char *text_storage = (unsigned char *) alloca (2 * len); | 422 unsigned char *text_storage = (unsigned char *) alloca (2 * len); |
432 textual_run *runs = alloca_array (textual_run, len); | 423 textual_run *runs = alloca_array (textual_run, len); |
433 int nruns; | 424 int nruns; |
434 int i; | 425 int i, height; |
426 RECT rect; | |
435 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex); | 427 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex); |
436 | 428 |
437 XSETWINDOW (window, w); | 429 XSETWINDOW (window, w); |
438 | 430 |
439 #if 0 /* XXX: FIXME? */ | 431 #if 0 /* XXX: FIXME? */ |
452 /* It's all clipped out. */ | 444 /* It's all clipped out. */ |
453 return; | 445 return; |
454 | 446 |
455 xpos -= xoffset; | 447 xpos -= xoffset; |
456 | 448 |
457 nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0), | 449 /* sort out the destination rectangle */ |
458 Dynarr_length (buf)); | 450 height = dl->ascent + dl->descent - dl->clip; |
459 | 451 rect.left = clip_start; |
452 rect.top = dl->ypos - dl->ascent; | |
453 rect.right = clip_end; | |
454 rect.bottom = height + dl->ypos - dl->ascent; | |
455 | |
456 /* output the background pixmap if there is one */ | |
460 bg_pmap = cachel->background_pixmap; | 457 bg_pmap = cachel->background_pixmap; |
461 if (!IMAGE_INSTANCEP (bg_pmap) | 458 if (!IMAGE_INSTANCEP (bg_pmap) |
462 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) | 459 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) |
463 bg_pmap = Qnil; | 460 bg_pmap = Qnil; |
464 | 461 |
462 if (!NILP(bg_pmap)) | |
463 { | |
464 /* blank the background in the appropriate color */ | |
465 mswindows_update_dc (hdc, Qnil, cachel->foreground, | |
466 cachel->background, Qnil); | |
467 | |
468 mswindows_output_pixmap (w, dl, bg_pmap, | |
469 xpos, xoffset, | |
470 clip_start, width, findex, | |
471 0, 0, 0, TRUE); | |
472 /* output pixmap calls this so we have to recall to get correct | |
473 references */ | |
474 cachel = WINDOW_FACE_CACHEL (w, findex); | |
475 } | |
476 | |
477 nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0), | |
478 Dynarr_length (buf)); | |
479 | |
465 for (i = 0; i < nruns; i++) | 480 for (i = 0; i < nruns; i++) |
466 { | 481 { |
467 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset); | 482 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset); |
468 /* struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font);*/ | 483 struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font); |
469 int this_width; | 484 int this_width; |
470 RECT rect = { clip_start, dl->ypos - dl->ascent, | |
471 clip_end, dl->ypos + dl->descent - dl->clip }; | |
472 | 485 |
473 if (EQ (font, Vthe_null_font_instance)) | 486 if (EQ (font, Vthe_null_font_instance)) |
474 continue; | 487 continue; |
475 | 488 |
476 mswindows_update_dc (hdc, font, cachel->foreground, | 489 mswindows_update_dc (hdc, font, cachel->foreground, |
477 NILP(bg_pmap) ? cachel->background : Qnil, Qnil); | 490 NILP(bg_pmap) ? cachel->background : Qnil, Qnil); |
478 | 491 |
479 this_width = mswindows_text_width_single_run (hdc, cachel, runs + i); | 492 this_width = mswindows_text_width_single_run (hdc, cachel, runs + i); |
480 | 493 |
481 /* #### bg_pmap should be output here */ | 494 /* cope with fonts taller than lines */ |
482 if (!NILP(bg_pmap)) | 495 if ((int) fi->height < (int) (height + dl->clip)) |
483 { | 496 { |
484 mswindows_output_pixmap (w, dl, bg_pmap, | 497 int clear_start = max (xpos, clip_start); |
485 xpos, xoffset, | 498 int clear_end = min (xpos + this_width, clip_end); |
486 clip_start, width, findex, | 499 |
487 0, 0, 0); | 500 { |
488 } | 501 mswindows_clear_region (window, findex, clear_start, |
502 dl->ypos - dl->ascent, | |
503 clear_end - clear_start, | |
504 height); | |
505 /* output pixmap calls this so we have to recall to get correct | |
506 references */ | |
507 cachel = WINDOW_FACE_CACHEL (w, findex); | |
508 } | |
509 } | |
510 | |
489 assert (runs[i].dimension == 1); /* XXX FIXME */ | 511 assert (runs[i].dimension == 1); /* XXX FIXME */ |
490 ExtTextOut (hdc, xpos, dl->ypos, | 512 ExtTextOut (hdc, xpos, dl->ypos, |
491 NILP(bg_pmap) ? ETO_CLIPPED | ETO_OPAQUE : ETO_CLIPPED, | 513 NILP(bg_pmap) ? ETO_CLIPPED | ETO_OPAQUE : ETO_CLIPPED, |
492 &rect, (char *) runs[i].ptr, runs[i].len, NULL); | 514 &rect, (char *) runs[i].ptr, runs[i].len, NULL); |
493 | 515 |
496 | 518 |
497 xpos += this_width; | 519 xpos += this_width; |
498 } | 520 } |
499 } | 521 } |
500 | 522 |
501 void | 523 static void |
502 mswindows_output_dibitmap (struct frame *f, struct Lisp_Image_Instance *p, | 524 mswindows_output_dibitmap (struct frame *f, struct Lisp_Image_Instance *p, |
503 int x, int y, | 525 int x, int y, |
504 int clip_x, int clip_y, | 526 int clip_x, int clip_y, |
505 int clip_width, int clip_height, | 527 int clip_width, int clip_height, |
506 int width, int height, int pixmap_offset) | 528 int width, int height, int pixmap_offset, |
529 int offset_bitmap) | |
507 { | 530 { |
508 HDC hdc = FRAME_MSWINDOWS_DC (f); | 531 HDC hdc = FRAME_MSWINDOWS_DC (f); |
509 HGDIOBJ old; | 532 HGDIOBJ old=NULL; |
533 COLORREF bgcolor = GetBkColor (hdc); | |
510 int need_clipping = (clip_x || clip_y); | 534 int need_clipping = (clip_x || clip_y); |
535 int yoffset=0; | |
536 int xoffset=0; | |
537 /* do we need to offset the pixmap vertically? this is necessary | |
538 for background pixmaps. */ | |
539 if (offset_bitmap) | |
540 { | |
541 yoffset = y % IMAGE_INSTANCE_PIXMAP_HEIGHT (p); | |
542 xoffset = x % IMAGE_INSTANCE_PIXMAP_WIDTH (p); | |
543 /* the width is handled by mswindows_output_pixmap_region */ | |
544 } | |
511 | 545 |
512 if (need_clipping) | 546 if (need_clipping) |
513 { | 547 { |
514 #if 0 | 548 } |
515 XRectangle clip_box[1]; | 549 |
550 /* first blt the mask */ | |
551 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) | |
552 { | |
553 RGBQUAD col; | |
554 col.rgbBlue = GetBValue (bgcolor); | |
555 col.rgbRed = GetRValue (bgcolor); | |
556 col.rgbGreen = GetGValue (bgcolor); | |
557 col.rgbReserved = 0; | |
558 | |
559 old = SelectObject (FRAME_MSWINDOWS_CDC (f), | |
560 IMAGE_INSTANCE_MSWINDOWS_MASK (p)); | |
516 | 561 |
517 clip_box[0].x = clip_x; | 562 SetDIBColorTable (FRAME_MSWINDOWS_CDC (f), 1, 1, &col); |
518 clip_box[0].y = clip_y; | 563 |
519 clip_box[0].width = clip_width; | 564 BitBlt (hdc, |
520 clip_box[0].height = clip_height; | 565 x,y, |
521 | 566 width, height, |
522 XSetClipRectangles (dpy, gc, x, y, clip_box, 1, Unsorted); | 567 FRAME_MSWINDOWS_CDC (f), |
523 #endif | 568 xoffset,yoffset, |
524 } | 569 SRCCOPY); |
525 | 570 |
526 /* Select the bitmaps into the compatible DC. */ | 571 SelectObject (FRAME_MSWINDOWS_CDC (f), old); |
527 if ((old=SelectObject(FRAME_MSWINDOWS_CDC (f), | 572 } |
528 IMAGE_INSTANCE_MSWINDOWS_BITMAP (p)))) | 573 |
529 { | 574 /* now blt the bitmap itself. */ |
530 if (!IMAGE_INSTANCE_MSWINDOWS_MASK (p)) | 575 old = SelectObject (FRAME_MSWINDOWS_CDC (f), |
531 { | 576 IMAGE_INSTANCE_MSWINDOWS_BITMAP (p)); |
532 BitBlt(hdc, | 577 |
533 x,y, | 578 BitBlt (hdc, |
534 width, height, | 579 x,y, |
535 FRAME_MSWINDOWS_CDC (f), | 580 width, height, |
536 0,0, | 581 FRAME_MSWINDOWS_CDC (f), |
537 SRCCOPY); | 582 xoffset, yoffset, |
538 } | 583 IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY); |
539 else | 584 |
540 { | 585 SelectObject (FRAME_MSWINDOWS_CDC (f),old); |
541 MaskBlt(hdc, | 586 |
542 x,y, | |
543 width, height, | |
544 FRAME_MSWINDOWS_CDC (f), | |
545 0,0, | |
546 IMAGE_INSTANCE_MSWINDOWS_MASK (p), | |
547 0,0, | |
548 MAKEROP4(SRCINVERT,SRCCOPY)); | |
549 } | |
550 SelectObject (FRAME_MSWINDOWS_CDC (f),old); | |
551 } | |
552 else | |
553 { | |
554 /* error */ | |
555 } | |
556 | |
557 #if 0 | |
558 if (need_clipping) | 587 if (need_clipping) |
559 { | 588 { |
560 XSetClipMask (dpy, gc, None); | 589 } |
561 XSetClipOrigin (dpy, gc, 0, 0); | 590 } |
562 } | 591 |
563 #endif | 592 /* |
593 * X gc's have this nice property that setting the bg pixmap will | |
594 * output it offset relative to the window. Windows doesn't have this | |
595 * feature so we have to emulate this by outputting multiple pixmaps | |
596 */ | |
597 static void | |
598 mswindows_output_dibitmap_region (struct frame *f, | |
599 struct Lisp_Image_Instance *p, | |
600 int x, int y, | |
601 int clip_x, int clip_y, | |
602 int clip_width, int clip_height, | |
603 int width, int height, int pixmap_offset, | |
604 int offset_bitmap) | |
605 { | |
606 int pwidth = min (width, IMAGE_INSTANCE_PIXMAP_WIDTH (p)); | |
607 int pheight = min (height, IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); | |
608 int pxoffset = 0, pyoffset = 0; | |
609 | |
610 /* when doing a bg pixmap do a partial pixmap first so that we | |
611 blt whole pixmaps thereafter */ | |
612 | |
613 if (offset_bitmap) | |
614 { | |
615 pheight = min (pheight, IMAGE_INSTANCE_PIXMAP_HEIGHT (p) - | |
616 y % IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); | |
617 } | |
618 | |
619 while (pheight > 0) | |
620 { | |
621 if (offset_bitmap) | |
622 { | |
623 pwidth = min (min (width, IMAGE_INSTANCE_PIXMAP_WIDTH (p)), | |
624 IMAGE_INSTANCE_PIXMAP_WIDTH (p) - | |
625 x % IMAGE_INSTANCE_PIXMAP_WIDTH (p)); | |
626 pxoffset = 0; | |
627 } | |
628 while (pwidth > 0) | |
629 { | |
630 mswindows_output_dibitmap (f, p, | |
631 x + pxoffset, y + pyoffset, | |
632 clip_x, clip_y, | |
633 clip_width, clip_height, | |
634 pwidth, pheight, pixmap_offset, | |
635 offset_bitmap); | |
636 pxoffset += pwidth; | |
637 pwidth = min ((width-pxoffset), | |
638 IMAGE_INSTANCE_PIXMAP_WIDTH (p)); | |
639 } | |
640 pyoffset += pheight; | |
641 pheight = min ((height-pyoffset), | |
642 IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); | |
643 } | |
564 } | 644 } |
565 | 645 |
566 static void | 646 static void |
567 mswindows_output_pixmap (struct window *w, struct display_line *dl, | 647 mswindows_output_pixmap (struct window *w, struct display_line *dl, |
568 Lisp_Object image_instance, int xpos, int xoffset, | 648 Lisp_Object image_instance, int xpos, int xoffset, |
569 int start_pixpos, int width, face_index findex, | 649 int start_pixpos, int width, face_index findex, |
570 int cursor_start, int cursor_width, int cursor_height) | 650 int cursor_start, int cursor_width, int cursor_height, |
651 int offset_bitmap) | |
571 { | 652 { |
572 struct frame *f = XFRAME (w->frame); | 653 struct frame *f = XFRAME (w->frame); |
573 #if 0 | |
574 HDC hdc = FRAME_MSWINDOWS_DC (f); | 654 HDC hdc = FRAME_MSWINDOWS_DC (f); |
575 #endif | 655 |
576 struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); | 656 struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance); |
577 Lisp_Object window; | 657 Lisp_Object window; |
578 | 658 |
579 int lheight = dl->ascent + dl->descent - dl->clip; | 659 int lheight = dl->ascent + dl->descent - dl->clip; |
580 int pheight = ((int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p) > lheight ? lheight : | 660 int pheight = ((int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p) > lheight ? lheight : |
581 IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); | 661 IMAGE_INSTANCE_PIXMAP_HEIGHT (p)); |
582 int pwidth = min (width + xoffset, (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p)); | |
583 int clip_x, clip_y, clip_width, clip_height; | 662 int clip_x, clip_y, clip_width, clip_height; |
584 | 663 |
585 /* The pixmap_offset is used to center the pixmap on lines which are | 664 /* The pixmap_offset is used to center the pixmap on lines which are |
586 shorter than it is. This results in odd effects when scrolling | 665 shorter than it is. This results in odd effects when scrolling |
587 pixmaps off of the bottom. Let's try not using it. */ | 666 pixmaps off of the bottom. Let's try not using it. */ |
653 { | 732 { |
654 clear_x = xpos; | 733 clear_x = xpos; |
655 clear_width = width; | 734 clear_width = width; |
656 } | 735 } |
657 | 736 |
658 mswindows_clear_region (window, findex, clear_x, clear_y, | 737 if (!offset_bitmap) /* i.e. not a bg pixmap */ |
659 clear_width, clear_height); | 738 mswindows_clear_region (window, findex, clear_x, clear_y, |
660 } | 739 clear_width, clear_height); |
661 | 740 } |
662 /* Output the pixmap. */ | 741 |
663 { | 742 /* Output the pixmap. Have to do this as many times as is required |
664 Lisp_Object tmp_pixel; | 743 to fill the given area */ |
665 COLORREF tmp_bcolor, tmp_fcolor; | 744 mswindows_update_dc (hdc, Qnil, |
666 | 745 WINDOW_FACE_CACHEL_FOREGROUND (w, findex), |
667 tmp_pixel = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); | 746 WINDOW_FACE_CACHEL_BACKGROUND (w, findex), Qnil); |
668 tmp_fcolor = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (tmp_pixel)); | 747 |
669 tmp_pixel = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); | 748 mswindows_output_dibitmap_region (f, p, xpos - xoffset, |
670 tmp_bcolor = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (tmp_pixel)); | 749 dl->ypos - dl->ascent, |
671 #if 0 | 750 clip_x, clip_y, clip_width, clip_height, |
672 mswindows_update_dc (hdc, Qnil, tmp_fcolor, | 751 width + xoffset, pheight, pixmap_offset, |
673 tmp_bcolor, Qnil); | 752 offset_bitmap); |
674 #endif | |
675 mswindows_output_dibitmap (f, p, xpos - xoffset, dl->ypos - dl->ascent, | |
676 clip_x, clip_y, clip_width, clip_height, | |
677 pwidth, pheight, pixmap_offset); | |
678 } | |
679 } | 753 } |
680 | 754 |
681 #ifdef HAVE_SCROLLBARS | 755 #ifdef HAVE_SCROLLBARS |
682 /* | 756 /* |
683 * This function paints window's deadbox, a rectangle between window | 757 * This function paints window's deadbox, a rectangle between window |
694 RECT rect_dead, rect_paint; | 768 RECT rect_dead, rect_paint; |
695 if (sbh == 0 || sbw == 0) | 769 if (sbh == 0 || sbw == 0) |
696 return; | 770 return; |
697 | 771 |
698 if (!NILP (w->scrollbar_on_left_p)) | 772 if (!NILP (w->scrollbar_on_left_p)) |
699 { | 773 rect_dead.left = WINDOW_LEFT (w); |
700 rect_dead.left = WINDOW_LEFT (w); | |
701 rect_dead.right = WINDOW_LEFT (w) + sbw; | |
702 } | |
703 else | 774 else |
704 { | 775 rect_dead.left = WINDOW_TEXT_RIGHT (w); |
705 rect_dead.left = WINDOW_RIGHT (w) - sbw; | 776 rect_dead.right = rect_dead.left + sbw; |
706 rect_dead.right = WINDOW_RIGHT (w); | |
707 } | |
708 | 777 |
709 if (!NILP (w->scrollbar_on_top_p)) | 778 if (!NILP (w->scrollbar_on_top_p)) |
710 { | 779 rect_dead.top = WINDOW_TOP (w); |
711 rect_dead.top = WINDOW_TOP (w); | |
712 rect_dead.bottom = WINDOW_TOP (w) + sbh; | |
713 } | |
714 else | 780 else |
715 { | 781 rect_dead.top = WINDOW_TEXT_BOTTOM (w); |
716 int modh = window_modeline_height (w); | 782 rect_dead.bottom = rect_dead.top + sbh; |
717 rect_dead.top = WINDOW_BOTTOM (w) - modh - sbh; | |
718 rect_dead.bottom = WINDOW_BOTTOM (w) - modh; | |
719 } | |
720 | 783 |
721 if (IntersectRect (&rect_paint, &rect_dead, prc)) | 784 if (IntersectRect (&rect_paint, &rect_dead, prc)) |
722 { | 785 { |
723 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 786 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
724 FillRect (FRAME_MSWINDOWS_DC (f), &rect_paint, | 787 FillRect (FRAME_MSWINDOWS_DC (f), &rect_paint, |
890 DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, edge, BF_RECT); | 953 DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, edge, BF_RECT); |
891 } | 954 } |
892 | 955 |
893 | 956 |
894 /***************************************************************************** | 957 /***************************************************************************** |
895 #### Display methods | 958 Display methods |
896 *****************************************************************************/ | 959 *****************************************************************************/ |
897 | |
898 /***************************************************************************** | |
899 mswindows_divider_width | |
900 | |
901 Return the width of the vertical divider. | |
902 ****************************************************************************/ | |
903 static int | |
904 mswindows_divider_width (void) | |
905 { | |
906 return MSWINDOWS_DIVIDER_WIDTH; | |
907 } | |
908 | 960 |
909 /***************************************************************************** | 961 /***************************************************************************** |
910 mswindows_divider_height | 962 mswindows_divider_height |
911 | 963 |
912 Return the height of the horizontal divider. | 964 Return the height of the horizontal divider. |
1139 case IMAGE_MONO_PIXMAP: | 1191 case IMAGE_MONO_PIXMAP: |
1140 case IMAGE_COLOR_PIXMAP: | 1192 case IMAGE_COLOR_PIXMAP: |
1141 mswindows_output_pixmap (w, dl, instance, xpos, | 1193 mswindows_output_pixmap (w, dl, instance, xpos, |
1142 rb->object.dglyph.xoffset, start_pixpos, | 1194 rb->object.dglyph.xoffset, start_pixpos, |
1143 rb->width, findex, cursor_start, | 1195 rb->width, findex, cursor_start, |
1144 cursor_width, cursor_height); | 1196 cursor_width, cursor_height, 0); |
1145 if (rb->cursor_type == CURSOR_ON) | 1197 if (rb->cursor_type == CURSOR_ON) |
1146 mswindows_output_cursor (w, dl, xpos, cursor_width, | 1198 mswindows_output_cursor (w, dl, xpos, cursor_width, |
1147 findex, 0, 1); | 1199 findex, 0, 1); |
1148 break; | 1200 break; |
1149 | 1201 |
1185 | 1237 |
1186 | 1238 |
1187 /***************************************************************************** | 1239 /***************************************************************************** |
1188 mswindows_output_vertical_divider | 1240 mswindows_output_vertical_divider |
1189 | 1241 |
1190 Draw a vertical divider down the left side of the given window. | 1242 Draw a vertical divider down the right side of the given window. |
1191 ****************************************************************************/ | 1243 ****************************************************************************/ |
1192 static void | 1244 static void |
1193 mswindows_output_vertical_divider (struct window *w, int clear) | 1245 mswindows_output_vertical_divider (struct window *w, int clear_unused) |
1194 { | 1246 { |
1195 struct frame *f = XFRAME (w->frame); | 1247 struct frame *f = XFRAME (w->frame); |
1196 Lisp_Object color; | |
1197 RECT rect; | 1248 RECT rect; |
1198 int shadow_width = MODELINE_SHADOW_THICKNESS (w); | 1249 int spacing = XINT (w->vertical_divider_spacing); |
1199 | 1250 int shadow = XINT (w->vertical_divider_shadow_thickness); |
1200 /* We don't use the normal gutter measurements here because the | 1251 int abs_shadow = abs (shadow); |
1201 horizontal scrollbars and toolbars do not stretch completely over | 1252 int line_width = XINT (w->vertical_divider_line_width); |
1202 to the right edge of the window. Only the modeline does. */ | 1253 int div_left = WINDOW_RIGHT (w) - window_divider_width (w); |
1203 int modeline_height = window_modeline_height (w); | 1254 |
1204 | 1255 /* Clear left and right spacing areas */ |
1205 assert(!MSWINDOWS_DIVIDER_SPACING); /* This code doesn't handle this */ | 1256 if (spacing) |
1206 | 1257 { |
1207 /* XXX Not sure about this */ | 1258 rect.top = WINDOW_TOP (w); |
1208 #ifdef HAVE_SCROLLBARS | 1259 rect.bottom = WINDOW_BOTTOM (w); |
1209 if (!NILP (w->scrollbar_on_left_p)) | 1260 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, |
1210 rect.left = WINDOW_LEFT (w); | 1261 WINDOW_FACE_CACHEL_BACKGROUND (w, DEFAULT_INDEX), Qnil); |
1211 else | 1262 rect.right = WINDOW_RIGHT (w); |
1212 rect.left = WINDOW_RIGHT (w) - MSWINDOWS_DIVIDER_WIDTH; | 1263 rect.left = rect.right - spacing; |
1213 #else | 1264 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, |
1214 rect.left = WINDOW_LEFT (w); | 1265 &rect, NULL, 0, NULL); |
1215 #endif | 1266 rect.left = div_left; |
1216 rect.right = rect.left + MSWINDOWS_DIVIDER_WIDTH; | 1267 rect.right = div_left + spacing; |
1217 | 1268 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, |
1218 #ifdef HAVE_SCROLLBARS | 1269 &rect, NULL, 0, NULL); |
1219 if (!NILP (w->scrollbar_on_top_p)) | 1270 } |
1220 rect.top = WINDOW_TOP (w); | 1271 |
1221 else | 1272 /* Clear divider face */ |
1222 #endif | 1273 rect.top = WINDOW_TOP (w) + abs_shadow; |
1223 rect.top = WINDOW_TEXT_TOP (w); | 1274 rect.bottom = WINDOW_BOTTOM (w) - abs_shadow; |
1224 rect.bottom = WINDOW_BOTTOM (w) - modeline_height; | 1275 rect.left = div_left + spacing + abs_shadow; |
1225 | 1276 rect.right = rect.left + line_width; |
1226 /* Draw the divider line */ | 1277 if (rect.left < rect.right) |
1227 color = WINDOW_FACE_CACHEL_BACKGROUND (w, MODELINE_INDEX); | 1278 { |
1228 mswindows_update_dc (FRAME_MSWINDOWS_DC(f), Qnil, Qnil, color, Qnil); | 1279 face_index div_face |
1229 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); | 1280 = get_builtin_face_cache_index (w, Vvertical_divider_face); |
1230 if (shadow_width) | 1281 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, |
1231 DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, | 1282 WINDOW_FACE_CACHEL_BACKGROUND (w, div_face), Qnil); |
1232 shadow_width==1 ? BDR_RAISEDINNER : EDGE_RAISED, | 1283 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, |
1233 BF_TOP|BF_RIGHT|BF_LEFT); | 1284 &rect, NULL, 0, NULL); |
1234 } | 1285 } |
1235 | 1286 |
1287 /* Draw a shadow around the divider */ | |
1288 if (shadow != 0) | |
1289 { | |
1290 /* #### This will be fixed to support arbitrary thichkness */ | |
1291 InflateRect (&rect, abs_shadow, abs_shadow); | |
1292 DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, | |
1293 shadow > 0 ? EDGE_RAISED : EDGE_SUNKEN, BF_RECT); | |
1294 } | |
1295 } | |
1236 | 1296 |
1237 /**************************************************************************** | 1297 /**************************************************************************** |
1238 mswindows_text_width | 1298 mswindows_text_width |
1239 | 1299 |
1240 Given a string and a face, return the string's length in pixels when | 1300 Given a string and a face, return the string's length in pixels when |
1316 } | 1376 } |
1317 } | 1377 } |
1318 | 1378 |
1319 if (!UNBOUNDP (background_pixmap)) | 1379 if (!UNBOUNDP (background_pixmap)) |
1320 { | 1380 { |
1381 Lisp_Object fcolor, bcolor; | |
1382 | |
1383 if (w) | |
1384 { | |
1385 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); | |
1386 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); | |
1387 } | |
1388 else | |
1389 { | |
1390 fcolor = FACE_FOREGROUND (Vdefault_face, locale); | |
1391 bcolor = FACE_BACKGROUND (Vdefault_face, locale); | |
1392 } | |
1393 | |
1394 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), | |
1395 Qnil, fcolor, bcolor, background_pixmap); | |
1396 | |
1321 if (XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0) | 1397 if (XIMAGE_INSTANCE_PIXMAP_DEPTH (background_pixmap) == 0) |
1322 { | 1398 { |
1323 Lisp_Object fcolor, bcolor; | |
1324 | |
1325 if (w) | |
1326 { | |
1327 fcolor = WINDOW_FACE_CACHEL_FOREGROUND (w, findex); | |
1328 bcolor = WINDOW_FACE_CACHEL_BACKGROUND (w, findex); | |
1329 } | |
1330 else | |
1331 { | |
1332 fcolor = FACE_FOREGROUND (Vdefault_face, locale); | |
1333 bcolor = FACE_BACKGROUND (Vdefault_face, locale); | |
1334 } | |
1335 | |
1336 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), | |
1337 Qnil, fcolor, bcolor, background_pixmap); | |
1338 FillRect (FRAME_MSWINDOWS_DC(f), &rect, brush); | 1399 FillRect (FRAME_MSWINDOWS_DC(f), &rect, brush); |
1339 } | 1400 } |
1340 else | 1401 else |
1341 { | 1402 { |
1342 assert(0); | 1403 mswindows_output_dibitmap_region |
1404 ( f, XIMAGE_INSTANCE (background_pixmap), | |
1405 x, y, 0, 0, 0, 0, width, height, 0, TRUE); | |
1343 } | 1406 } |
1344 } | 1407 } |
1345 else | 1408 else |
1346 { | 1409 { |
1347 Lisp_Object color = (w ? WINDOW_FACE_CACHEL_BACKGROUND (w, findex) : | 1410 Lisp_Object color = (w ? WINDOW_FACE_CACHEL_BACKGROUND (w, findex) : |
1423 console_type_create_redisplay_mswindows (void) | 1486 console_type_create_redisplay_mswindows (void) |
1424 { | 1487 { |
1425 /* redisplay methods */ | 1488 /* redisplay methods */ |
1426 CONSOLE_HAS_METHOD (mswindows, text_width); | 1489 CONSOLE_HAS_METHOD (mswindows, text_width); |
1427 CONSOLE_HAS_METHOD (mswindows, output_display_block); | 1490 CONSOLE_HAS_METHOD (mswindows, output_display_block); |
1428 CONSOLE_HAS_METHOD (mswindows, divider_width); | |
1429 CONSOLE_HAS_METHOD (mswindows, divider_height); | 1491 CONSOLE_HAS_METHOD (mswindows, divider_height); |
1430 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width); | 1492 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width); |
1431 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider); | 1493 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider); |
1432 CONSOLE_HAS_METHOD (mswindows, clear_to_window_end); | 1494 CONSOLE_HAS_METHOD (mswindows, clear_to_window_end); |
1433 CONSOLE_HAS_METHOD (mswindows, clear_region); | 1495 CONSOLE_HAS_METHOD (mswindows, clear_region); |