Mercurial > hg > xemacs-beta
comparison src/EmacsFrame.c @ 183:e121b013d1f0 r20-3b18
Import from CVS: tag r20-3b18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:54:23 +0200 |
parents | 5a88923fcbfe |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
182:f07455f06202 | 183:e121b013d1f0 |
---|---|
101 {XtNleftToolBarWidth, XtCLeftToolBarWidth, XtRInt, sizeof (int), | 101 {XtNleftToolBarWidth, XtCLeftToolBarWidth, XtRInt, sizeof (int), |
102 offset (left_toolbar_width), XtRImmediate, (XtPointer)-1}, | 102 offset (left_toolbar_width), XtRImmediate, (XtPointer)-1}, |
103 {XtNrightToolBarWidth, XtCRightToolBarWidth, XtRInt, sizeof (int), | 103 {XtNrightToolBarWidth, XtCRightToolBarWidth, XtRInt, sizeof (int), |
104 offset (right_toolbar_width), XtRImmediate, (XtPointer)-1}, | 104 offset (right_toolbar_width), XtRImmediate, (XtPointer)-1}, |
105 {XtNtopToolBarShadowColor, XtCTopToolBarShadowColor, XtRPixel, sizeof(Pixel), | 105 {XtNtopToolBarShadowColor, XtCTopToolBarShadowColor, XtRPixel, sizeof(Pixel), |
106 offset(top_toolbar_shadow_pixel), XtRString, (String) "#000000"}, | 106 offset(top_toolbar_shadow_pixel), XtRString, "#000000"}, |
107 {XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor, XtRPixel, | 107 {XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor, XtRPixel, |
108 sizeof(Pixel), offset(bottom_toolbar_shadow_pixel), XtRString, | 108 sizeof(Pixel), offset(bottom_toolbar_shadow_pixel), XtRString, "#000000"}, |
109 (String) "#000000"}, | |
110 {XtNbackgroundToolBarColor, XtCBackgroundToolBarColor, XtRPixel, | 109 {XtNbackgroundToolBarColor, XtCBackgroundToolBarColor, XtRPixel, |
111 sizeof(Pixel), offset(background_toolbar_pixel), XtRString, | 110 sizeof(Pixel), offset(background_toolbar_pixel), XtRString, "Gray75"}, |
112 (String) "Gray75"}, | |
113 {XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap, XtRPixmap, | 111 {XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap, XtRPixmap, |
114 sizeof (Pixmap), offset(top_toolbar_shadow_pixmap), XtRImmediate, | 112 sizeof (Pixmap), offset(top_toolbar_shadow_pixmap), XtRImmediate, |
115 (XtPointer)None}, | 113 (XtPointer)None}, |
116 {XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap, XtRPixmap, | 114 {XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap, XtRPixmap, |
117 sizeof (Pixmap), offset(bottom_toolbar_shadow_pixmap), XtRImmediate, | 115 sizeof (Pixmap), offset(bottom_toolbar_shadow_pixmap), XtRImmediate, |
129 XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), | 127 XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), |
130 #endif | 128 #endif |
131 offset(font), XtRImmediate, (XtPointer)0 | 129 offset(font), XtRImmediate, (XtPointer)0 |
132 }, | 130 }, |
133 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), | 131 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), |
134 offset(foreground_pixel), XtRString, (String) "XtDefaultForeground"}, | 132 offset(foreground_pixel), XtRString, "XtDefaultForeground"}, |
135 {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), | 133 {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), |
136 offset(cursor_color), XtRString, (String) "XtDefaultForeground"}, | 134 offset(cursor_color), XtRString, "XtDefaultForeground"}, |
137 {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean), | 135 {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean), |
138 offset (bar_cursor), XtRImmediate, (XtPointer)0}, | 136 offset (bar_cursor), XtRImmediate, (XtPointer)0}, |
139 {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean), | 137 {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean), |
140 offset (visual_bell), XtRImmediate, (XtPointer)0}, | 138 offset (visual_bell), XtRImmediate, (XtPointer)0}, |
141 {XtNbellVolume, XtCBellVolume, XtRInt, sizeof (int), | 139 {XtNbellVolume, XtCBellVolume, XtRInt, sizeof (int), |
154 Xt is stupid and dumb. | 152 Xt is stupid and dumb. |
155 Xt is stupid and dumb. */ | 153 Xt is stupid and dumb. */ |
156 | 154 |
157 static XtActionsRec | 155 static XtActionsRec |
158 emacsFrameActionsTable [] = { | 156 emacsFrameActionsTable [] = { |
159 {(String) "mapping", (XtActionProc) emacs_Xt_mapping_action}, | 157 {"mapping", (XtActionProc) emacs_Xt_mapping_action}, |
160 }; | 158 }; |
161 | 159 |
162 static char | 160 static char |
163 emacsFrameTranslations [] = "\ | 161 emacsFrameTranslations [] = "\ |
164 <Mapping>: mapping()\n\ | 162 <Mapping>: mapping()\n\ |
173 #ifdef LWLIB_USES_MOTIF | 171 #ifdef LWLIB_USES_MOTIF |
174 /* superclass */ (WidgetClass) &xmPrimitiveClassRec, | 172 /* superclass */ (WidgetClass) &xmPrimitiveClassRec, |
175 #else | 173 #else |
176 /* superclass */ &widgetClassRec, | 174 /* superclass */ &widgetClassRec, |
177 #endif | 175 #endif |
178 /* class_name */ (String) "EmacsFrame", | 176 /* class_name */ "EmacsFrame", |
179 /* widget_size */ sizeof(EmacsFrameRec), | 177 /* widget_size */ sizeof(EmacsFrameRec), |
180 /* class_initialize */ EmacsFrameClassInitialize, | 178 /* class_initialize */ EmacsFrameClassInitialize, |
181 /* class_part_initialize */ 0, | 179 /* class_part_initialize */ 0, |
182 /* class_inited */ FALSE, | 180 /* class_inited */ FALSE, |
183 /* initialize */ EmacsFrameInitialize, | 181 /* initialize */ EmacsFrameInitialize, |
240 ew->emacs_frame.frame->pixwidth = ew->core.width; | 238 ew->emacs_frame.frame->pixwidth = ew->core.width; |
241 ew->emacs_frame.frame->internal_border_width = | 239 ew->emacs_frame.frame->internal_border_width = |
242 ew->emacs_frame.internal_border_width; | 240 ew->emacs_frame.internal_border_width; |
243 } | 241 } |
244 | 242 |
245 static void | 243 static void |
246 EmacsFrameInitialize (Widget request, Widget new, | 244 EmacsFrameInitialize (Widget request, Widget new, |
247 ArgList dum1, Cardinal *dum2) | 245 ArgList dum1, Cardinal *dum2) |
248 { | 246 { |
249 EmacsFrame ew = (EmacsFrame)new; | 247 EmacsFrame ew = (EmacsFrame)new; |
250 struct frame *f = ew->emacs_frame.frame; | 248 struct frame *f = ew->emacs_frame.frame; |
331 EmacsFrame ew = (EmacsFrame)widget; | 329 EmacsFrame ew = (EmacsFrame)widget; |
332 struct frame *f = ew->emacs_frame.frame; | 330 struct frame *f = ew->emacs_frame.frame; |
333 int columns; | 331 int columns; |
334 int rows; | 332 int rows; |
335 XtWidgetGeometry req, repl; | 333 XtWidgetGeometry req, repl; |
336 | 334 |
337 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows); | 335 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows); |
338 update_various_frame_slots (ew); | 336 update_various_frame_slots (ew); |
339 change_frame_size (f, rows, columns, 0); | 337 change_frame_size (f, rows, columns, 0); |
340 | 338 |
341 /* Now we tell the EmacsShell that we've changed the size of the non-fixed | 339 /* Now we tell the EmacsShell that we've changed the size of the non-fixed |
399 new->emacs_frame.scrollbar_height) | 397 new->emacs_frame.scrollbar_height) |
400 Fadd_spec_to_specifier | 398 Fadd_spec_to_specifier |
401 (Vscrollbar_height, | 399 (Vscrollbar_height, |
402 make_int (new->emacs_frame.scrollbar_height), | 400 make_int (new->emacs_frame.scrollbar_height), |
403 frame, Qnil, Qnil); | 401 frame, Qnil, Qnil); |
404 #endif | 402 #endif /* HAVE_SCROLLBARS */ |
405 #ifdef HAVE_TOOLBARS | 403 #ifdef HAVE_TOOLBARS |
406 if (cur->emacs_frame.top_toolbar_height != | 404 if (cur->emacs_frame.top_toolbar_height != |
407 new->emacs_frame.top_toolbar_height) | 405 new->emacs_frame.top_toolbar_height) |
408 Fadd_spec_to_specifier | 406 Fadd_spec_to_specifier |
409 (Vtoolbar_size[TOP_TOOLBAR], | 407 (Vtoolbar_size[TOP_TOOLBAR], |
425 new->emacs_frame.right_toolbar_width) | 423 new->emacs_frame.right_toolbar_width) |
426 Fadd_spec_to_specifier | 424 Fadd_spec_to_specifier |
427 (Vtoolbar_size[RIGHT_TOOLBAR], | 425 (Vtoolbar_size[RIGHT_TOOLBAR], |
428 make_int (new->emacs_frame.right_toolbar_width), | 426 make_int (new->emacs_frame.right_toolbar_width), |
429 frame, Qnil, Qnil); | 427 frame, Qnil, Qnil); |
430 #endif | 428 #endif /* HAVE_TOOLBARS */ |
431 } | 429 } |
432 in_resource_setting--; | 430 in_resource_setting--; |
433 | 431 |
434 return False; | 432 return False; |
435 | 433 |
489 /* This variable cannot be a stack variable. */ | 487 /* This variable cannot be a stack variable. */ |
490 static unsigned char cvt_string_scrollbar_placement; | 488 static unsigned char cvt_string_scrollbar_placement; |
491 | 489 |
492 /* ARGSUSED */ | 490 /* ARGSUSED */ |
493 static void | 491 static void |
494 _CvtStringToScrollBarPlacement (XrmValuePtr args, /* unused */ | 492 Xt_StringToScrollBarPlacement (XrmValuePtr args, /* unused */ |
495 Cardinal *num_args, /* unused */ | 493 Cardinal *num_args, /* unused */ |
496 XrmValuePtr fromVal, | 494 XrmValuePtr fromVal, |
497 XrmValuePtr toVal) | 495 XrmValuePtr toVal) |
498 { | 496 { |
499 #if 0 | |
500 /* Martin, this is broken. Please fix it. */ | |
501 XrmQuark q; | 497 XrmQuark q; |
502 char *lowerName = (char *) alloca (strlen ( (char *) fromVal->addr) + 1); | 498 char *lowerName = (char *) alloca (strlen ((char *) fromVal->addr) + 1); |
503 | 499 |
504 XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr); | 500 XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr); |
505 q = XrmStringToQuark (lowerName); | 501 q = XrmStringToQuark (lowerName); |
506 | 502 |
507 toVal->size = sizeof (cvt_string_scrollbar_placement); | 503 toVal->size = sizeof (cvt_string_scrollbar_placement); |
508 toVal->addr = (XtPointer) &cvt_string_scrollbar_placement; | 504 toVal->addr = (XtPointer) &cvt_string_scrollbar_placement; |
509 cvt_string_scrollbar_placement = | 505 |
510 q == XrmStringToQuark ("top_left") ? XtTOP_LEFT : | 506 if (q == XrmStringToQuark ("top_left")) |
511 q == XrmStringToQuark ("bottom_left") ? XtBOTTOM_LEFT : | 507 cvt_string_scrollbar_placement = XtTOP_LEFT; |
512 q == XrmStringToQuark ("top_right") ? XtTOP_RIGHT : | 508 else if (q == XrmStringToQuark ("bottom_left")) |
513 q == XrmStringToQuark ("bottom_right") ? XtBOTTOM_RIGHT : | 509 cvt_string_scrollbar_placement = XtBOTTOM_LEFT; |
514 0; | 510 else if (q == XrmStringToQuark ("top_right")) |
515 | 511 cvt_string_scrollbar_placement = XtTOP_RIGHT; |
516 if (cvt_string_scrollbar_placement != 0) | 512 else if (q == XrmStringToQuark ("bottom_right")) |
517 return; | 513 cvt_string_scrollbar_placement = XtBOTTOM_RIGHT; |
518 | 514 else |
519 toVal->addr = NULL; | |
520 toVal->size = 0; | |
521 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement"); | |
522 #endif | |
523 #define done(address, type) \ | |
524 toVal->size = sizeof(type); \ | |
525 toVal->addr = (XtPointer) address; \ | |
526 return /* `;' supplied by caller */ | |
527 | |
528 XrmQuark q; | |
529 char lowerName[1000]; | |
530 | |
531 XmuCopyISOLatin1Lowered (lowerName, (char*)fromVal->addr); | |
532 q = XrmStringToQuark(lowerName); | |
533 if (q == XrmStringToQuark ("top_left")) | |
534 { | 515 { |
535 cvt_string_scrollbar_placement = XtTOP_LEFT; | 516 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement"); |
536 done (&cvt_string_scrollbar_placement, unsigned char); | 517 toVal->addr = NULL; |
518 toVal->size = 0; | |
537 } | 519 } |
538 if (q == XrmStringToQuark ("bottom_left")) | |
539 { | |
540 cvt_string_scrollbar_placement = XtBOTTOM_LEFT; | |
541 done (&cvt_string_scrollbar_placement, unsigned char); | |
542 } | |
543 if (q == XrmStringToQuark ("top_right")) | |
544 { | |
545 cvt_string_scrollbar_placement = XtTOP_RIGHT; | |
546 done (&cvt_string_scrollbar_placement, unsigned char); | |
547 } | |
548 if (q == XrmStringToQuark ("bottom_right")) | |
549 { | |
550 cvt_string_scrollbar_placement = XtBOTTOM_RIGHT; | |
551 done (&cvt_string_scrollbar_placement, unsigned char); | |
552 } | |
553 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement"); | |
554 toVal->addr = NULL; | |
555 toVal->size = 0; | |
556 #undef done | |
557 } | 520 } |
558 | 521 |
559 static void | 522 static void |
560 EmacsFrameClassInitialize (void) | 523 EmacsFrameClassInitialize (void) |
561 { | 524 { |
562 XtAddConverter (XtRString, XtRScrollBarPlacement, | 525 XtAddConverter (XtRString, XtRScrollBarPlacement, |
563 _CvtStringToScrollBarPlacement, NULL, 0); | 526 Xt_StringToScrollBarPlacement, NULL, 0); |
564 } | 527 } |
565 | 528 |
566 /********************* Special entrypoints *******************/ | 529 /********************* Special entrypoints *******************/ |
567 | 530 |
568 void | 531 void |