view oldXMenu/InsPane.c @ 62943:11d53dd5abd9

Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345 Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 77-78) - Update from CVS 2005-05-31 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (article-display-x-face): Replace process-kill-without-query by gnus-set-process-query-on-exit-flag. * lisp/gnus/gnus-group.el: Bind gnus-cache-active-hashtb when compiling. * lisp/gnus/gnus-util.el (gnus-set-process-query-on-exit-flag): Alias to set-process-query-on-exit-flag or process-kill-without-query. * lisp/gnus/html2text.el (html2text-fix-paragraphs): Use `while - re-search' loop instead of replace-regexp. * lisp/gnus/imap.el (imap-ssl-open): Use set-process-query-on-exit-flag instead of process-kill-without-query if it is available. * lisp/gnus/mm-util.el (mm-insert-file-contents): Bind find-file-hook instead of find-file-hooks if it is available. * lisp/gnus/mml1991.el: Bind pgg-default-user-id when compiling. * lisp/gnus/mml2015.el: Bind pgg-default-user-id when compiling. * lisp/gnus/nndraft.el (nndraft-request-associate-buffer): Use write-contents-functions instead of write-contents-hooks if it is available. * lisp/gnus/nnheader.el (nnheader-find-file-noselect): Bind find-file-hook instead of find-file-hooks if it is available. * lisp/gnus/nntp.el (nntp-open-connection): Replace process-kill-without-query by gnus-set-process-query-on-exit-flag. (nntp-open-ssl-stream): Ditto. (nntp-open-tls-stream): Ditto. * lisp/gnus/pgg.el: Don't bind itimer vars; don't autoload itimer functions. (pgg-run-at-time-1): New macro. (pgg-run-at-time): Use it. * lisp/gnus/starttls.el (starttls-set-process-query-on-exit-flag): Alias to set-process-query-on-exit-flag or process-kill-without-query. (starttls-open-stream-gnutls): Use it instead of process-kill-without-query. (starttls-open-stream): Ditto. 2005-05-31 Simon Josefsson <jas@extundo.com> * lisp/gnus/imap.el (imap-ssl-open): Use imap-process-connection-type, instead of hard coding to nil. 2005-05-31 Kevin Greiner <kgreiner@xpediantsolutions.com> * lisp/gnus/gnus-group.el (): Require gnus-sum and autoload functions to resolve warnings when gnus-group.el compiled alone.
author Miles Bader <miles@gnu.org>
date Wed, 01 Jun 2005 05:07:06 +0000
parents e8824c4f5f7e
children 3861ff8f4bf1 8e5779acd195
line wrap: on
line source

#include "copyright.h"

/* Copyright    Massachusetts Institute of Technology    1985	*/

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 * 	XMenuInsertPane - Inserts a pane into an XMenu object in
 *			  a particular position.
 *
 *	Author:		Tony Della Fera, DEC
 *			20-Nov-85
 *
 */

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

int
XMenuInsertPane(menu, p_num, label, active)
    register XMenu *menu;	/* Menu object to be modified. */
    register int p_num;		/* Pane number of new pane. */
    char *label;		/* Selection label. */
    int active;			/* Make selection active? */
{
    register XMPane *p_ptr;	/* XMPane pointer. */
    register XMPane *pane;	/* Newly created pane. */
    register XMSelect *select;	/* Initial selection for the new pane. */

    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 pane number one less than the one specified since that
     * is the pane after which the insertion will occur.
     */
    p_ptr = _XMGetPanePtr(menu, (p_num - 1));
    if (p_ptr == NULL) return(XM_FAILURE);

    /*
     * Calloc the XMPane structure and the initial XMSelect.
     */
    pane = (XMPane *)calloc(1, sizeof(XMPane));
    if (pane == NULL) {
	_XMErrorCode = XME_CALLOC;
	return(XM_FAILURE);
    }
    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->p_fnt_info, label, label_length);

    /*
     * Set up the initial selection.
     * Values not explicitly set are zeroed by calloc.
     */
    select->next = select;
    select->prev = select;
    select->type = SL_HEADER;
    select->serial = -1;
    select->parent_p = pane;

    /*
     * Fill the XMPane structure.
     */
    pane->type = PANE;
    pane->active = active;
    pane->serial = -1;
    pane->label = label;
    pane->label_width = label_width;
    pane->label_length = label_length;
    pane->s_list = select;

    /*
     * Insert the pane after the pane with the pane
     * number one less than the desired number for the
     * new pane.
     */
    emacs_insque(pane, p_ptr);

    /*
     * Update the pane count.
     */
    menu->p_count++;

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

    /*
     * Return the number of the pane just added.
     */
    _XMErrorCode = XME_NO_ERROR;
    return(p_num);
}

/* arch-tag: ab94d53d-f05b-4273-82d3-f1b01eb9dc9e
   (do not change this comment) */