comparison src/gui-x.c @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents 6240c7796c7a
children 74fd4e045ea6
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
272 signal_special_Xt_user_event (frame, fn, arg); 272 signal_special_Xt_user_event (frame, fn, arg);
273 } 273 }
274 274
275 #if 1 275 #if 1
276 /* Eval the activep slot of the menu item */ 276 /* Eval the activep slot of the menu item */
277 # define wv_set_evalable_slot(slot,form) \ 277 # define wv_set_evalable_slot(slot,form) do { \
278 do { Lisp_Object _f_ = (form); \ 278 Lisp_Object wses_form = (form); \
279 slot = (NILP (_f_) ? 0 : \ 279 (slot) = (NILP (wses_form) ? 0 : \
280 EQ (_f_, Qt) ? 1 : \ 280 EQ (wses_form, Qt) ? 1 : \
281 !NILP (Feval (_f_))); \ 281 !NILP (Feval (wses_form))); \
282 } while (0) 282 } while (0)
283 #else 283 #else
284 /* Treat the activep slot of the menu item as a boolean */ 284 /* Treat the activep slot of the menu item as a boolean */
285 # define wv_set_evalable_slot(slot,form) \ 285 # define wv_set_evalable_slot(slot,form) \
286 slot = (!NILP ((form))) 286 ((void) (slot = (!NILP (form))))
287 #endif 287 #endif
288 288
289 char * 289 char *
290 menu_separator_style (CONST char *s) 290 menu_separator_style (CONST char *s)
291 { 291 {
295 if (!s || s[0] == '\0') 295 if (!s || s[0] == '\0')
296 return NULL; 296 return NULL;
297 first = s[0]; 297 first = s[0];
298 if (first != '-' && first != '=') 298 if (first != '-' && first != '=')
299 return NULL; 299 return NULL;
300 for (p = s; *p == first; p++); 300 for (p = s; *p == first; p++)
301 DO_NOTHING;
301 302
302 /* #### - cannot currently specify a separator tag "--!tag" and a 303 /* #### - cannot currently specify a separator tag "--!tag" and a
303 separator style "--:style" at the same time. */ 304 separator style "--:style" at the same time. */
304 /* #### - Also, the motif menubar code doesn't deal with the 305 /* #### - Also, the motif menubar code doesn't deal with the
305 double etched style yet, so it's not good to get into the habit of 306 double etched style yet, so it's not good to get into the habit of
359 Lisp_Object *contents = XVECTOR_DATA (desc); 360 Lisp_Object *contents = XVECTOR_DATA (desc);
360 int plist_p; 361 int plist_p;
361 int selected_spec = 0, included_spec = 0; 362 int selected_spec = 0, included_spec = 0;
362 363
363 if (length < 2) 364 if (length < 2)
364 signal_simple_error ("button descriptors must be at least 2 long", desc); 365 signal_simple_error ("Button descriptors must be at least 2 long", desc);
365 366
366 /* length 2: [ "name" callback ] 367 /* length 2: [ "name" callback ]
367 length 3: [ "name" callback active-p ] 368 length 3: [ "name" callback active-p ]
368 length 4: [ "name" callback active-p suffix ] 369 length 4: [ "name" callback active-p suffix ]
369 or [ "name" callback keyword value ] 370 or [ "name" callback keyword value ]
384 { 385 {
385 /* the new way */ 386 /* the new way */
386 int i; 387 int i;
387 if (length & 1) 388 if (length & 1)
388 signal_simple_error ( 389 signal_simple_error (
389 "button descriptor has an odd number of keywords and values", 390 "Button descriptor has an odd number of keywords and values",
390 desc); 391 desc);
391 392
392 name = contents [0]; 393 name = contents [0];
393 callback = contents [1]; 394 callback = contents [1];
394 for (i = 2; i < length;) 395 for (i = 2; i < length;)
395 { 396 {
396 Lisp_Object key = contents [i++]; 397 Lisp_Object key = contents [i++];
397 Lisp_Object val = contents [i++]; 398 Lisp_Object val = contents [i++];
398 if (!KEYWORDP (key)) 399 if (!KEYWORDP (key))
399 signal_simple_error_2 ("not a keyword", key, desc); 400 signal_simple_error_2 ("Not a keyword", key, desc);
400 401
401 if (EQ (key, Q_active)) active_p = val; 402 if (EQ (key, Q_active)) active_p = val;
402 else if (EQ (key, Q_suffix)) suffix = val; 403 else if (EQ (key, Q_suffix)) suffix = val;
403 else if (EQ (key, Q_keys)) keys = val; 404 else if (EQ (key, Q_keys)) keys = val;
404 else if (EQ (key, Q_style)) style = val; 405 else if (EQ (key, Q_style)) style = val;
409 { 410 {
410 if ( SYMBOLP (val) 411 if ( SYMBOLP (val)
411 || CHARP (val)) 412 || CHARP (val))
412 accel = val; 413 accel = val;
413 else 414 else
414 signal_simple_error ("bad keyboard accelerator", val); 415 signal_simple_error ("Bad keyboard accelerator", val);
415 } 416 }
416 else if (EQ (key, Q_filter)) 417 else if (EQ (key, Q_filter))
417 signal_simple_error(":filter keyword not permitted on leaf nodes", desc); 418 signal_simple_error(":filter keyword not permitted on leaf nodes", desc);
418 else 419 else
419 signal_simple_error_2 ("unknown menu item keyword", key, desc); 420 signal_simple_error_2 ("Unknown menu item keyword", key, desc);
420 } 421 }
421 } 422 }
422 423
423 #ifdef HAVE_MENUBARS 424 #ifdef HAVE_MENUBARS
424 if ((!NILP (config_tag) && NILP (Fmemq (config_tag, Vmenubar_configuration))) 425 if ((!NILP (config_tag) && NILP (Fmemq (config_tag, Vmenubar_configuration)))
527 wv->value = wv->name; 528 wv->value = wv->name;
528 wv->name = "value"; 529 wv->name = "value";
529 #endif 530 #endif
530 } 531 }
531 else 532 else
532 signal_simple_error_2 ("unknown style", style, desc); 533 signal_simple_error_2 ("Unknown style", style, desc);
533 534
534 if (!allow_text_field_p && (wv->type == TEXT_TYPE)) 535 if (!allow_text_field_p && (wv->type == TEXT_TYPE))
535 signal_simple_error ("text field not allowed in this context", desc); 536 signal_simple_error ("Text field not allowed in this context", desc);
536 537
537 if (selected_spec && EQ (style, Qtext)) 538 if (selected_spec && EQ (style, Qtext))
538 signal_simple_error ( 539 signal_simple_error (
539 ":selected only makes sense with :style toggle, radio or button", 540 ":selected only makes sense with :style toggle, radio or button",
540 desc); 541 desc);