Don't load cl.
[emacs.git] / oldXMenu / Recomp.c
blobb4bc4da3f725224dd486a72c1251521aec601ea7
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
5 /*
6 * XMenu: MIT Project Athena, X Window system menu package
8 * XMenuRecompute - Recompute XMenu object dependencies.
10 * Author: Tony Della Fera, DEC
11 * September, 1985
15 #include "XMenuInt.h"
17 int
18 XMenuRecompute(display, menu)
19 Display *display;
20 register XMenu *menu; /* Menu object to be recomputed. */
22 register XMPane *p_ptr; /* Pane pointer. */
23 register XMSelect *s_ptr; /* Selection pointer. */
25 register int p_num; /* Pane serial number. */
26 register int s_num; /* Selection serial number. */
29 * If there are no panes in the menu then return failure
30 * because the menu is not initialized.
32 if (menu->p_count == 0) {
33 _XMErrorCode = XME_NOT_INIT;
34 return(XM_FAILURE);
38 * Recompute menu wide global values: pane window size,
39 * selection size and maximum selection count.
41 _XMRecomputeGlobals(display, menu);
44 * For each pane in the menu...
47 p_num = 0;
48 for (
49 p_ptr = menu->p_list->next;
50 p_ptr != menu->p_list;
51 p_ptr = p_ptr->next
54 * Recompute pane dependencies.
56 if (_XMRecomputePane(display, menu, p_ptr, p_num) == _FAILURE) {
57 return(XM_FAILURE);
59 p_num++;
62 * For each selection in the pane...
64 s_num = 0;
65 for (
66 s_ptr = p_ptr->s_list->next;
67 s_ptr != p_ptr->s_list;
68 s_ptr = s_ptr->next
69 ) {
71 * Recompute selection dependencies.
73 if (_XMRecomputeSelection(display, menu, s_ptr, s_num) == _FAILURE) {
74 return(XM_FAILURE);
76 s_num++;
81 * Recompute menu size.
83 if (menu->menu_style == CENTER) {
84 menu->width = menu->p_width + (menu->p_bdr_width << 1);
86 else {
87 menu->width = menu->p_width + (menu->p_bdr_width << 1) +
88 ((menu->p_count - 1) * menu->p_x_off);
90 menu->height = menu->p_height + (menu->p_bdr_width << 1) +
91 ((menu->p_count - 1) * menu->p_y_off);
94 * Reset the recompute flag.
96 menu->recompute = 0;
99 * Return successfully.
101 _XMErrorCode = XME_NO_ERROR;
102 return(XM_SUCCESS);
105 /* arch-tag: 1fe99b82-3873-4aab-b2b3-f277c93e00d9
106 (do not change this comment) */