comparison src/xterm.h @ 1994:73ce9dd21093

Use the term `scroll bar', instead of `scrollbar'. * alloc.c, frame.c, frame.h, indent.c, keyboard.c, keyboard.h, lisp.h, term.c, termhooks.h, window.c, window.h, xdisp.c, xfns.c, xterm.c, xterm.h: Terminology changed.
author Jim Blandy <jimb@redhat.com>
date Tue, 02 Mar 1993 08:22:42 +0000
parents 04fb1d3d6992
children 75e1f1ee83ad
comparison
equal deleted inserted replaced
1993:645d96bd3daf 1994:73ce9dd21093
333 structure around, just leaving values in it and adding new bits 333 structure around, just leaving values in it and adding new bits
334 to the mask as we go. */ 334 to the mask as we go. */
335 XWMHints wm_hints; 335 XWMHints wm_hints;
336 336
337 /* The size of the extra width currently allotted for vertical 337 /* The size of the extra width currently allotted for vertical
338 scrollbars, in pixels. */ 338 scroll bars, in pixels. */
339 int vertical_scrollbar_extra; 339 int vertical_scroll_bar_extra;
340 }; 340 };
341 341
342 /* Return the window associated with the frame F. */ 342 /* Return the window associated with the frame F. */
343 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc) 343 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
344 344
375 375
376 #define MAX_FACES_AND_GLYPHS 256 376 #define MAX_FACES_AND_GLYPHS 256
377 extern struct face *x_face_table[]; 377 extern struct face *x_face_table[];
378 378
379 379
380 /* X-specific scrollbar stuff. */ 380 /* X-specific scroll bar stuff. */
381 381
382 /* We represent scrollbars as lisp vectors. This allows us to place 382 /* We represent scroll bars as lisp vectors. This allows us to place
383 references to them in windows without worrying about whether we'll 383 references to them in windows without worrying about whether we'll
384 end up with windows referring to dead scrollbars; the garbage 384 end up with windows referring to dead scroll bars; the garbage
385 collector will free it when its time comes. 385 collector will free it when its time comes.
386 386
387 We use struct scrollbar as a template for accessing fields of the 387 We use struct scroll_bar as a template for accessing fields of the
388 vector. */ 388 vector. */
389 389
390 struct scrollbar { 390 struct scroll_bar {
391 391
392 /* These fields are shared by all vectors. */ 392 /* These fields are shared by all vectors. */
393 int size_from_Lisp_Vector_struct; 393 int size_from_Lisp_Vector_struct;
394 struct Lisp_Vector *next_from_Lisp_Vector_struct; 394 struct Lisp_Vector *next_from_Lisp_Vector_struct;
395 395
396 /* The window we're a scrollbar for. */ 396 /* The window we're a scroll bar for. */
397 Lisp_Object window; 397 Lisp_Object window;
398 398
399 /* The next and previous in the chain of scrollbars in this frame. */ 399 /* The next and previous in the chain of scroll bars in this frame. */
400 Lisp_Object next, prev; 400 Lisp_Object next, prev;
401 401
402 /* The X window representing this scrollbar. Since this is a full 402 /* The X window representing this scroll bar. Since this is a full
403 32-bit quantity, we store it split into two 32-bit values. */ 403 32-bit quantity, we store it split into two 32-bit values. */
404 Lisp_Object x_window_low, x_window_high; 404 Lisp_Object x_window_low, x_window_high;
405 405
406 /* The position and size of the scrollbar in pixels, relative to the 406 /* The position and size of the scroll bar in pixels, relative to the
407 frame. */ 407 frame. */
408 Lisp_Object top, left, width, height; 408 Lisp_Object top, left, width, height;
409 409
410 /* The starting and ending positions of the handle, relative to the 410 /* The starting and ending positions of the handle, relative to the
411 handle area (i.e. zero is the top position, not 411 handle area (i.e. zero is the top position, not
412 SCROLLBAR_TOP_BORDER). If they're equal, that means the handle 412 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
413 hasn't been drawn yet. 413 hasn't been drawn yet.
414 414
415 These are not actually the locations where the beginning and end 415 These are not actually the locations where the beginning and end
416 are drawn; in order to keep handles from becoming invisible when 416 are drawn; in order to keep handles from becoming invisible when
417 editing large files, we establish a minimum height by always 417 editing large files, we establish a minimum height by always
418 drawing handle bottoms VERTICAL_SCROLLBAR_MIN_HANDLE pixels below 418 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
419 where they would be normally; the bottom and top are in a 419 where they would be normally; the bottom and top are in a
420 different co-ordinate system. */ 420 different co-ordinate system. */
421 Lisp_Object start, end; 421 Lisp_Object start, end;
422 422
423 /* If the scrollbar handle is currently being dragged by the user, 423 /* If the scroll bar handle is currently being dragged by the user,
424 this is the number of pixels from the top of the handle to the 424 this is the number of pixels from the top of the handle to the
425 place where the user grabbed it. If the handle isn't currently 425 place where the user grabbed it. If the handle isn't currently
426 being dragged, this is Qnil. */ 426 being dragged, this is Qnil. */
427 Lisp_Object dragging; 427 Lisp_Object dragging;
428 }; 428 };
429 429
430 /* The number of elements a vector holding a struct scrollbar needs. */ 430 /* The number of elements a vector holding a struct scroll_bar needs. */
431 #define SCROLLBAR_VEC_SIZE \ 431 #define SCROLL_BAR_VEC_SIZE \
432 ((sizeof (struct scrollbar) - sizeof (int) - sizeof (struct Lisp_Vector *)) \ 432 ((sizeof (struct scroll_bar) - sizeof (int) - sizeof (struct Lisp_Vector *)) \
433 / sizeof (Lisp_Object)) 433 / sizeof (Lisp_Object))
434 434
435 /* Turning a lisp vector value into a pointer to a struct scrollbar. */ 435 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
436 #define XSCROLLBAR(vec) ((struct scrollbar *) XPNTR (vec)) 436 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XPNTR (vec))
437 437
438 438
439 /* Building a 32-bit C integer from two 16-bit lisp integers. */ 439 /* Building a 32-bit C integer from two 16-bit lisp integers. */
440 #define SCROLLBAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) 440 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
441 441
442 /* Setting two lisp integers to the low and high words of a 32-bit C int. */ 442 /* Setting two lisp integers to the low and high words of a 32-bit C int. */
443 #define SCROLLBAR_UNPACK(low, high, int32) \ 443 #define SCROLL_BAR_UNPACK(low, high, int32) \
444 (XSET ((low), Lisp_Int, (int32) & 0xffff), \ 444 (XSET ((low), Lisp_Int, (int32) & 0xffff), \
445 XSET ((high), Lisp_Int, ((int32) >> 16) & 0xffff)) 445 XSET ((high), Lisp_Int, ((int32) >> 16) & 0xffff))
446 446
447 447
448 /* Extract the X window id of the scrollbar from a struct scrollbar. */ 448 /* Extract the X window id of the scroll bar from a struct scroll_bar. */
449 #define SCROLLBAR_X_WINDOW(ptr) \ 449 #define SCROLL_BAR_X_WINDOW(ptr) \
450 ((Window) SCROLLBAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high)) 450 ((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high))
451 451
452 /* Store a window id in a struct scrollbar. */ 452 /* Store a window id in a struct scroll_bar. */
453 #define SET_SCROLLBAR_X_WINDOW(ptr, id) \ 453 #define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
454 (SCROLLBAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id)) 454 (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
455 455
456 456
457 /* Return the outside pixel width for a vertical scrollbar on frame F. */ 457 /* Return the outside pixel width for a vertical scroll bar on frame F. */
458 #define VERTICAL_SCROLLBAR_PIXEL_WIDTH(f) (2*FONT_WIDTH ((f)->display.x->font)) 458 #define VERTICAL_SCROLL_BAR_PIXEL_WIDTH(f) (2*FONT_WIDTH ((f)->display.x->font))
459 459
460 /* Return the outside pixel height for a vertical scrollbar HEIGHT 460 /* Return the outside pixel height for a vertical scroll bar HEIGHT
461 rows high on frame F. */ 461 rows high on frame F. */
462 #define VERTICAL_SCROLLBAR_PIXEL_HEIGHT(f, height) \ 462 #define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \
463 ((height) * FONT_HEIGHT ((f)->display.x->font)) 463 ((height) * FONT_HEIGHT ((f)->display.x->font))
464 464
465 /* Return the inside width of a vertical scrollbar, given the outside 465 /* Return the inside width of a vertical scroll bar, given the outside
466 width. */ 466 width. */
467 #define VERTICAL_SCROLLBAR_INSIDE_WIDTH(width) \ 467 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(width) \
468 ((width) - VERTICAL_SCROLLBAR_LEFT_BORDER - VERTICAL_SCROLLBAR_RIGHT_BORDER) 468 ((width) - VERTICAL_SCROLL_BAR_LEFT_BORDER - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
469 469
470 /* Return the length of the rectangle within which the top of the 470 /* Return the length of the rectangle within which the top of the
471 handle must stay. This isn't equivalent to the inside height, 471 handle must stay. This isn't equivalent to the inside height,
472 because the scrollbar handle has a minimum height. 472 because the scroll bar handle has a minimum height.
473 473
474 This is the real range of motion for the scrollbar, so when we're 474 This is the real range of motion for the scroll bar, so when we're
475 scaling buffer positions to scrollbar positions, we use this, not 475 scaling buffer positions to scroll bar positions, we use this, not
476 VERTICAL_SCROLLBAR_INSIDE_HEIGHT. */ 476 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
477 #define VERTICAL_SCROLLBAR_TOP_RANGE(height) \ 477 #define VERTICAL_SCROLL_BAR_TOP_RANGE(height) \
478 (VERTICAL_SCROLLBAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLLBAR_MIN_HANDLE) 478 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
479 479
480 /* Return the inside height of vertical scrollbar, given the outside 480 /* Return the inside height of vertical scroll bar, given the outside
481 height. See VERTICAL_SCROLLBAR_TOP_RANGE too. */ 481 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
482 #define VERTICAL_SCROLLBAR_INSIDE_HEIGHT(height) \ 482 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(height) \
483 ((height) - VERTICAL_SCROLLBAR_TOP_BORDER - VERTICAL_SCROLLBAR_BOTTOM_BORDER) 483 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
484 484
485 485
486 /* Border widths for scrollbars. 486 /* Border widths for scroll bars.
487 487
488 Scrollbar windows don't have any X borders; their border width is 488 Scroll bar windows don't have any X borders; their border width is
489 set to zero, and we redraw borders ourselves. This makes the code 489 set to zero, and we redraw borders ourselves. This makes the code
490 a bit cleaner, since we don't have to convert between outside width 490 a bit cleaner, since we don't have to convert between outside width
491 (used when relating to the rest of the screen) and inside width 491 (used when relating to the rest of the screen) and inside width
492 (used when sizing and drawing the scrollbar window itself). 492 (used when sizing and drawing the scroll bar window itself).
493 493
494 The handle moves up and down/back and forth in a rectange inset 494 The handle moves up and down/back and forth in a rectange inset
495 from the edges of the scrollbar. These are widths by which we 495 from the edges of the scroll bar. These are widths by which we
496 inset the handle boundaries from the scrollbar edges. */ 496 inset the handle boundaries from the scroll bar edges. */
497 #define VERTICAL_SCROLLBAR_LEFT_BORDER (2) 497 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
498 #define VERTICAL_SCROLLBAR_RIGHT_BORDER (3) 498 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (3)
499 #define VERTICAL_SCROLLBAR_TOP_BORDER (2) 499 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
500 #define VERTICAL_SCROLLBAR_BOTTOM_BORDER (2) 500 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
501 501
502 /* Minimum lengths for scrollbar handles, in pixels. */ 502 /* Minimum lengths for scroll bar handles, in pixels. */
503 #define VERTICAL_SCROLLBAR_MIN_HANDLE (5) 503 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
504 504
505 505
506 /* Manipulating pixel sizes and character sizes. 506 /* Manipulating pixel sizes and character sizes.
507 Knowledge of which factors affect the overall size of the window should 507 Knowledge of which factors affect the overall size of the window should
508 be hidden in these macros, if that's possible. 508 be hidden in these macros, if that's possible.
518 518
519 /* Return the pixel width/height of frame F if it has 519 /* Return the pixel width/height of frame F if it has
520 WIDTH columns/HEIGHT rows. */ 520 WIDTH columns/HEIGHT rows. */
521 #define CHAR_TO_PIXEL_WIDTH(f, width) \ 521 #define CHAR_TO_PIXEL_WIDTH(f, width) \
522 (CHAR_TO_PIXEL_COL (f, width) \ 522 (CHAR_TO_PIXEL_COL (f, width) \
523 + (f)->display.x->vertical_scrollbar_extra \ 523 + (f)->display.x->vertical_scroll_bar_extra \
524 + (f)->display.x->internal_border_width) 524 + (f)->display.x->internal_border_width)
525 #define CHAR_TO_PIXEL_HEIGHT(f, height) \ 525 #define CHAR_TO_PIXEL_HEIGHT(f, height) \
526 (CHAR_TO_PIXEL_ROW (f, height) \ 526 (CHAR_TO_PIXEL_ROW (f, height) \
527 + (f)->display.x->internal_border_width) 527 + (f)->display.x->internal_border_width)
528 528
539 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on 539 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
540 frame F? */ 540 frame F? */
541 #define PIXEL_TO_CHAR_WIDTH(f, width) \ 541 #define PIXEL_TO_CHAR_WIDTH(f, width) \
542 (PIXEL_TO_CHAR_COL (f, ((width) \ 542 (PIXEL_TO_CHAR_COL (f, ((width) \
543 - (f)->display.x->internal_border_width \ 543 - (f)->display.x->internal_border_width \
544 - (f)->display.x->vertical_scrollbar_extra))) 544 - (f)->display.x->vertical_scroll_bar_extra)))
545 #define PIXEL_TO_CHAR_HEIGHT(f, height) \ 545 #define PIXEL_TO_CHAR_HEIGHT(f, height) \
546 (PIXEL_TO_CHAR_ROW (f, ((height) \ 546 (PIXEL_TO_CHAR_ROW (f, ((height) \
547 - (f)->display.x->internal_border_width))) 547 - (f)->display.x->internal_border_width)))