view oldXMenu/ChgSel.c @ 44830:ce8cb080a127

(ibuffer-filter-group-name-face): New. (ibuffer-mode-map): Bind and add menu entries for most new functions; also, bind the arrow keys to the movement functions. (ibuffer-mode-filter-group-map): New. (ibuffer-mouse-toggle-mark): Handle group names. (ibuffer-mouse-visit-buffer): Error if the current buffer is killed. (ibuffer-skip-properties): New function. (ibuffer-backward-line, ibuffer-forward-line): Optionally skip group names. Also, handle new properties. (ibuffer-visit-buffer, ibuffer-visit-buffer-other-window): Move error handling to `ibuffer-current-buffer'. (ibuffer-visit-buffer-other-frame, ibuffer-bury-buffer): Ditto. (ibuffer-visit-tags-table, ibuffer-do-view-1): Ditto. (ibuffer-toggle-marks): Add optional group argument. (ibuffer-mark-interactive): Skip group names. (ibuffer-current-buffer): Clean up error handling. (ibuffer-fontify-region-function): Fontify group names. (ibuffer-map-lines): Add extra group argument. Handle it. (ibuffer-current-filter-groups): New function. (ibuffer-redisplay): Handle hidden filtering groups. (ibuffer-sort-bufferlist): New function, taken from `ibuffer-insert-buffers-and-marks'. (ibuffer-insert-filter-group): New function. (ibuffer-redisplay-engine): Renamed from `ibuffer-insert-buffers-and-marks'. Handle new filtering groups. (ibuffer): Add filter-groups argument. Handle it. Use `save-selected-window'. (ibuffer-mode): Make `ibuffer-filtering-groups' and `ibuffer-hidden-filtering-groups' buffer-local.
author Colin Walters <walters@gnu.org>
date Wed, 24 Apr 2002 23:27:28 +0000
parents bbce331da1be
children 23a1cea22d13
line wrap: on
line source

#include "copyright.h"

/* $Header: /u/src/emacs/19.0/oldXMenu/RCS/ChgSel.c,v 1.1 1992/04/11 22:10:17 jimb Exp $ */
/* Copyright    Massachusetts Institute of Technology    1985	*/

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 *	XMenuChangeSelection - Change a menu selection.
 *
 *	Author:		Tony Della Fera, DEC
 *			December 19, 1985
 *
 */

#include "XMenuInt.h"

int
XMenuChangeSelection(display, menu, p_num, s_num, data, data_sw, label, label_sw)
    Display *display;		/* previously opened display. */
    register XMenu *menu;	/* Menu object to be modified. */
    register int p_num;		/* Pane number to be modified. */
    register int s_num;		/* Selection number to modified. */
    char *data;			/* Data value. */
    int data_sw;		/* Change to new data value? */
    char *label;		/* Selection label. */
    int label_sw;		/* Change to new label? */
{
    register XMPane *p_ptr;	/* XMPane pointer. */
    register XMSelect *s_ptr;	/* XMSelect pointer. */
    
    int label_length;		/* Label length 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.
     */
    p_ptr = _XMGetPanePtr(menu, p_num);
    if (p_ptr == NULL) return(XM_FAILURE);

    /*
     * Find the right selection.
     */
    s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
    if (s_ptr == NULL) return(XM_FAILURE);

    /*
     * Reset the label?
     */
    if (label_sw) {
	/*
	 * Determine label size.
	 */
	label_length = strlen(label);
	label_width = XTextWidth(menu->s_fnt_info, label, label_length);

	/*
	 * Change the selection data.
	 */
	s_ptr->label = label;
	s_ptr->label_width = label_width;
	s_ptr->label_length = label_length;

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

    /*
     * Reset the data?
     */
    if (data_sw) s_ptr->data = data;

    /*
     * Return successfully.
     */
    _XMErrorCode = XME_NO_ERROR;
    return(s_num);
}