comparison src/redisplay-msw.c @ 422:95016f13131a r21-2-19

Import from CVS: tag r21-2-19
author cvs
date Mon, 13 Aug 2007 11:25:01 +0200
parents e804706bfb8c
children 11054d720c21
comparison
equal deleted inserted replaced
421:fff06e11db74 422:95016f13131a
39 #include "debug.h" 39 #include "debug.h"
40 #include "events.h" 40 #include "events.h"
41 #include "faces.h" 41 #include "faces.h"
42 #include "frame.h" 42 #include "frame.h"
43 #include "glyphs-msw.h" 43 #include "glyphs-msw.h"
44 #include "gutter.h"
44 #include "redisplay.h" 45 #include "redisplay.h"
45 #include "sysdep.h" 46 #include "sysdep.h"
46 #include "window.h" 47 #include "window.h"
47 48
48 #include "windows.h" 49 #include "windows.h"
73 Lisp_Object image_instance, int xpos, 74 Lisp_Object image_instance, int xpos,
74 int xoffset, int start_pixpos, int width, 75 int xoffset, int start_pixpos, int width,
75 face_index findex, int cursor_start, 76 face_index findex, int cursor_start,
76 int cursor_width, int cursor_height, 77 int cursor_width, int cursor_height,
77 int offset_bitmap); 78 int offset_bitmap);
79 void bevel_modeline (struct window *w, struct display_line *dl);
78 80
79 typedef struct textual_run 81 typedef struct textual_run
80 { 82 {
81 Lisp_Object charset; 83 Lisp_Object charset;
82 unsigned char *ptr; 84 unsigned char *ptr;
963 /* #### We would rather put these off as well but there is currently 965 /* #### We would rather put these off as well but there is currently
964 no combination of flags which will force an unchanged toolbar to 966 no combination of flags which will force an unchanged toolbar to
965 redraw anyhow. */ 967 redraw anyhow. */
966 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height)); 968 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
967 #endif 969 #endif
970 redraw_exposed_gutters (f, x, y, width, height);
968 971
969 if (!f->window_face_cache_reset) 972 if (!f->window_face_cache_reset)
970 { 973 {
971 mswindows_redraw_exposed_windows (f->root_window, x, y, width, height); 974 mswindows_redraw_exposed_windows (f->root_window, x, y, width, height);
972 GdiFlush(); 975 GdiFlush();
975 MARK_FRAME_CHANGED (f); 978 MARK_FRAME_CHANGED (f);
976 } 979 }
977 980
978 981
979 /***************************************************************************** 982 /*****************************************************************************
980 mswindows_bevel_modeline 983 mswindows_bevel_area
981 984
982 Draw a 3d border around the modeline on window W. 985 Draw a 3d border around the specified area on window W.
983 ****************************************************************************/ 986 ****************************************************************************/
984 static void 987 static void
985 mswindows_bevel_modeline (struct window *w, struct display_line *dl) 988 mswindows_bevel_area (struct window *w, face_index findex, int x, int y,
989 int width, int height, int shadow_thickness)
986 { 990 {
987 struct frame *f = XFRAME (w->frame); 991 struct frame *f = XFRAME (w->frame);
988 Lisp_Object color;
989 int shadow_width = MODELINE_SHADOW_THICKNESS (w);
990 RECT rect = { WINDOW_MODELINE_LEFT (w),
991 dl->ypos - dl->ascent - shadow_width,
992 WINDOW_MODELINE_RIGHT (w),
993 dl->ypos + dl->descent + shadow_width};
994 UINT edge; 992 UINT edge;
995 993
996 color = WINDOW_FACE_CACHEL_BACKGROUND (w, MODELINE_INDEX); 994 if (shadow_thickness < -1)
997 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, color, Qnil);
998
999 if (XINT (w->modeline_shadow_thickness) < 0)
1000 shadow_width = -shadow_width;
1001
1002 if (shadow_width < -1)
1003 edge = EDGE_SUNKEN; 995 edge = EDGE_SUNKEN;
1004 else if (shadow_width < 0) 996 else if (shadow_thickness < 0)
1005 edge = BDR_SUNKENINNER; 997 edge = BDR_SUNKENINNER;
1006 else if (shadow_width == 1) 998 else if (shadow_thickness == 1)
1007 edge = BDR_RAISEDINNER; 999 edge = BDR_RAISEDINNER;
1008 else 1000 else
1009 edge = EDGE_RAISED; 1001 edge = EDGE_RAISED;
1010 1002
1011 DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, edge, BF_RECT); 1003 if (shadow_thickness < 0)
1004 shadow_thickness = -shadow_thickness;
1005
1006 {
1007 RECT rect = { x, y, x + width, y + height };
1008 Lisp_Object color = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
1009 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, color, Qnil);
1010
1011 DrawEdge (FRAME_MSWINDOWS_DC (f), &rect, edge, BF_RECT);
1012 }
1012 } 1013 }
1013 1014
1014 1015
1015 /***************************************************************************** 1016 /*****************************************************************************
1016 Display methods 1017 Display methods
1108 MULE is not defined */ 1109 MULE is not defined */
1109 XSETWINDOW (window, w); 1110 XSETWINDOW (window, w);
1110 rb = Dynarr_atp (rba, start); 1111 rb = Dynarr_atp (rba, start);
1111 1112
1112 if (!rb) 1113 if (!rb)
1113 {
1114 /* Nothing to do so don't do anything. */ 1114 /* Nothing to do so don't do anything. */
1115 return; 1115 return;
1116 } 1116
1117 else 1117 findex = rb->findex;
1118 { 1118 xpos = rb->xpos;
1119 findex = rb->findex; 1119 width = 0;
1120 xpos = rb->xpos; 1120 if (rb->type == RUNE_CHAR)
1121 width = 0; 1121 charset = CHAR_CHARSET (rb->object.chr.ch);
1122 if (rb->type == RUNE_CHAR)
1123 charset = CHAR_CHARSET (rb->object.chr.ch);
1124 }
1125 1122
1126 if (end < 0) 1123 if (end < 0)
1127 end = Dynarr_length (rba); 1124 end = Dynarr_length (rba);
1128 Dynarr_reset (buf); 1125 Dynarr_reset (buf);
1129 1126
1293 if (dl->modeline 1290 if (dl->modeline
1294 && !EQ (Qzero, w->modeline_shadow_thickness) 1291 && !EQ (Qzero, w->modeline_shadow_thickness)
1295 && (f->clear 1292 && (f->clear
1296 || f->windows_structure_changed 1293 || f->windows_structure_changed
1297 || w->shadow_thickness_changed)) 1294 || w->shadow_thickness_changed))
1298 mswindows_bevel_modeline (w, dl); 1295 bevel_modeline (w, dl);
1299 1296
1300 Dynarr_free (buf); 1297 Dynarr_free (buf);
1301 } 1298 }
1302 1299
1303 1300
1314 int spacing = XINT (w->vertical_divider_spacing); 1311 int spacing = XINT (w->vertical_divider_spacing);
1315 int shadow = XINT (w->vertical_divider_shadow_thickness); 1312 int shadow = XINT (w->vertical_divider_shadow_thickness);
1316 int abs_shadow = abs (shadow); 1313 int abs_shadow = abs (shadow);
1317 int line_width = XINT (w->vertical_divider_line_width); 1314 int line_width = XINT (w->vertical_divider_line_width);
1318 int div_left = WINDOW_RIGHT (w) - window_divider_width (w); 1315 int div_left = WINDOW_RIGHT (w) - window_divider_width (w);
1316 int y1 = WINDOW_TOP (w) + FRAME_TOP_GUTTER_BOUNDS (f);
1317 int y2 = WINDOW_BOTTOM (w) + FRAME_BOTTOM_GUTTER_BOUNDS (f);
1319 1318
1320 /* Clear left and right spacing areas */ 1319 /* Clear left and right spacing areas */
1321 if (spacing) 1320 if (spacing)
1322 { 1321 {
1323 rect.top = WINDOW_TOP (w); 1322 rect.top = y1;
1324 rect.bottom = WINDOW_BOTTOM (w); 1323 rect.bottom = y2;
1325 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil, 1324 mswindows_update_dc (FRAME_MSWINDOWS_DC (f), Qnil, Qnil,
1326 WINDOW_FACE_CACHEL_BACKGROUND (w, DEFAULT_INDEX), Qnil); 1325 WINDOW_FACE_CACHEL_BACKGROUND (w, DEFAULT_INDEX), Qnil);
1327 rect.right = WINDOW_RIGHT (w); 1326 rect.right = WINDOW_RIGHT (w);
1328 rect.left = rect.right - spacing; 1327 rect.left = rect.right - spacing;
1329 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, 1328 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE,
1333 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE, 1332 ExtTextOut (FRAME_MSWINDOWS_DC (f), 0, 0, ETO_OPAQUE,
1334 &rect, NULL, 0, NULL); 1333 &rect, NULL, 0, NULL);
1335 } 1334 }
1336 1335
1337 /* Clear divider face */ 1336 /* Clear divider face */
1338 rect.top = WINDOW_TOP (w) + abs_shadow; 1337 rect.top = y1 + abs_shadow;
1339 rect.bottom = WINDOW_BOTTOM (w) - abs_shadow; 1338 rect.bottom = y2 - abs_shadow;
1340 rect.left = div_left + spacing + abs_shadow; 1339 rect.left = div_left + spacing + abs_shadow;
1341 rect.right = rect.left + line_width; 1340 rect.right = rect.left + line_width;
1342 if (rect.left < rect.right) 1341 if (rect.left < rect.right)
1343 { 1342 {
1344 face_index div_face 1343 face_index div_face
1419 if (WINDOWP (locale)) 1418 if (WINDOWP (locale))
1420 mswindows_redisplay_deadbox_maybe (XWINDOW (locale), &rect); 1419 mswindows_redisplay_deadbox_maybe (XWINDOW (locale), &rect);
1421 #endif 1420 #endif
1422 } 1421 }
1423 1422
1424 /*****************************************************************************
1425 mswindows_clear_to_window_end
1426
1427 Clear the area between ypos1 and ypos2. Each margin area and the
1428 text area is handled separately since they may each have their own
1429 background color.
1430 ****************************************************************************/
1431 static void
1432 mswindows_clear_to_window_end (struct window *w, int ypos1, int ypos2)
1433 {
1434 int height = ypos2 - ypos1;
1435
1436 if (height)
1437 {
1438 struct frame *f = XFRAME (w->frame);
1439 Lisp_Object window;
1440 int bflag = (window_needs_vertical_divider (w) ? 0 : 1);
1441 layout_bounds bounds;
1442
1443 bounds = calculate_display_line_boundaries (w, bflag);
1444 XSETWINDOW (window, w);
1445
1446 if (window_is_leftmost (w))
1447 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_LEFT_BORDER_START (f),
1448 ypos1, FRAME_BORDER_WIDTH (f), height);
1449
1450 if (bounds.left_in - bounds.left_out > 0)
1451 redisplay_clear_region (window,
1452 get_builtin_face_cache_index (w, Vleft_margin_face),
1453 bounds.left_out, ypos1,
1454 bounds.left_in - bounds.left_out, height);
1455
1456 if (bounds.right_in - bounds.left_in > 0)
1457 redisplay_clear_region (window, DEFAULT_INDEX, bounds.left_in, ypos1,
1458 bounds.right_in - bounds.left_in, height);
1459
1460 if (bounds.right_out - bounds.right_in > 0)
1461 redisplay_clear_region (window,
1462 get_builtin_face_cache_index (w, Vright_margin_face),
1463 bounds.right_in, ypos1,
1464 bounds.right_out - bounds.right_in, height);
1465
1466 if (window_is_rightmost (w))
1467 redisplay_clear_region (window, DEFAULT_INDEX, FRAME_RIGHT_BORDER_START (f),
1468 ypos1, FRAME_BORDER_WIDTH (f), height);
1469 }
1470
1471 }
1472
1473
1474 /* XXX Implement me! */ 1423 /* XXX Implement me! */
1475 static void 1424 static void
1476 mswindows_clear_frame (struct frame *f) 1425 mswindows_clear_frame (struct frame *f)
1477 { 1426 {
1478 GdiFlush(); 1427 GdiFlush();
1491 CONSOLE_HAS_METHOD (mswindows, text_width); 1440 CONSOLE_HAS_METHOD (mswindows, text_width);
1492 CONSOLE_HAS_METHOD (mswindows, output_display_block); 1441 CONSOLE_HAS_METHOD (mswindows, output_display_block);
1493 CONSOLE_HAS_METHOD (mswindows, divider_height); 1442 CONSOLE_HAS_METHOD (mswindows, divider_height);
1494 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width); 1443 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width);
1495 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider); 1444 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider);
1496 CONSOLE_HAS_METHOD (mswindows, clear_to_window_end);
1497 CONSOLE_HAS_METHOD (mswindows, clear_region); 1445 CONSOLE_HAS_METHOD (mswindows, clear_region);
1498 CONSOLE_HAS_METHOD (mswindows, clear_frame); 1446 CONSOLE_HAS_METHOD (mswindows, clear_frame);
1499 CONSOLE_HAS_METHOD (mswindows, output_begin); 1447 CONSOLE_HAS_METHOD (mswindows, output_begin);
1500 CONSOLE_HAS_METHOD (mswindows, output_end); 1448 CONSOLE_HAS_METHOD (mswindows, output_end);
1501 CONSOLE_HAS_METHOD (mswindows, flash); 1449 CONSOLE_HAS_METHOD (mswindows, flash);
1502 CONSOLE_HAS_METHOD (mswindows, ring_bell); 1450 CONSOLE_HAS_METHOD (mswindows, ring_bell);
1503 } 1451 CONSOLE_HAS_METHOD (mswindows, bevel_area);
1452 }