view oldXMenu/AddSel.c @ 53608:81b31a8c3313

(Voverflow_newline_into_fringe): New variable. (IT_OVERFLOW_NEWLINE_INTO_FRINGE): New macro. (move_it_in_display_line_to): Overflow newline into fringe for rows that are exactly as wide as the window. (up_arrow_bits, down_arrow_bits, first_line_bits, last_line_bits) (filled_box_cursor_bits, hollow_box_cursor_bits, bar_cursor_bits) (hbar_cursor_bits, hollow_square_bits): New fringe bitmaps. (fringe_bitmaps): Add new bitmaps. (draw_fringe_bitmap): Make extern. Remove WHICH arg. Select proper bitmap for cursor in fringe when appropriate. Handle alignment of bitmap to top or bottom of row. (draw_row_fringe_bitmaps): Don't select bitmaps here; that is now done by update_window_fringes. (update_window_fringes, draw_window_fringes): New functions. (redisplay_internal): Call update_window_fringes in case only cursor row is updated. (redisplay_window): Call update_window_fringes. Explicitly call draw_window_fringes if redisplay was done using the current matrix or the overlay arrow is in the window. (try_window_reusing_current_matrix): Mark scrolled rows for fringe update (to update buffer-boundaries / scrolling icons). (find_last_unchanged_at_beg_row): Handle exact width lines line continued lines. (display_line): Overflow newline into fringe for rows that are exactly as wide as the window. Don't append space for newline in this case. (notice_overwritten_cursor): Explicitly clear cursor bitmap in fringe as if it had been overwritten. (erase_phys_cursor): Erase cursor bitmap in fringe. (syms_of_xdisp): Mark show-trailing-whitespace and void-text-area-pointer as user options. DEFVAR_LISP Voverflow_newline_into_fringe. Enable by default.
author Kim F. Storm <storm@cua.dk>
date Fri, 16 Jan 2004 18:47:20 +0000
parents 695cf19ef79e
children f0eb34e60705 e8824c4f5f7e 375f2633d815
line wrap: on
line source

#include "copyright.h"

/* $Header: /cvsroot/emacs/emacs/oldXMenu/AddSel.c,v 1.3 2003/02/04 14:19:01 lektu Exp $ */
/* Copyright    Massachusetts Institute of Technology    1985	*/

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 * 	XMenuAddSelection - Adds a selection to an XMenu object.
 *
 *	Author:		Tony Della Fera, DEC
 *			August, 1985
 *
 */

#include <config.h>
#include "XMenuInt.h"

int
XMenuAddSelection(display, menu, p_num, data, label, active, help)
    Display *display;
    register XMenu *menu;	/* Menu object to be modified. */
    register int p_num;		/* Pane number to be modified. */
    char *data;			/* Data value. */
    char *label;		/* Selection label. */
    int active;			/* Make selection active? */
    char *help;			/* Help string */
{
    register XMPane *pane;	/* Pane containing the new selection. */
    register XMSelect *select;	/* Newly created selection. */


    int label_length;		/* Label lenght in characters. */
    int label_width;		/* Label width in pixels. */

    /*
     * Check for NULL pointers!
     */
    if (label == NULL) {
	_XMErrorCode = XME_ARG_BOUNDS;
	return(XM_FAILURE);
    }
    /*
     * Find the right pane.
     */
    pane = _XMGetPanePtr(menu, p_num);
    if (pane == NULL) return(XM_FAILURE);

    /*
     * Calloc the XMSelect structure.
     */
    select = (XMSelect *)calloc(1, sizeof(XMSelect));
    if (select == NULL) {
	_XMErrorCode = XME_CALLOC;
	return(XM_FAILURE);
    }
    /*
     * Determine label size.
     */
    label_length = strlen(label);
    label_width = XTextWidth(menu->s_fnt_info, label, label_length);

    /*
     * Fill the XMSelect structure.
     */
    if (!strcmp (label, "--") || !strcmp (label, "---"))
      {
	select->type = SEPARATOR;
	select->active = 0;
      }
    else
      {
	select->type = SELECTION;
	select->active = active;
      }

    select->serial = -1;
    select->label = label;
    select->label_width = label_width;
    select->label_length = label_length;
    select->data = data;
    select->parent_p = pane;
    select->help_string = help;

    /*
     * Insert the selection at the end of the selection list.
     */
    emacs_insque(select, pane->s_list->prev);

    /*
     * Update the selection count.
     */
    pane->s_count++;

    /*
     * Schedule a recompute.
     */
    menu->recompute = 1;

    /*
     * Return the selection number just added.
     */
    _XMErrorCode = XME_NO_ERROR;
    return((pane->s_count - 1));
}

/* arch-tag: 0161f024-c739-440d-9498-050280c6c355
   (do not change this comment) */