comparison src/window.c @ 276:6330739388db r21-0b36

Import from CVS: tag r21-0b36
author cvs
date Mon, 13 Aug 2007 10:30:37 +0200
parents ca9a9ec9c1c1
children 7df0dd720c89
comparison
equal deleted inserted replaced
275:a68ae4439f57 276:6330739388db
62 static int window_char_height_to_pixel_height (struct window *w, 62 static int window_char_height_to_pixel_height (struct window *w,
63 int char_height, 63 int char_height,
64 int include_gutters_p); 64 int include_gutters_p);
65 static void change_window_height (struct window *w, int delta, int widthflag, 65 static void change_window_height (struct window *w, int delta, int widthflag,
66 int inpixels); 66 int inpixels);
67 static int window_displayed_pixel_height (struct window *);
68 67
69 /* Thickness of shadow border around 3d modelines. */ 68 /* Thickness of shadow border around 3d modelines. */
70 Lisp_Object Vmodeline_shadow_thickness; 69 Lisp_Object Vmodeline_shadow_thickness;
71 70
72 /* Whether a modeline should be displayed. */ 71 /* Whether a modeline should be displayed. */
1314 (window)) 1313 (window))
1315 { 1314 {
1316 return make_int (decode_window (window)->pixel_height); 1315 return make_int (decode_window (window)->pixel_height);
1317 } 1316 }
1318 1317
1319 DEFUN ("window-displayed-pixel-height", Fwindow_displayed_pixel_height, 0, 1, 0, /* 1318 DEFUN ("window-text-pixel-height", Fwindow_text_pixel_height, 0, 1, 0, /*
1320 Return the height in pixels of the buffer-displaying portion of WINDOW. 1319 Return the height in pixels of the text-displaying portion of WINDOW.
1321 Unlike `window-pixel-height', the space occupied by the gutters 1320 Unlike `window-pixel-height', the space occupied by the modeline and
1322 \(modeline, horizontal scrollbar, ...) is not counted. 1321 horizontal scrollbar, if any, is not counted.
1323 */ 1322 */
1324 (window)) 1323 (window))
1325 { 1324 {
1326 return make_int (window_displayed_pixel_height (decode_window (window))); 1325 struct window *w = decode_window (window);
1326
1327 return make_int (WINDOW_TEXT_HEIGHT (w));
1327 } 1328 }
1328 1329
1329 DEFUN ("window-width", Fwindow_width, 0, 1, 0, /* 1330 DEFUN ("window-width", Fwindow_width, 0, 1, 0, /*
1330 Return the number of display columns in WINDOW. 1331 Return the number of display columns in WINDOW.
1331 This is the width that is usable columns available for text in WINDOW. 1332 This is the width that is usable columns available for text in WINDOW.
1339 Return the width of WINDOW in pixels. Defaults to current window. 1340 Return the width of WINDOW in pixels. Defaults to current window.
1340 */ 1341 */
1341 (window)) 1342 (window))
1342 { 1343 {
1343 return make_int (decode_window (window)->pixel_width); 1344 return make_int (decode_window (window)->pixel_width);
1345 }
1346
1347 DEFUN ("window-text-pixel-width", Fwindow_text_pixel_width, 0, 1, 0, /*
1348 Return the width in pixels of the text-displaying portion of WINDOW.
1349 Unlike `window-pixel-width', the space occupied by the vertical
1350 scrollbar or divider, if any, is not counted.
1351 */
1352 (window))
1353 {
1354 struct window *w = decode_window (window);
1355
1356 return make_int (WINDOW_TEXT_WIDTH (w));
1344 } 1357 }
1345 1358
1346 DEFUN ("window-hscroll", Fwindow_hscroll, 0, 1, 0, /* 1359 DEFUN ("window-hscroll", Fwindow_hscroll, 0, 1, 0, /*
1347 Return the number of columns by which WINDOW is scrolled from left margin. 1360 Return the number of columns by which WINDOW is scrolled from left margin.
1348 */ 1361 */
1406 MARK_CLIP_CHANGED; /* FSF marks differently but we aren't FSF. */ 1419 MARK_CLIP_CHANGED; /* FSF marks differently but we aren't FSF. */
1407 w->hscroll = ncols; 1420 w->hscroll = ncols;
1408 return ncol; 1421 return ncol;
1409 } 1422 }
1410 1423
1411 #if 0 /* bogus crock */ 1424 #if 0 /* bogus FSF crock */
1412 1425
1413 xxDEFUN ("window-redisplay-end-trigger", 1426 xxDEFUN ("window-redisplay-end-trigger",
1414 Fwindow_redisplay_end_trigger, 0, 1, 0, /* 1427 Fwindow_redisplay_end_trigger, 0, 1, 0, /*
1415 Return WINDOW's redisplay end trigger value. 1428 Return WINDOW's redisplay end trigger value.
1416 See `set-window-redisplay-end-trigger' for more information. 1429 See `set-window-redisplay-end-trigger' for more information.
1451 1464
1452 return list4 (make_int (left), 1465 return list4 (make_int (left),
1453 make_int (top), 1466 make_int (top),
1454 make_int (left + w->pixel_width), 1467 make_int (left + w->pixel_width),
1455 make_int (top + w->pixel_height)); 1468 make_int (top + w->pixel_height));
1469 }
1470
1471 DEFUN ("window-text-pixel-edges", Fwindow_text_pixel_edges, 0, 1, 0, /*
1472 Return a list of the pixel edge coordinates of the text area of WINDOW.
1473 Returns the list \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at the
1474 top left corner of the window.
1475 */
1476 (window))
1477 {
1478 struct window *w = decode_window (window);
1479
1480 int left = window_left_gutter_width (w, /* modeline = */ 0);
1481 int top = window_top_gutter_height (w);
1482 int right = WINDOW_WIDTH (w) - window_right_gutter_width (w, 0);
1483 int bottom = WINDOW_HEIGHT (w) - window_bottom_gutter_height (w);
1484
1485 return list4 (make_int (left),
1486 make_int (top),
1487 make_int (right),
1488 make_int (bottom));
1456 } 1489 }
1457 1490
1458 DEFUN ("window-point", Fwindow_point, 0, 1, 0, /* 1491 DEFUN ("window-point", Fwindow_point, 0, 1, 0, /*
1459 Return current value of point in WINDOW. 1492 Return current value of point in WINDOW.
1460 For a nonselected window, this is the value point would have 1493 For a nonselected window, this is the value point would have
3579 && Dynarr_atp (dla, Dynarr_length (dla) - 1)->clip) 3612 && Dynarr_atp (dla, Dynarr_length (dla) - 1)->clip)
3580 num_lines--; 3613 num_lines--;
3581 } 3614 }
3582 3615
3583 return num_lines; 3616 return num_lines;
3584 }
3585
3586 /*
3587 * Return height in pixels of buffer-displaying portion of window w.
3588 * Does not include the gutters (modeline, scrollbars, ...)
3589 */
3590 int
3591 window_displayed_pixel_height (struct window *w)
3592 {
3593 return (WINDOW_HEIGHT (w)
3594 - window_top_gutter_height (w)
3595 - window_bottom_gutter_height (w));
3596 } 3617 }
3597 3618
3598 static int 3619 static int
3599 window_pixel_width (Lisp_Object window) 3620 window_pixel_width (Lisp_Object window)
3600 { 3621 {
5495 DEFSUBR (Fpos_visible_in_window_p); 5516 DEFSUBR (Fpos_visible_in_window_p);
5496 DEFSUBR (Fwindow_buffer); 5517 DEFSUBR (Fwindow_buffer);
5497 DEFSUBR (Fwindow_frame); 5518 DEFSUBR (Fwindow_frame);
5498 DEFSUBR (Fwindow_height); 5519 DEFSUBR (Fwindow_height);
5499 DEFSUBR (Fwindow_displayed_height); 5520 DEFSUBR (Fwindow_displayed_height);
5500 DEFSUBR (Fwindow_displayed_pixel_height);
5501 DEFSUBR (Fwindow_width); 5521 DEFSUBR (Fwindow_width);
5502 DEFSUBR (Fwindow_pixel_height); 5522 DEFSUBR (Fwindow_pixel_height);
5503 DEFSUBR (Fwindow_pixel_width); 5523 DEFSUBR (Fwindow_pixel_width);
5524 DEFSUBR (Fwindow_text_pixel_height);
5525 DEFSUBR (Fwindow_text_pixel_width);
5504 DEFSUBR (Fwindow_hscroll); 5526 DEFSUBR (Fwindow_hscroll);
5505 #ifdef MODELINE_IS_SCROLLABLE 5527 #ifdef MODELINE_IS_SCROLLABLE
5506 DEFSUBR (Fmodeline_hscroll); 5528 DEFSUBR (Fmodeline_hscroll);
5507 DEFSUBR (Fset_modeline_hscroll); 5529 DEFSUBR (Fset_modeline_hscroll);
5508 #endif /* MODELINE_IS_SCROLLABLE */ 5530 #endif /* MODELINE_IS_SCROLLABLE */
5509 #if 0 /* bogus crock */ 5531 #if 0 /* bogus FSF crock */
5510 DEFSUBR (Fwindow_redisplay_end_trigger); 5532 DEFSUBR (Fwindow_redisplay_end_trigger);
5511 DEFSUBR (Fset_window_redisplay_end_trigger); 5533 DEFSUBR (Fset_window_redisplay_end_trigger);
5512 #endif 5534 #endif
5513 DEFSUBR (Fset_window_hscroll); 5535 DEFSUBR (Fset_window_hscroll);
5514 DEFSUBR (Fwindow_pixel_edges); 5536 DEFSUBR (Fwindow_pixel_edges);
5537 DEFSUBR (Fwindow_text_pixel_edges);
5515 DEFSUBR (Fwindow_point); 5538 DEFSUBR (Fwindow_point);
5516 DEFSUBR (Fwindow_start); 5539 DEFSUBR (Fwindow_start);
5517 DEFSUBR (Fwindow_end); 5540 DEFSUBR (Fwindow_end);
5518 DEFSUBR (Fset_window_point); 5541 DEFSUBR (Fset_window_point);
5519 DEFSUBR (Fset_window_start); 5542 DEFSUBR (Fset_window_start);