view oldXMenu/AddPane.c @ 27701:5e135f0faf1d

(bibtex-mode): Replaced manual splitting of path at ':' characters by call to split-string. Added RCS version identification. Some temporary comments removed. (bibtex-field-name, bibtex-entry-type): Made the relationship explicit. (bibtex-field-const): Allow capital letters. (bibtex-start-of-string): Deleted because unused. Unified some nomenclature. We no longer use the term 'reference' to describe a bibtex entry as a whole. Further, reference keys are no longer called 'labels'. (bibtex-keys): Renamed to bibtex-reference-keys. (bibtex-reformat-previous-labels): Renamed to bibtex-reformat-previous-reference-keys. (bibtex-reference-type): Renamed to bibtex-entry-type. (bibtex-reference-head): Renamed to bibtex-entry-head. (bibtex-reference-maybe-empty-head): Renamed to bibtex-entry-maybe-empty-head. (bibtex-key-in-reference): Renamed to bibtex-key-in-entry. (bibtex-search-reference): Renamed to bibtex-search-entry. (bibtex-enclosing-reference-maybe-empty-head): Renamed to bibtex-enclosing-entry-maybe-empty-head. (bibtex-entry-field-alist, bibtex-entry-head, bibtex-font-lock-keywords, bibtex-skip-to-valid-entry, bibtex-map-entries, bibtex-search-entry, bibtex-enclosing-entry-maybe-empty-head, bibtex-format-entry, bibtex-generate-autokey, bibtex-parse-keys, bibtex-pop, bibtex-mode, bibtex-submit-bug-report, bibtex-entry, bibtex-print-help-message, bibtex-make-field, bibtex-end-of-entry, bibtex-sort-buffer, bibtex-find-entry-location, bibtex-validate, bibtex-find-text, bibtex-kill-entry, bibtex-clean-entry, bibtex-reformat, bibtex-complete-key, bibtex-String) : Use the new nomenclature. (bibtex-strings, bibtex-keys): Removed redundant comment. (bibtex-format-field-delimiters): New function, functionality extracted from bibtex-format-entry. (bibtex-autokey-get-yearfield-digits): New function, functionality extracted from bibtex-autokey-get-yearfield. Completely reimplemented parsing of bibtex entries in order to avoid stack overflow in the regexp matcher if field contents become large. (bibtex-cfield, bibtex-name-in-cfield, bibtex-text-in-cfield, bibtex-field-string-part-not-braced, bibtex-field-string-part-no-inner-braces, bibtex-field-string-part-1-inner-brace, bibtex-field-string-part-2-inner-braces, bibtex-field-string-part-3-inner-braces, bibtex-field-string-braced, bibtex-field-string-quoted, bibtex-field-string, bibtex-field-string-or-const, bibtex-field-text, bibtex-field, bibtex-name-in-field, bibtex-text-in-field, bibtex-reference-infix, bibtex-string, bibtex-key-in-string, bibtex-text-in-string): Deleted as parsing is now performed by the following functions. (bibtex-parse-nested-braces, bibtex-parse-field-string-braced, bibtex-parse-quoted-string, bibtex-parse-field-string-quoted, bibtex-parse-field-string, bibtex-search-forward-field-string, bibtex-parse-association, bibtex-field-name-for-parsing, bibtex-parse-field-name, bibtex-parse-field-text, bibtex-parse-field, bibtex-search-forward-field, bibtex-search-backward-field, bibtex-start-of-field, bibtex-end-of-field, bibtex-start-of-name-in-field, bibtex-end-of-name-in-field, bibtex-start-of-text-in-field, bibtex-end-of-text-in-field, bibtex-parse-string-prefix, bibtex-parse-string-postfix, bibtex-parse-string, bibtex-search-forward-string, bibtex-search-backward-string, bibtex-start-of-string, bibtex-end-of-string, bibtex-start-of-reference-key-in-string, bibtex-end-of-reference-key-in-string, bibtex-start-of-text-in-string, bibtex-end-of-text-in-string): New functions for the parsing of bibtex entries. Instead of reporting the results of the parsing by match-beginning or match-end, these functions return data structures that hold the corresponding positions. (bibtex-enclosing-field): Changed to also report field boundaries by return values rather than by match-beginning or match-end. The following functions have been adapted to use the new parsing functions. (bibtex-skip-to-valid-entry, bibtex-search-reference, bibtex-enclosing-field, bibtex-format-entry, bibtex-autokey-get-namefield, bibtex-autokey-get-titlestring, bibtex-parse-keys, bibtex-complete, bibtex-pop, bibtex-mode, bibtex-print-help-message, bibtex-end-of-entry, bibtex-ispell-abstract, bibtex-validate, bibtex-next-field, bibtex-find-text, bibtex-remove-OPT-or-ALT, bibtex-remove-delimiters, bibtex-kill-field, bibtex-empty-field, bibtex-fill-entry): Use the new method for parsing. (bibtex-assoc-of-regexp, bibtex-skip-to-valid-entry, bibtex-map-entries, bibtex-flash-head, bibtex-enclosing-reference-maybe-empty-head, bibtex-format-entry, bibtex-autokey-change, bibtex-autokey-get-namefield, bibtex-autokey-get-names, bibtex-autokey-get-titlestring, bibtex-autokey-get-titles, bibtex-parse-keys, bibtex-pop, bibtex-mode, bibtex-end-of-entry, bibtex-ispell-abstract, bibtex-sort-buffer, bibtex-validate, bibtex-remove-OPT-or-ALT, bibtex-remove-delimiters, bibtex-kill-field, bibtex-kill-entry): Use let* instead of let in order to make the new binding of case-fold-search immediately visible. Copyright notice is up to date. Added constant 'bibtex-maintainer-salutation. (bibtex-mode): use with-temp-buffer rather than make-temp-name, use match-string-no-properties and eliminate a quadratic behavior when building bibtex-strings. (bibtex-reference-key): Accept string entries whose reference key contains upper case letters. (bibtex-reference-head): Allow entries to start with a new line. Hiding of entry bodies is not longer provided by bibtex.el directly. Instead the hideshow package can be used. Added a special bibtex entry to hs-special-modes-alist. (bibtex-hs-forward-sexp): Added for hideshow.el. (bibtex-entry-field-alist): Added booktitle field to proceedings entry type (for cross referencing). Thanks to Wagner Toledo Correa for the suggestion. Added `reftex-view-crossref-from-bibtex' to menu.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 15 Feb 2000 09:38:09 +0000
parents bbce331da1be
children 23a1cea22d13
line wrap: on
line source

#include "copyright.h"

/* $Header: /u/src/emacs/19.0/oldXMenu/RCS/AddPane.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
 *
 * 	XMenuAddPane - Adds a pane to an XMenu object.
 *
 *	Author:		Tony Della Fera, DEC
 *			August, 1985
 *
 */

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

int
XMenuAddPane(display, menu, label, active)
    Display *display;           
    register XMenu *menu;	/* Menu object to be modified. */
    register char *label;	/* Selection label. */
    int active;			/* Make selection active? */
{
    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);
    }

    /*
     * 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.
     * X and Y position are set to 0 since a recompute will follow.
     */
    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 at the end of the pane list.
     */
    emacs_insque(pane, menu->p_list->prev);

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

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

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