Mercurial > hg > xemacs-beta
comparison src/menubar-x.c @ 436:080151679be2 r21-2-26
Import from CVS: tag r21-2-26
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:31:24 +0200 |
parents | 3ecd8885ac67 |
children | 84b14dcb0985 |
comparison
equal
deleted
inserted
replaced
435:53cf74a9db44 | 436:080151679be2 |
---|---|
118 { | 118 { |
119 wv->value = menu_separator_style (string_chars); | 119 wv->value = menu_separator_style (string_chars); |
120 } | 120 } |
121 else | 121 else |
122 { | 122 { |
123 wv->name = string_chars; | 123 wv->name = xstrdup (string_chars); |
124 wv->enabled = 1; | 124 wv->enabled = 1; |
125 /* dverna Dec. 98: command_builder_operate_menu_accelerator will | 125 /* dverna Dec. 98: command_builder_operate_menu_accelerator will |
126 manipulate the accel as a Lisp_Object if the widget has a name. | 126 manipulate the accel as a Lisp_Object if the widget has a name. |
127 Since simple labels have a name, but no accel, we *must* set it | 127 Since simple labels have a name, but no accel, we *must* set it |
128 to nil */ | 128 to nil */ |
155 int included_spec = 0; | 155 int included_spec = 0; |
156 int active_spec = 0; | 156 int active_spec = 0; |
157 wv->type = CASCADE_TYPE; | 157 wv->type = CASCADE_TYPE; |
158 wv->enabled = 1; | 158 wv->enabled = 1; |
159 wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc))); | 159 wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc))); |
160 wv->name = xstrdup (wv->name); | |
160 | 161 |
161 accel = gui_name_accelerator (LISP_GETTEXT (XCAR (desc))); | 162 accel = gui_name_accelerator (LISP_GETTEXT (XCAR (desc))); |
162 wv->accel = LISP_TO_VOID (accel); | 163 wv->accel = LISP_TO_VOID (accel); |
163 | 164 |
164 desc = Fcdr (desc); | 165 desc = Fcdr (desc); |
224 widget_value *incr_wv = xmalloc_widget_value (); | 225 widget_value *incr_wv = xmalloc_widget_value (); |
225 wv->contents = incr_wv; | 226 wv->contents = incr_wv; |
226 incr_wv->type = INCREMENTAL_TYPE; | 227 incr_wv->type = INCREMENTAL_TYPE; |
227 incr_wv->enabled = 1; | 228 incr_wv->enabled = 1; |
228 incr_wv->name = wv->name; | 229 incr_wv->name = wv->name; |
230 incr_wv->name = xstrdup (wv->name); | |
229 /* This is automatically GC protected through | 231 /* This is automatically GC protected through |
230 the call to lw_map_widget_values(); no need | 232 the call to lw_map_widget_values(); no need |
231 to worry. */ | 233 to worry. */ |
232 incr_wv->call_data = LISP_TO_VOID (incremental_data); | 234 incr_wv->call_data = LISP_TO_VOID (incremental_data); |
233 goto menu_item_done; | 235 goto menu_item_done; |
240 the menu: a label, and two separators (to get a double | 242 the menu: a label, and two separators (to get a double |
241 line). */ | 243 line). */ |
242 widget_value *title_wv = xmalloc_widget_value (); | 244 widget_value *title_wv = xmalloc_widget_value (); |
243 widget_value *sep_wv = xmalloc_widget_value (); | 245 widget_value *sep_wv = xmalloc_widget_value (); |
244 title_wv->type = TEXT_TYPE; | 246 title_wv->type = TEXT_TYPE; |
245 title_wv->name = wv->name; | 247 title_wv->name = xstrdup (wv->name); |
246 title_wv->enabled = 1; | 248 title_wv->enabled = 1; |
247 title_wv->next = sep_wv; | 249 title_wv->next = sep_wv; |
248 sep_wv->type = SEPARATOR_TYPE; | 250 sep_wv->type = SEPARATOR_TYPE; |
249 sep_wv->value = menu_separator_style ("=="); | 251 sep_wv->value = menu_separator_style ("=="); |
250 sep_wv->next = 0; | 252 sep_wv->next = 0; |
256 if (deep_p && !wv->enabled && !NILP (desc)) | 258 if (deep_p && !wv->enabled && !NILP (desc)) |
257 { | 259 { |
258 widget_value *dummy; | 260 widget_value *dummy; |
259 /* Add a fake entry so the menus show up */ | 261 /* Add a fake entry so the menus show up */ |
260 wv->contents = dummy = xmalloc_widget_value (); | 262 wv->contents = dummy = xmalloc_widget_value (); |
261 dummy->name = "(inactive)"; | 263 dummy->name = xstrdup ("(inactive)"); |
262 dummy->accel = LISP_TO_VOID (Qnil); | 264 dummy->accel = LISP_TO_VOID (Qnil); |
263 dummy->enabled = 0; | 265 dummy->enabled = 0; |
264 dummy->selected = 0; | 266 dummy->selected = 0; |
265 dummy->value = NULL; | 267 dummy->value = NULL; |
266 dummy->type = BUTTON_TYPE; | 268 dummy->type = BUTTON_TYPE; |
271 } | 273 } |
272 | 274 |
273 } | 275 } |
274 else if (menubar_root_p) | 276 else if (menubar_root_p) |
275 { | 277 { |
276 wv->name = (char *) "menubar"; | 278 wv->name = xstrdup ("menubar"); |
277 wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and | 279 wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and |
278 this is ignored anyway... */ | 280 this is ignored anyway... */ |
279 } | 281 } |
280 else | 282 else |
281 { | 283 { |
467 wv->type = CASCADE_TYPE; | 469 wv->type = CASCADE_TYPE; |
468 wv->next = NULL; | 470 wv->next = NULL; |
469 wv->accel = LISP_TO_VOID (Qnil); | 471 wv->accel = LISP_TO_VOID (Qnil); |
470 wv->contents = xmalloc_widget_value (); | 472 wv->contents = xmalloc_widget_value (); |
471 wv->contents->type = TEXT_TYPE; | 473 wv->contents->type = TEXT_TYPE; |
472 wv->contents->name = (char *) "No menu"; | 474 wv->contents->name = xstrdup ("No menu"); |
473 wv->contents->next = NULL; | 475 wv->contents->next = NULL; |
474 wv->contents->accel = LISP_TO_VOID (Qnil); | 476 wv->contents->accel = LISP_TO_VOID (Qnil); |
475 } | 477 } |
476 assert (wv && wv->type == CASCADE_TYPE && wv->contents); | 478 assert (wv && wv->type == CASCADE_TYPE && wv->contents); |
477 replace_widget_value_tree (hack_wv, wv->contents); | 479 replace_widget_value_tree (hack_wv, wv->contents); |