comparison lwlib/xlwmenu.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 7d59cb494b73
children a86b2b5e0111
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
421 int charslength; 421 int charslength;
422 char *chars; 422 char *chars;
423 int i, j; 423 int i, j;
424 424
425 #ifdef NEED_MOTIF 425 #ifdef NEED_MOTIF
426 chars = "";
426 if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars)) 427 if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars))
427 { 428 chars = "";
428 chars = "";
429 }
430 #else 429 #else
431 chars = string; 430 chars = string;
432 #endif 431 #endif
433 charslength = strlen (chars); 432 charslength = strlen (chars);
434 newchars = (char *) alloca (charslength + 1); 433 newchars = (char *) alloca (charslength + 1);
456 # endif /* USE_XFONTSET */ 455 # endif /* USE_XFONTSET */
457 #endif 456 #endif
458 } 457 }
459 458
460 static void 459 static void
461 massage_resource_name (CONST char *in, char *out) 460 massage_resource_name (const char *in, char *out)
462 { 461 {
463 /* Turn a random string into something suitable for using as a resource. 462 /* Turn a random string into something suitable for using as a resource.
464 For example: 463 For example:
465 464
466 "Kill Buffer" -> "killBuffer" 465 "Kill Buffer" -> "killBuffer"
519 * %1 means insert value. 518 * %1 means insert value.
520 * %-1 means insert value followed by one space. The latter is 519 * %-1 means insert value followed by one space. The latter is
521 * not inserted if value is a zero length string. 520 * not inserted if value is a zero length string.
522 */ 521 */
523 static char* 522 static char*
524 parameterize_string (CONST char *string, CONST char *value) 523 parameterize_string (const char *string, const char *value)
525 { 524 {
526 char *percent; 525 char *percent;
527 char *result; 526 char *result;
528 unsigned int done = 0; 527 unsigned int done = 0;
529 unsigned int ntimes; 528 unsigned int ntimes;
870 { 869 {
871 int i, s = 0; 870 int i, s = 0;
872 char *chars; 871 char *chars;
873 872
874 #ifdef NEED_MOTIF 873 #ifdef NEED_MOTIF
875 XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars); 874 chars = "";
875 if (!XmStringGetLtoR (string, XmFONTLIST_DEFAULT_TAG, &chars))
876 chars = "";
876 #else 877 #else
877 chars = string; 878 chars = string;
878 #endif 879 #endif
879 for (i=0; chars[i]; ++i) { 880 for (i=0; chars[i]; ++i) {
880 if (chars[i] == '%' && chars[i+1] == '_') { 881 if (chars[i] == '%' && chars[i+1] == '_') {
1526 { 1527 {
1527 *height = (mw->menu.font_ascent + mw->menu.font_descent + 1528 *height = (mw->menu.font_ascent + mw->menu.font_descent +
1528 2 * mw->menu.vertical_margin + 1529 2 * mw->menu.vertical_margin +
1529 2 * mw->menu.shadow_thickness); 1530 2 * mw->menu.shadow_thickness);
1530 /* no left column decoration */ 1531 /* no left column decoration */
1531 *toggle_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness;; 1532 *toggle_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness;
1532 1533
1533 *label_width = string_width_u (mw, resource_widget_value (mw, val)); 1534 *label_width = string_width_u (mw, resource_widget_value (mw, val));
1534 *bindings_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness; 1535 *bindings_width = mw->menu.horizontal_margin + mw->menu.shadow_thickness;
1535 } 1536 }
1536 1537
1870 height, label_tab, binding_tab); 1871 height, label_tab, binding_tab);
1871 } 1872 }
1872 1873
1873 static struct _shadow_names 1874 static struct _shadow_names
1874 { 1875 {
1875 CONST char * name; 1876 const char * name;
1876 shadow_type type; 1877 shadow_type type;
1877 } shadow_names[] = 1878 } shadow_names[] =
1878 { 1879 {
1879 /* Motif */ 1880 /* Motif */
1880 { "singleLine", SHADOW_SINGLE_LINE }, 1881 { "singleLine", SHADOW_SINGLE_LINE },
2822 XtGetGC((Widget)mw, GCForeground|GCBackground|pm, &xgcv); 2823 XtGetGC((Widget)mw, GCForeground|GCBackground|pm, &xgcv);
2823 2824
2824 xgcv.foreground = mw->menu.bottom_shadow_color; 2825 xgcv.foreground = mw->menu.bottom_shadow_color;
2825 /* xgcv.stipple = mw->menu.bottom_shadow_pixmap; gtb */ 2826 /* xgcv.stipple = mw->menu.bottom_shadow_pixmap; gtb */
2826 #ifdef NEED_MOTIF 2827 #ifdef NEED_MOTIF
2827 if (mw->menu.top_shadow_pixmap && 2828 if (mw->menu.bottom_shadow_pixmap &&
2828 mw->menu.top_shadow_pixmap != XmUNSPECIFIED_PIXMAP) 2829 mw->menu.bottom_shadow_pixmap != XmUNSPECIFIED_PIXMAP)
2829 xgcv.stipple = mw->menu.bottom_shadow_pixmap; 2830 xgcv.stipple = mw->menu.bottom_shadow_pixmap;
2830 else 2831 else
2831 xgcv.stipple = 0; 2832 xgcv.stipple = 0;
2832 #else 2833 #else
2833 xgcv.stipple = mw->menu.bottom_shadow_pixmap; 2834 xgcv.stipple = mw->menu.bottom_shadow_pixmap;