Mercurial > emacs
annotate oldXMenu/Recomp.c @ 74774:3ecc464eb15c
* configure: Regenerate
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Wed, 20 Dec 2006 19:57:39 +0000 |
parents | ce127a46b1ca |
children | 3d45362f1d38 17e0dd217877 6588c6259dfb |
rev | line source |
---|---|
25858 | 1 #include "copyright.h" |
2 | |
3 /* Copyright Massachusetts Institute of Technology 1985 */ | |
74548 | 4 /* Copyright (C) 2001, 2002, 2003, 2004, 2005, |
68640
e8a3fb527b77
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65000
diff
changeset
|
5 2006 Free Software Foundation, Inc. */ |
25858 | 6 |
7 /* | |
8 * XMenu: MIT Project Athena, X Window system menu package | |
9 * | |
10 * XMenuRecompute - Recompute XMenu object dependencies. | |
11 * | |
12 * Author: Tony Della Fera, DEC | |
13 * September, 1985 | |
14 * | |
15 */ | |
16 | |
17 #include "XMenuInt.h" | |
18 | |
19 int | |
20 XMenuRecompute(display, menu) | |
21 Display *display; | |
22 register XMenu *menu; /* Menu object to be recomputed. */ | |
23 { | |
24 register XMPane *p_ptr; /* Pane pointer. */ | |
25 register XMSelect *s_ptr; /* Selection pointer. */ | |
26 | |
27 register int p_num; /* Pane serial number. */ | |
28 register int s_num; /* Selection serial number. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
29 |
25858 | 30 /* |
31 * If there are no panes in the menu then return failure | |
32 * because the menu is not initialized. | |
33 */ | |
34 if (menu->p_count == 0) { | |
35 _XMErrorCode = XME_NOT_INIT; | |
36 return(XM_FAILURE); | |
37 } | |
38 | |
39 /* | |
40 * Recompute menu wide global values: pane window size, | |
41 * selection size and maximum selection count. | |
42 */ | |
43 _XMRecomputeGlobals(display, menu); | |
44 | |
45 /* | |
46 * For each pane in the menu... | |
47 */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
48 |
25858 | 49 p_num = 0; |
50 for ( | |
51 p_ptr = menu->p_list->next; | |
52 p_ptr != menu->p_list; | |
53 p_ptr = p_ptr->next | |
54 ){ | |
55 /* | |
56 * Recompute pane dependencies. | |
57 */ | |
58 if (_XMRecomputePane(display, menu, p_ptr, p_num) == _FAILURE) { | |
59 return(XM_FAILURE); | |
60 } | |
61 p_num++; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
62 |
25858 | 63 /* |
64 * For each selection in the pane... | |
65 */ | |
66 s_num = 0; | |
67 for ( | |
68 s_ptr = p_ptr->s_list->next; | |
69 s_ptr != p_ptr->s_list; | |
70 s_ptr = s_ptr->next | |
71 ) { | |
72 /* | |
73 * Recompute selection dependencies. | |
74 */ | |
75 if (_XMRecomputeSelection(display, menu, s_ptr, s_num) == _FAILURE) { | |
76 return(XM_FAILURE); | |
77 } | |
78 s_num++; | |
79 } | |
80 } | |
81 | |
82 /* | |
83 * Recompute menu size. | |
84 */ | |
85 if (menu->menu_style == CENTER) { | |
86 menu->width = menu->p_width + (menu->p_bdr_width << 1); | |
87 } | |
88 else { | |
89 menu->width = menu->p_width + (menu->p_bdr_width << 1) + | |
90 ((menu->p_count - 1) * menu->p_x_off); | |
91 } | |
92 menu->height = menu->p_height + (menu->p_bdr_width << 1) + | |
93 ((menu->p_count - 1) * menu->p_y_off); | |
94 | |
95 /* | |
96 * Reset the recompute flag. | |
97 */ | |
98 menu->recompute = 0; | |
99 | |
100 /* | |
101 * Return successfully. | |
102 */ | |
103 _XMErrorCode = XME_NO_ERROR; | |
104 return(XM_SUCCESS); | |
105 } | |
52401 | 106 |
107 /* arch-tag: 1fe99b82-3873-4aab-b2b3-f277c93e00d9 | |
108 (do not change this comment) */ |