comparison src/glyphs-widget.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 183866b06e0b
children e38acbeb1cae
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
433 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii); 433 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii);
434 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil; 434 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
435 } 435 }
436 } 436 }
437 437
438 static void
439 widget_query_string_geometry (Lisp_Object string, Lisp_Object face,
440 int *width, int *height, Lisp_Object domain)
441 {
442 struct device *d = DOMAIN_XDEVICE (domain);
443
444 if (HAS_DEVMETH_P (d, widget_query_string_geometry))
445 DEVMETH (d, widget_query_string_geometry,
446 (string, face, width, height, domain));
447 else
448 query_string_geometry (string, face, width, height, 0, domain);
449
450 }
451
438 /* Query for a widgets desired geometry. If no type specific method is 452 /* Query for a widgets desired geometry. If no type specific method is
439 provided then use the widget text to calculate sizes. */ 453 provided then use the widget text to calculate sizes. */
440 static void 454 static void
441 widget_query_geometry (Lisp_Object image_instance, 455 widget_query_geometry (Lisp_Object image_instance,
442 int* width, int* height, 456 int* width, int* height,
476 { 490 {
477 int w, h; 491 int w, h;
478 492
479 /* Then if we are allowed to resize the widget, make the 493 /* Then if we are allowed to resize the widget, make the
480 size the same as the text dimensions. */ 494 size the same as the text dimensions. */
481 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), 495 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
482 IMAGE_INSTANCE_WIDGET_FACE (ii), 496 IMAGE_INSTANCE_WIDGET_FACE (ii),
483 &w, &h, 0, domain); 497 &w, &h, domain);
484 /* Adjust the size for borders. */ 498 /* Adjust the size for borders. */
485 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) 499 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
486 *width = w + 2 * WIDGET_BORDER_WIDTH; 500 *width = w + 2 * WIDGET_BORDER_WIDTH;
487 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)) 501 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
488 *height = h + 2 * WIDGET_BORDER_HEIGHT; 502 *height = h + 2 * WIDGET_BORDER_HEIGHT;
771 int* width, int* height, 785 int* width, int* height,
772 enum image_instance_geometry disp, Lisp_Object domain) 786 enum image_instance_geometry disp, Lisp_Object domain)
773 { 787 {
774 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 788 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
775 int w, h; 789 int w, h;
776 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), 790 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
777 IMAGE_INSTANCE_WIDGET_FACE (ii), 791 IMAGE_INSTANCE_WIDGET_FACE (ii),
778 &w, &h, 0, domain); 792 &w, &h, domain);
779 /* Adjust the size for borders. */ 793 /* Adjust the size for borders. */
780 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) 794 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
781 { 795 {
782 *width = w + 2 * WIDGET_BORDER_WIDTH; 796 *width = w + 2 * WIDGET_BORDER_WIDTH;
783 797
802 816
803 817
804 if (*width) 818 if (*width)
805 { 819 {
806 /* #### what should this be. reconsider when X has tree views. */ 820 /* #### what should this be. reconsider when X has tree views. */
807 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), 821 widget_query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
808 IMAGE_INSTANCE_WIDGET_FACE (ii), 822 IMAGE_INSTANCE_WIDGET_FACE (ii),
809 width, 0, 0, domain); 823 width, 0, domain);
810 } 824 }
811 if (*height) 825 if (*height)
812 { 826 {
813 int len, h; 827 int len, h;
814 default_face_font_info (domain, 0, 0, &h, 0, 0); 828 default_face_font_info (domain, 0, 0, &h, 0, 0);
831 845
832 LIST_LOOP (rest, items) 846 LIST_LOOP (rest, items)
833 { 847 {
834 int h, w; 848 int h, w;
835 849
836 query_string_geometry (XGUI_ITEM (XCAR (rest))->name, 850 widget_query_string_geometry (XGUI_ITEM (XCAR (rest))->name,
837 IMAGE_INSTANCE_WIDGET_FACE (ii), 851 IMAGE_INSTANCE_WIDGET_FACE (ii),
838 &w, &h, 0, domain); 852 &w, &h, domain);
839 tw += 5 * WIDGET_BORDER_WIDTH; /* some bias */ 853 tw += 5 * WIDGET_BORDER_WIDTH; /* some bias */
840 tw += w; 854 tw += w;
841 th = max (th, h + 2 * WIDGET_BORDER_HEIGHT); 855 th = max (th, h + 2 * WIDGET_BORDER_HEIGHT);
842 } 856 }
843 857