comparison src/toolbar.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 83b3d10dcba9
children 6330739388db
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
50 Lisp_Object Vtoolbar_buttons_captioned_p; 50 Lisp_Object Vtoolbar_buttons_captioned_p;
51 51
52 Lisp_Object Qtoolbar_buttonp; 52 Lisp_Object Qtoolbar_buttonp;
53 Lisp_Object Q2D, Q3D, Q2d, Q3d; 53 Lisp_Object Q2D, Q3D, Q2d, Q3d;
54 Lisp_Object Q_size; 54 Lisp_Object Q_size;
55 extern Lisp_Object Q_style; /* defined in menubar.c */
56 55
57 Lisp_Object Qinit_toolbar_from_resources; 56 Lisp_Object Qinit_toolbar_from_resources;
58 57
59 58
60 static Lisp_Object 59 static Lisp_Object
832 831
833 /* If there isn't any output routine, then this device type doesn't 832 /* If there isn't any output routine, then this device type doesn't
834 support toolbars. */ 833 support toolbars. */
835 if (HAS_DEVMETH_P (d, output_frame_toolbars)) 834 if (HAS_DEVMETH_P (d, output_frame_toolbars))
836 { 835 {
837 Lisp_Object frame = Qnil; 836 Lisp_Object frame;
838 837
839 compute_frame_toolbars_data (f, 1); 838 compute_frame_toolbars_data (f, 1);
840 XSETFRAME (frame, f); 839 XSETFRAME (frame, f);
841 call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)), 840 call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)),
842 Qinit_toolbar_from_resources, 841 Qinit_toolbar_from_resources,
846 } 845 }
847 846
848 void 847 void
849 init_device_toolbars (struct device *d) 848 init_device_toolbars (struct device *d)
850 { 849 {
851 Lisp_Object device = Qnil; 850 Lisp_Object device;
852 851
853 XSETDEVICE (device, d); 852 XSETDEVICE (device, d);
854 if (HAS_DEVMETH_P (d, output_frame_toolbars)) 853 if (HAS_DEVMETH_P (d, output_frame_toolbars))
855 call_critical_lisp_code (d, 854 call_critical_lisp_code (d,
856 Qinit_toolbar_from_resources, 855 Qinit_toolbar_from_resources,
1403 } 1402 }
1404 1403
1405 void 1404 void
1406 specifier_vars_of_toolbar (void) 1405 specifier_vars_of_toolbar (void)
1407 { 1406 {
1408 Lisp_Object elt; 1407 Lisp_Object fb;
1409 1408
1410 DEFVAR_SPECIFIER ("default-toolbar", &Vdefault_toolbar /* 1409 DEFVAR_SPECIFIER ("default-toolbar", &Vdefault_toolbar /*
1411 Specifier for a fallback toolbar. 1410 Specifier for a fallback toolbar.
1412 Use `set-specifier' to change this. 1411 Use `set-specifier' to change this.
1413 1412
1591 toolbar_specs_changed, 1590 toolbar_specs_changed,
1592 0, 0); 1591 0, 0);
1593 1592
1594 /* initially, top inherits from default; this can be 1593 /* initially, top inherits from default; this can be
1595 changed with `set-default-toolbar-position'. */ 1594 changed with `set-default-toolbar-position'. */
1596 elt = list1 (Fcons (Qnil, Qnil)); 1595 fb = list1 (Fcons (Qnil, Qnil));
1597 set_specifier_fallback (Vdefault_toolbar, elt); 1596 set_specifier_fallback (Vdefault_toolbar, fb);
1598 set_specifier_fallback (Vtoolbar[TOP_TOOLBAR], Vdefault_toolbar); 1597 set_specifier_fallback (Vtoolbar[TOP_TOOLBAR], Vdefault_toolbar);
1599 set_specifier_fallback (Vtoolbar[BOTTOM_TOOLBAR], elt); 1598 set_specifier_fallback (Vtoolbar[BOTTOM_TOOLBAR], fb);
1600 set_specifier_fallback (Vtoolbar[LEFT_TOOLBAR], elt); 1599 set_specifier_fallback (Vtoolbar[LEFT_TOOLBAR], fb);
1601 set_specifier_fallback (Vtoolbar[RIGHT_TOOLBAR], elt); 1600 set_specifier_fallback (Vtoolbar[RIGHT_TOOLBAR], fb);
1602 1601
1603 DEFVAR_SPECIFIER ("default-toolbar-height", &Vdefault_toolbar_height /* 1602 DEFVAR_SPECIFIER ("default-toolbar-height", &Vdefault_toolbar_height /*
1604 *Height of the default toolbar, if it's oriented horizontally. 1603 *Height of the default toolbar, if it's oriented horizontally.
1605 This is a specifier; use `set-specifier' to change it. 1604 This is a specifier; use `set-specifier' to change it.
1606 1605
1725 some_window_value_changed, 1724 some_window_value_changed,
1726 slot_offset (struct frame, 1725 slot_offset (struct frame,
1727 toolbar_size[RIGHT_TOOLBAR]), 1726 toolbar_size[RIGHT_TOOLBAR]),
1728 toolbar_size_changed_in_frame); 1727 toolbar_size_changed_in_frame);
1729 1728
1730 /* #### this is ugly. */ 1729 fb = Qnil;
1731 /* sb - even uglier to make this work without console tty support, ugh. */
1732 elt = Qnil;
1733 #ifdef HAVE_TTY 1730 #ifdef HAVE_TTY
1734 elt = list1 (Fcons (list1 (Qtty), Qzero)); 1731 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
1735 #endif 1732 #endif
1736 #ifdef HAVE_X_WINDOWS 1733 #ifdef HAVE_X_WINDOWS
1737 if (!EQ(elt, Qnil)) 1734 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb);
1738 elt = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), elt);
1739 else
1740 elt = list1 (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)));
1741 #endif 1735 #endif
1742 if (!EQ(elt, Qnil)) 1736 if (!NILP (fb))
1743 set_specifier_fallback (Vdefault_toolbar_height, elt); 1737 set_specifier_fallback (Vdefault_toolbar_height, fb);
1744 1738
1745 elt = Qnil; 1739 fb = Qnil;
1746 #ifdef HAVE_TTY 1740 #ifdef HAVE_TTY
1747 elt = list1 (Fcons (list1 (Qtty), Qzero)); 1741 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
1748 #endif 1742 #endif
1749 #ifdef HAVE_X_WINDOWS 1743 #ifdef HAVE_X_WINDOWS
1750 if (!EQ(elt, Qnil)) 1744 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), fb);
1751 elt = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), elt);
1752 else
1753 elt = list1 (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)));
1754 #endif 1745 #endif
1755 if (!EQ(elt, Qnil)) 1746 if (!NILP (fb))
1756 set_specifier_fallback (Vdefault_toolbar_width, elt); 1747 set_specifier_fallback (Vdefault_toolbar_width, fb);
1757 1748
1758 set_specifier_fallback (Vtoolbar_size[TOP_TOOLBAR], Vdefault_toolbar_height); 1749 set_specifier_fallback (Vtoolbar_size[TOP_TOOLBAR], Vdefault_toolbar_height);
1759 elt = list1 (Fcons (Qnil, Qzero)); 1750 fb = list1 (Fcons (Qnil, Qzero));
1760 set_specifier_fallback (Vtoolbar_size[BOTTOM_TOOLBAR], elt); 1751 set_specifier_fallback (Vtoolbar_size[BOTTOM_TOOLBAR], fb);
1761 set_specifier_fallback (Vtoolbar_size[LEFT_TOOLBAR], elt); 1752 set_specifier_fallback (Vtoolbar_size[LEFT_TOOLBAR], fb);
1762 set_specifier_fallback (Vtoolbar_size[RIGHT_TOOLBAR], elt); 1753 set_specifier_fallback (Vtoolbar_size[RIGHT_TOOLBAR], fb);
1763 1754
1764 DEFVAR_SPECIFIER ("default-toolbar-border-width", 1755 DEFVAR_SPECIFIER ("default-toolbar-border-width",
1765 &Vdefault_toolbar_border_width /* 1756 &Vdefault_toolbar_border_width /*
1766 *Width of the border around the default toolbar. 1757 *Width of the border around the default toolbar.
1767 This is a specifier; use `set-specifier' to change it. 1758 This is a specifier; use `set-specifier' to change it.
1854 some_window_value_changed, 1845 some_window_value_changed,
1855 slot_offset (struct frame, 1846 slot_offset (struct frame,
1856 toolbar_border_width[RIGHT_TOOLBAR]), 1847 toolbar_border_width[RIGHT_TOOLBAR]),
1857 toolbar_border_width_changed_in_frame); 1848 toolbar_border_width_changed_in_frame);
1858 1849
1859 /* #### this is ugly. */ 1850 fb = Qnil;
1860 /* sb - even uglier to make this work without console tty support, ugh. */
1861 /* not if you get to copy it instead of writing it from scratch. --kyle */
1862 elt = Qnil;
1863 #ifdef HAVE_TTY 1851 #ifdef HAVE_TTY
1864 elt = list1 (Fcons (list1 (Qtty), Qzero)); 1852 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
1865 #endif 1853 #endif
1866 #ifdef HAVE_X_WINDOWS 1854 #ifdef HAVE_X_WINDOWS
1867 if (!EQ(elt, Qnil)) 1855 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_BORDER_WIDTH)), fb);
1868 elt = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_BORDER_WIDTH)), elt);
1869 else
1870 elt = list1 (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_BORDER_WIDTH)));
1871 #endif 1856 #endif
1872 if (!EQ(elt, Qnil)) 1857 if (!NILP (fb))
1873 set_specifier_fallback (Vdefault_toolbar_border_width, elt); 1858 set_specifier_fallback (Vdefault_toolbar_border_width, fb);
1874 1859
1875 set_specifier_fallback (Vtoolbar_border_width[TOP_TOOLBAR], Vdefault_toolbar_border_width); 1860 set_specifier_fallback (Vtoolbar_border_width[TOP_TOOLBAR], Vdefault_toolbar_border_width);
1876 elt = list1 (Fcons (Qnil, Qzero)); 1861 fb = list1 (Fcons (Qnil, Qzero));
1877 set_specifier_fallback (Vtoolbar_border_width[BOTTOM_TOOLBAR], elt); 1862 set_specifier_fallback (Vtoolbar_border_width[BOTTOM_TOOLBAR], fb);
1878 set_specifier_fallback (Vtoolbar_border_width[LEFT_TOOLBAR], elt); 1863 set_specifier_fallback (Vtoolbar_border_width[LEFT_TOOLBAR], fb);
1879 set_specifier_fallback (Vtoolbar_border_width[RIGHT_TOOLBAR], elt); 1864 set_specifier_fallback (Vtoolbar_border_width[RIGHT_TOOLBAR], fb);
1880 1865
1881 DEFVAR_SPECIFIER ("default-toolbar-visible-p", &Vdefault_toolbar_visible_p /* 1866 DEFVAR_SPECIFIER ("default-toolbar-visible-p", &Vdefault_toolbar_visible_p /*
1882 *Whether the default toolbar is visible. 1867 *Whether the default toolbar is visible.
1883 This is a specifier; use `set-specifier' to change it. 1868 This is a specifier; use `set-specifier' to change it.
1884 1869
1971 toolbar_visible_p[RIGHT_TOOLBAR]), 1956 toolbar_visible_p[RIGHT_TOOLBAR]),
1972 toolbar_visible_p_changed_in_frame); 1957 toolbar_visible_p_changed_in_frame);
1973 1958
1974 /* initially, top inherits from default; this can be 1959 /* initially, top inherits from default; this can be
1975 changed with `set-default-toolbar-position'. */ 1960 changed with `set-default-toolbar-position'. */
1976 elt = list1 (Fcons (Qnil, Qt)); 1961 fb = list1 (Fcons (Qnil, Qt));
1977 set_specifier_fallback (Vdefault_toolbar_visible_p, elt); 1962 set_specifier_fallback (Vdefault_toolbar_visible_p, fb);
1978 set_specifier_fallback (Vtoolbar_visible_p[TOP_TOOLBAR], 1963 set_specifier_fallback (Vtoolbar_visible_p[TOP_TOOLBAR],
1979 Vdefault_toolbar_visible_p); 1964 Vdefault_toolbar_visible_p);
1980 set_specifier_fallback (Vtoolbar_visible_p[BOTTOM_TOOLBAR], elt); 1965 set_specifier_fallback (Vtoolbar_visible_p[BOTTOM_TOOLBAR], fb);
1981 set_specifier_fallback (Vtoolbar_visible_p[LEFT_TOOLBAR], elt); 1966 set_specifier_fallback (Vtoolbar_visible_p[LEFT_TOOLBAR], fb);
1982 set_specifier_fallback (Vtoolbar_visible_p[RIGHT_TOOLBAR], elt); 1967 set_specifier_fallback (Vtoolbar_visible_p[RIGHT_TOOLBAR], fb);
1983 1968
1984 DEFVAR_SPECIFIER ("toolbar-buttons-captioned-p", 1969 DEFVAR_SPECIFIER ("toolbar-buttons-captioned-p",
1985 &Vtoolbar_buttons_captioned_p /* 1970 &Vtoolbar_buttons_captioned_p /*
1986 *Whether the toolbar buttons are captioned. 1971 *Whether the toolbar buttons are captioned.
1987 This will only have a visible effect for those toolbar buttons which had 1972 This will only have a visible effect for those toolbar buttons which had