90 |
typedef struct _widget_value |
typedef struct _widget_value |
91 |
{ |
{ |
92 |
/* name of widget */ |
/* name of widget */ |
93 |
|
Lisp_Object lname; |
94 |
char* name; |
char* name; |
95 |
/* value (meaning depend on widget type) */ |
/* value (meaning depend on widget type) */ |
96 |
char* value; |
char* value; |
97 |
/* keyboard equivalent. no implications for XtTranslations */ |
/* keyboard equivalent. no implications for XtTranslations */ |
98 |
|
Lisp_Object lkey; |
99 |
char* key; |
char* key; |
100 |
/* Help string or nil if none. |
/* Help string or nil if none. |
101 |
GC finds this string through the frame's menu_bar_vector |
GC finds this string through the frame's menu_bar_vector |
1223 |
save_wv->next = wv; |
save_wv->next = wv; |
1224 |
else |
else |
1225 |
first_wv->contents = wv; |
first_wv->contents = wv; |
1226 |
wv->name = pane_string; |
wv->lname = pane_name; |
1227 |
/* Ignore the @ that means "separate pane". |
/* Set value to 1 so update_submenu_strings can handle '@' */ |
1228 |
This is a kludge, but this isn't worth more time. */ |
wv->value = (char *)1; |
|
if (!NILP (prefix) && wv->name[0] == '@') |
|
|
wv->name++; |
|
|
wv->value = 0; |
|
1229 |
wv->enabled = 1; |
wv->enabled = 1; |
1230 |
wv->button_type = BUTTON_TYPE_NONE; |
wv->button_type = BUTTON_TYPE_NONE; |
1231 |
wv->help = Qnil; |
wv->help = Qnil; |
1268 |
else |
else |
1269 |
save_wv->contents = wv; |
save_wv->contents = wv; |
1270 |
|
|
1271 |
wv->name = (char *) SDATA (item_name); |
wv->lname = item_name; |
1272 |
if (!NILP (descrip)) |
if (!NILP (descrip)) |
1273 |
wv->key = (char *) SDATA (descrip); |
wv->lkey = descrip; |
1274 |
wv->value = 0; |
wv->value = 0; |
1275 |
/* The EMACS_INT cast avoids a warning. There's no problem |
/* The EMACS_INT cast avoids a warning. There's no problem |
1276 |
as long as pointers have enough bits to hold small integers. */ |
as long as pointers have enough bits to hold small integers. */ |
1309 |
|
|
1310 |
return first_wv; |
return first_wv; |
1311 |
} |
} |
1312 |
|
/* Walk through the widget_value tree starting at FIRST_WV and update |
1313 |
|
the char * pointers from the corresponding lisp values. |
1314 |
|
We do this after building the whole tree, since GC may happen while the |
1315 |
|
tree is constructed, and small strings are relocated. So we must wait |
1316 |
|
until no GC can happen before storing pointers into lisp values. */ |
1317 |
|
static void |
1318 |
|
update_submenu_strings (first_wv) |
1319 |
|
widget_value *first_wv; |
1320 |
|
{ |
1321 |
|
widget_value *wv; |
1322 |
|
|
1323 |
|
for (wv = first_wv; wv; wv = wv->next) |
1324 |
|
{ |
1325 |
|
if (wv->lname && ! NILP (wv->lname)) |
1326 |
|
{ |
1327 |
|
wv->name = SDATA (wv->lname); |
1328 |
|
|
1329 |
|
/* Ignore the @ that means "separate pane". |
1330 |
|
This is a kludge, but this isn't worth more time. */ |
1331 |
|
if (wv->value == (char *)1) |
1332 |
|
{ |
1333 |
|
if (wv->name[0] == '@') |
1334 |
|
wv->name++; |
1335 |
|
wv->value = 0; |
1336 |
|
} |
1337 |
|
} |
1338 |
|
|
1339 |
|
if (wv->lkey && ! NILP (wv->lkey)) |
1340 |
|
wv->key = SDATA (wv->lkey); |
1341 |
|
|
1342 |
|
if (wv->contents) |
1343 |
|
update_submenu_strings (wv->contents); |
1344 |
|
} |
1345 |
|
} |
1346 |
|
|
1347 |
|
|
1348 |
/* Set the contents of the menubar widgets of frame F. |
/* Set the contents of the menubar widgets of frame F. |
1349 |
The argument FIRST_TIME is currently ignored; |
The argument FIRST_TIME is currently ignored; |
1422 |
|
|
1423 |
items = FRAME_MENU_BAR_ITEMS (f); |
items = FRAME_MENU_BAR_ITEMS (f); |
1424 |
|
|
|
inhibit_garbage_collection (); |
|
|
|
|
1425 |
/* Save the frame's previous menu bar contents data. */ |
/* Save the frame's previous menu bar contents data. */ |
1426 |
if (previous_menu_items_used) |
if (previous_menu_items_used) |
1427 |
bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, |
bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, |
1486 |
if (NILP (string)) |
if (NILP (string)) |
1487 |
break; |
break; |
1488 |
wv->name = (char *) SDATA (string); |
wv->name = (char *) SDATA (string); |
1489 |
|
update_submenu_strings (wv->contents); |
1490 |
wv = wv->next; |
wv = wv->next; |
1491 |
} |
} |
1492 |
|
|