comparison src/toolbar.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 84b14dcb0985
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
71 mark_object (data->callback); 71 mark_object (data->callback);
72 mark_object (data->enabled_p); 72 mark_object (data->enabled_p);
73 return data->help_string; 73 return data->help_string;
74 } 74 }
75 75
76 static void
77 print_toolbar_button (Lisp_Object obj, Lisp_Object printcharfun,
78 int escapeflag)
79 {
80 struct toolbar_button *tb = XTOOLBAR_BUTTON (obj);
81 char buf[100];
82
83 if (print_readably)
84 error ("printing unreadable object #<toolbar-button 0x%x>",
85 tb->header.uid);
86
87 sprintf (buf, "#<toolbar-button 0x%x>", tb->header.uid);
88 write_c_string (buf, printcharfun);
89 }
90
91 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button, 76 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button,
92 mark_toolbar_button, print_toolbar_button, 77 mark_toolbar_button, 0, 0, 0, 0, 0,
93 0, 0, 0, 0,
94 struct toolbar_button); 78 struct toolbar_button);
95 79
96 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /* 80 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /*
97 Return non-nil if OBJECT is a toolbar button. 81 Return non-nil if OBJECT is a toolbar button.
98 */ 82 */
720 } 704 }
721 705
722 static void 706 static void
723 compute_frame_toolbars_data (struct frame *f) 707 compute_frame_toolbars_data (struct frame *f)
724 { 708 {
725 set_frame_toolbar (f, TOP_TOOLBAR); 709 set_frame_toolbar (f, TOP_TOOLBAR);
726 set_frame_toolbar (f, BOTTOM_TOOLBAR); 710 set_frame_toolbar (f, BOTTOM_TOOLBAR);
727 set_frame_toolbar (f, LEFT_TOOLBAR); 711 set_frame_toolbar (f, LEFT_TOOLBAR);
728 set_frame_toolbar (f, RIGHT_TOOLBAR); 712 set_frame_toolbar (f, RIGHT_TOOLBAR);
729 } 713 }
730 714
731 void 715 void
732 update_frame_toolbars (struct frame *f) 716 update_frame_toolbars (struct frame *f)
733 { 717 {
735 719
736 if (DEVICE_SUPPORTS_TOOLBARS_P (d) 720 if (DEVICE_SUPPORTS_TOOLBARS_P (d)
737 && (f->toolbar_changed || f->frame_changed || f->clear)) 721 && (f->toolbar_changed || f->frame_changed || f->clear))
738 { 722 {
739 int pos; 723 int pos;
740 724
741 /* We're not officially "in redisplay", so we still have a 725 /* We're not officially "in redisplay", so we still have a
742 chance to re-layout toolbars and windows. This is done here, 726 chance to re-layout toolbars and windows. This is done here,
743 because toolbar is the only thing which currently might 727 because toolbar is the only thing which currently might
744 necessitate this layout, as it is outside any windows. We 728 necessitate this layout, as it is outside any windows. We
745 take care not to change size if toolbar geometry is really 729 take care not to change size if toolbar geometry is really
1035 the sixth for the captioned disabled state. Only the up state is 1019 the sixth for the captioned disabled state. Only the up state is
1036 mandatory. */ 1020 mandatory. */
1037 if (!CONSP (elt[0])) 1021 if (!CONSP (elt[0]))
1038 { 1022 {
1039 /* We can't check the buffer-local here because we don't know 1023 /* We can't check the buffer-local here because we don't know
1040 which buffer to check in. #### I think this is a bad thing. 1024 which buffer to check in. #### I think this is a bad thing.
1041 See if we can't get enough information to this function so 1025 See if we can't get enough information to this function so
1042 that it can check. 1026 that it can check.
1043 1027
1044 #### Wrong. We shouldn't be checking the value at all here. 1028 #### Wrong. We shouldn't be checking the value at all here.
1045 The user might set or change the value at any time. */ 1029 The user might set or change the value at any time. */
1046 value = Fsymbol_value (elt[0]); 1030 value = Fsymbol_value (elt[0]);
1047 1031
1158 MARK_TOOLBAR_CHANGED; 1142 MARK_TOOLBAR_CHANGED;
1159 } 1143 }
1160 1144
1161 DEFUN ("toolbar-specifier-p", Ftoolbar_specifier_p, 1, 1, 0, /* 1145 DEFUN ("toolbar-specifier-p", Ftoolbar_specifier_p, 1, 1, 0, /*
1162 Return non-nil if OBJECT is a toolbar specifier. 1146 Return non-nil if OBJECT is a toolbar specifier.
1163 Toolbar specifiers are used to specify the format of a toolbar. 1147
1164 The values of the variables `default-toolbar', `top-toolbar', 1148 See `make-toolbar-specifier' for a description of possible toolbar
1165 `left-toolbar', `right-toolbar', and `bottom-toolbar' are always 1149 instantiators.
1166 toolbar specifiers.
1167
1168 Valid toolbar instantiators are called "toolbar descriptors"
1169 and are lists of vectors. See `default-toolbar' for a description
1170 of the exact format.
1171 */ 1150 */
1172 (object)) 1151 (object))
1173 { 1152 {
1174 return TOOLBAR_SPECIFIERP (object) ? Qt : Qnil; 1153 return TOOLBAR_SPECIFIERP (object) ? Qt : Qnil;
1175 } 1154 }
1270 1249
1271 1250
1272 void 1251 void
1273 syms_of_toolbar (void) 1252 syms_of_toolbar (void)
1274 { 1253 {
1254 INIT_LRECORD_IMPLEMENTATION (toolbar_button);
1255
1275 defsymbol (&Qtoolbar_buttonp, "toolbar-button-p"); 1256 defsymbol (&Qtoolbar_buttonp, "toolbar-button-p");
1276 defsymbol (&Q2D, "2D"); 1257 defsymbol (&Q2D, "2D");
1277 defsymbol (&Q3D, "3D"); 1258 defsymbol (&Q3D, "3D");
1278 defsymbol (&Q2d, "2d"); 1259 defsymbol (&Q2d, "2d");
1279 defsymbol (&Q3d, "3d"); 1260 defsymbol (&Q3d, "3d");
1631 #endif 1612 #endif
1632 #ifdef HAVE_X_WINDOWS 1613 #ifdef HAVE_X_WINDOWS
1633 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb); 1614 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb);
1634 #endif 1615 #endif
1635 #ifdef HAVE_MS_WINDOWS 1616 #ifdef HAVE_MS_WINDOWS
1636 fb = Fcons (Fcons (list1 (Qmswindows), 1617 fb = Fcons (Fcons (list1 (Qmswindows),
1637 make_int (MSWINDOWS_DEFAULT_TOOLBAR_HEIGHT)), fb); 1618 make_int (MSWINDOWS_DEFAULT_TOOLBAR_HEIGHT)), fb);
1638 #endif 1619 #endif
1639 if (!NILP (fb)) 1620 if (!NILP (fb))
1640 set_specifier_fallback (Vdefault_toolbar_height, fb); 1621 set_specifier_fallback (Vdefault_toolbar_height, fb);
1641 1622
1645 #endif 1626 #endif
1646 #ifdef HAVE_X_WINDOWS 1627 #ifdef HAVE_X_WINDOWS
1647 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), fb); 1628 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), fb);
1648 #endif 1629 #endif
1649 #ifdef HAVE_MS_WINDOWS 1630 #ifdef HAVE_MS_WINDOWS
1650 fb = Fcons (Fcons (list1 (Qmswindows), 1631 fb = Fcons (Fcons (list1 (Qmswindows),
1651 make_int (MSWINDOWS_DEFAULT_TOOLBAR_WIDTH)), fb); 1632 make_int (MSWINDOWS_DEFAULT_TOOLBAR_WIDTH)), fb);
1652 #endif 1633 #endif
1653 if (!NILP (fb)) 1634 if (!NILP (fb))
1654 set_specifier_fallback (Vdefault_toolbar_width, fb); 1635 set_specifier_fallback (Vdefault_toolbar_width, fb);
1655 1636