view oldXMenu/ChgSel.c @ 44770:cdbaa6173481
(menu-bar-update-buffers): Don't use constant lists for command menu
entries, since the low-level menu code modifies them. Cache the
resulting list.
(menu-bar-buffers-menu-command-entries): New variable.
author
Miles Bader <miles@gnu.org>
date
Tue, 23 Apr 2002 08:34:57 +0000 (2002-04-23)
parents
bbce331da1be
children
23a1cea22d13
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);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }