X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Ftoolbar.c;h=9d20a82056d0ad43d3ea491bc16e5184eace7be3;hb=271acd90197bb3d7729152e2f3922c4e93bd85b2;hp=31732afe17554f42f8a81f7fc625672818056963;hpb=ea1ea793fe6e244ef5555ed983423a204101af13;p=chise%2Fxemacs-chise.git diff --git a/src/toolbar.c b/src/toolbar.c index 31732af..9d20a82 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -73,24 +73,8 @@ mark_toolbar_button (Lisp_Object obj) return data->help_string; } -static void -print_toolbar_button (Lisp_Object obj, Lisp_Object printcharfun, - int escapeflag) -{ - struct toolbar_button *tb = XTOOLBAR_BUTTON (obj); - char buf[100]; - - if (print_readably) - error ("printing unreadable object #", - tb->header.uid); - - sprintf (buf, "#", tb->header.uid); - write_c_string (buf, printcharfun); -} - DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button, - mark_toolbar_button, print_toolbar_button, - 0, 0, 0, 0, + mark_toolbar_button, 0, 0, 0, 0, 0, struct toolbar_button); DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /* @@ -722,10 +706,10 @@ set_frame_toolbar (struct frame *f, enum toolbar_pos pos) static void compute_frame_toolbars_data (struct frame *f) { - set_frame_toolbar (f, TOP_TOOLBAR); - set_frame_toolbar (f, BOTTOM_TOOLBAR); - set_frame_toolbar (f, LEFT_TOOLBAR); - set_frame_toolbar (f, RIGHT_TOOLBAR); + set_frame_toolbar (f, TOP_TOOLBAR); + set_frame_toolbar (f, BOTTOM_TOOLBAR); + set_frame_toolbar (f, LEFT_TOOLBAR); + set_frame_toolbar (f, RIGHT_TOOLBAR); } void @@ -737,7 +721,7 @@ update_frame_toolbars (struct frame *f) && (f->toolbar_changed || f->frame_changed || f->clear)) { int pos; - + /* We're not officially "in redisplay", so we still have a chance to re-layout toolbars and windows. This is done here, because toolbar is the only thing which currently might @@ -1006,11 +990,11 @@ Verify the syntax of entry BUTTON in a toolbar description list. If you want to verify the syntax of a toolbar description list as a whole, use `check-valid-instantiator' with a specifier type of 'toolbar. */ - (button, no_error)) + (button, noerror)) { Lisp_Object *elt, glyphs, value; int len; - Error_behavior errb = decode_error_behavior_flag (no_error); + Error_behavior errb = decode_error_behavior_flag (noerror); if (!VECTORP (button)) CTB_ERROR ("toolbar button descriptors must be vectors"); @@ -1037,9 +1021,9 @@ whole, use `check-valid-instantiator' with a specifier type of 'toolbar. if (!CONSP (elt[0])) { /* We can't check the buffer-local here because we don't know - which buffer to check in. #### I think this is a bad thing. - See if we can't get enough information to this function so - that it can check. + which buffer to check in. #### I think this is a bad thing. + See if we can't get enough information to this function so + that it can check. #### Wrong. We shouldn't be checking the value at all here. The user might set or change the value at any time. */ @@ -1160,14 +1144,9 @@ toolbar_after_change (Lisp_Object specifier, Lisp_Object locale) DEFUN ("toolbar-specifier-p", Ftoolbar_specifier_p, 1, 1, 0, /* Return non-nil if OBJECT is a toolbar specifier. -Toolbar specifiers are used to specify the format of a toolbar. -The values of the variables `default-toolbar', `top-toolbar', -`left-toolbar', `right-toolbar', and `bottom-toolbar' are always -toolbar specifiers. - -Valid toolbar instantiators are called "toolbar descriptors" -and are lists of vectors. See `default-toolbar' for a description -of the exact format. + +See `make-toolbar-specifier' for a description of possible toolbar +instantiators. */ (object)) { @@ -1272,6 +1251,8 @@ toolbar_buttons_captioned_p_changed (Lisp_Object specifier, struct window *w, void syms_of_toolbar (void) { + INIT_LRECORD_IMPLEMENTATION (toolbar_button); + defsymbol (&Qtoolbar_buttonp, "toolbar-button-p"); defsymbol (&Q2D, "2D"); defsymbol (&Q3D, "3D"); @@ -1434,10 +1415,9 @@ For the other vector formats (specifying blank areas of the toolbar): automatically knew about specifier fallbacks, so we didn't have to do it ourselves. */ set_specifier_caching (Vdefault_toolbar, - slot_offset (struct window, - default_toolbar), + offsetof (struct window, default_toolbar), default_toolbar_specs_changed, - 0, 0); + 0, 0, 0); DEFVAR_SPECIFIER ("top-toolbar", &Vtoolbar[TOP_TOOLBAR] /* @@ -1447,10 +1427,9 @@ See `default-toolbar' for a description of a valid toolbar instantiator. */ ); Vtoolbar[TOP_TOOLBAR] = Fmake_specifier (Qtoolbar); set_specifier_caching (Vtoolbar[TOP_TOOLBAR], - slot_offset (struct window, - toolbar[TOP_TOOLBAR]), + offsetof (struct window, toolbar[TOP_TOOLBAR]), toolbar_specs_changed, - 0, 0); + 0, 0, 0); DEFVAR_SPECIFIER ("bottom-toolbar", &Vtoolbar[BOTTOM_TOOLBAR] /* @@ -1465,10 +1444,9 @@ displayed even if you provide a value for `bottom-toolbar'. */ ); Vtoolbar[BOTTOM_TOOLBAR] = Fmake_specifier (Qtoolbar); set_specifier_caching (Vtoolbar[BOTTOM_TOOLBAR], - slot_offset (struct window, - toolbar[BOTTOM_TOOLBAR]), + offsetof (struct window, toolbar[BOTTOM_TOOLBAR]), toolbar_specs_changed, - 0, 0); + 0, 0, 0); DEFVAR_SPECIFIER ("left-toolbar", &Vtoolbar[LEFT_TOOLBAR] /* @@ -1483,10 +1461,9 @@ displayed even if you provide a value for `left-toolbar'. */ ); Vtoolbar[LEFT_TOOLBAR] = Fmake_specifier (Qtoolbar); set_specifier_caching (Vtoolbar[LEFT_TOOLBAR], - slot_offset (struct window, - toolbar[LEFT_TOOLBAR]), + offsetof (struct window, toolbar[LEFT_TOOLBAR]), toolbar_specs_changed, - 0, 0); + 0, 0, 0); DEFVAR_SPECIFIER ("right-toolbar", &Vtoolbar[RIGHT_TOOLBAR] /* @@ -1501,10 +1478,9 @@ displayed even if you provide a value for `right-toolbar'. */ ); Vtoolbar[RIGHT_TOOLBAR] = Fmake_specifier (Qtoolbar); set_specifier_caching (Vtoolbar[RIGHT_TOOLBAR], - slot_offset (struct window, - toolbar[RIGHT_TOOLBAR]), + offsetof (struct window, toolbar[RIGHT_TOOLBAR]), toolbar_specs_changed, - 0, 0); + 0, 0, 0); /* initially, top inherits from default; this can be changed with `set-default-toolbar-position'. */ @@ -1556,12 +1532,10 @@ is not visible, so it is expanded to take up the slack. */ ); Vdefault_toolbar_height = Fmake_specifier (Qnatnum); set_specifier_caching (Vdefault_toolbar_height, - slot_offset (struct window, - default_toolbar_height), + offsetof (struct window, default_toolbar_height), default_toolbar_size_changed_in_window, - slot_offset (struct frame, - default_toolbar_height), - default_toolbar_size_changed_in_frame); + offsetof (struct frame, default_toolbar_height), + default_toolbar_size_changed_in_frame, 0); DEFVAR_SPECIFIER ("default-toolbar-width", &Vdefault_toolbar_width /* *Width of the default toolbar, if it's oriented vertically. @@ -1571,12 +1545,10 @@ See `default-toolbar-height' for more information. */ ); Vdefault_toolbar_width = Fmake_specifier (Qnatnum); set_specifier_caching (Vdefault_toolbar_width, - slot_offset (struct window, - default_toolbar_width), + offsetof (struct window, default_toolbar_width), default_toolbar_size_changed_in_window, - slot_offset (struct frame, - default_toolbar_width), - default_toolbar_size_changed_in_frame); + offsetof (struct frame, default_toolbar_width), + default_toolbar_size_changed_in_frame, 0); DEFVAR_SPECIFIER ("top-toolbar-height", &Vtoolbar_size[TOP_TOOLBAR] /* @@ -1587,12 +1559,10 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_size[TOP_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_size[TOP_TOOLBAR], - slot_offset (struct window, - toolbar_size[TOP_TOOLBAR]), + offsetof (struct window, toolbar_size[TOP_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_size[TOP_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, toolbar_size[TOP_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("bottom-toolbar-height", &Vtoolbar_size[BOTTOM_TOOLBAR] /* @@ -1603,12 +1573,10 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_size[BOTTOM_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_size[BOTTOM_TOOLBAR], - slot_offset (struct window, - toolbar_size[BOTTOM_TOOLBAR]), + offsetof (struct window, toolbar_size[BOTTOM_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_size[BOTTOM_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, toolbar_size[BOTTOM_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("left-toolbar-width", &Vtoolbar_size[LEFT_TOOLBAR] /* @@ -1619,12 +1587,10 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_size[LEFT_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_size[LEFT_TOOLBAR], - slot_offset (struct window, - toolbar_size[LEFT_TOOLBAR]), + offsetof (struct window, toolbar_size[LEFT_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_size[LEFT_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, toolbar_size[LEFT_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("right-toolbar-width", &Vtoolbar_size[RIGHT_TOOLBAR] /* @@ -1635,12 +1601,10 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_size[RIGHT_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_size[RIGHT_TOOLBAR], - slot_offset (struct window, - toolbar_size[RIGHT_TOOLBAR]), + offsetof (struct window, toolbar_size[RIGHT_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_size[RIGHT_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, toolbar_size[RIGHT_TOOLBAR]), + frame_size_slipped, 0); fb = Qnil; #ifdef HAVE_TTY @@ -1650,7 +1614,7 @@ See `default-toolbar-height' for more information. fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb); #endif #ifdef HAVE_MS_WINDOWS - fb = Fcons (Fcons (list1 (Qmswindows), + fb = Fcons (Fcons (list1 (Qmswindows), make_int (MSWINDOWS_DEFAULT_TOOLBAR_HEIGHT)), fb); #endif if (!NILP (fb)) @@ -1664,7 +1628,7 @@ See `default-toolbar-height' for more information. fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), fb); #endif #ifdef HAVE_MS_WINDOWS - fb = Fcons (Fcons (list1 (Qmswindows), + fb = Fcons (Fcons (list1 (Qmswindows), make_int (MSWINDOWS_DEFAULT_TOOLBAR_WIDTH)), fb); #endif if (!NILP (fb)) @@ -1700,12 +1664,10 @@ the value in a window domain will not. */ ); Vdefault_toolbar_border_width = Fmake_specifier (Qnatnum); set_specifier_caching (Vdefault_toolbar_border_width, - slot_offset (struct window, - default_toolbar_border_width), + offsetof (struct window, default_toolbar_border_width), default_toolbar_border_width_changed_in_window, - slot_offset (struct frame, - default_toolbar_border_width), - default_toolbar_border_width_changed_in_frame); + offsetof (struct frame, default_toolbar_border_width), + default_toolbar_border_width_changed_in_frame, 0); DEFVAR_SPECIFIER ("top-toolbar-border-width", &Vtoolbar_border_width[TOP_TOOLBAR] /* @@ -1716,12 +1678,12 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_border_width[TOP_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_border_width[TOP_TOOLBAR], - slot_offset (struct window, - toolbar_border_width[TOP_TOOLBAR]), + offsetof (struct window, + toolbar_border_width[TOP_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_border_width[TOP_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_border_width[TOP_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("bottom-toolbar-border-width", &Vtoolbar_border_width[BOTTOM_TOOLBAR] /* @@ -1732,12 +1694,12 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_border_width[BOTTOM_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_border_width[BOTTOM_TOOLBAR], - slot_offset (struct window, - toolbar_border_width[BOTTOM_TOOLBAR]), + offsetof (struct window, + toolbar_border_width[BOTTOM_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_border_width[BOTTOM_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_border_width[BOTTOM_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("left-toolbar-border-width", &Vtoolbar_border_width[LEFT_TOOLBAR] /* @@ -1748,12 +1710,12 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_border_width[LEFT_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_border_width[LEFT_TOOLBAR], - slot_offset (struct window, - toolbar_border_width[LEFT_TOOLBAR]), + offsetof (struct window, + toolbar_border_width[LEFT_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_border_width[LEFT_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_border_width[LEFT_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("right-toolbar-border-width", &Vtoolbar_border_width[RIGHT_TOOLBAR] /* @@ -1764,12 +1726,12 @@ See `default-toolbar-height' for more information. */ ); Vtoolbar_border_width[RIGHT_TOOLBAR] = Fmake_specifier (Qnatnum); set_specifier_caching (Vtoolbar_border_width[RIGHT_TOOLBAR], - slot_offset (struct window, - toolbar_border_width[RIGHT_TOOLBAR]), + offsetof (struct window, + toolbar_border_width[RIGHT_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_border_width[RIGHT_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_border_width[RIGHT_TOOLBAR]), + frame_size_slipped, 0); fb = Qnil; #ifdef HAVE_TTY @@ -1812,12 +1774,10 @@ visibility specifiers have a fallback value of true. */ ); Vdefault_toolbar_visible_p = Fmake_specifier (Qboolean); set_specifier_caching (Vdefault_toolbar_visible_p, - slot_offset (struct window, - default_toolbar_visible_p), + offsetof (struct window, default_toolbar_visible_p), default_toolbar_visible_p_changed_in_window, - slot_offset (struct frame, - default_toolbar_visible_p), - default_toolbar_visible_p_changed_in_frame); + offsetof (struct frame, default_toolbar_visible_p), + default_toolbar_visible_p_changed_in_frame, 0); DEFVAR_SPECIFIER ("top-toolbar-visible-p", &Vtoolbar_visible_p[TOP_TOOLBAR] /* @@ -1828,12 +1788,12 @@ See `default-toolbar-visible-p' for more information. */ ); Vtoolbar_visible_p[TOP_TOOLBAR] = Fmake_specifier (Qboolean); set_specifier_caching (Vtoolbar_visible_p[TOP_TOOLBAR], - slot_offset (struct window, - toolbar_visible_p[TOP_TOOLBAR]), + offsetof (struct window, + toolbar_visible_p[TOP_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_visible_p[TOP_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_visible_p[TOP_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("bottom-toolbar-visible-p", &Vtoolbar_visible_p[BOTTOM_TOOLBAR] /* @@ -1844,12 +1804,12 @@ See `default-toolbar-visible-p' for more information. */ ); Vtoolbar_visible_p[BOTTOM_TOOLBAR] = Fmake_specifier (Qboolean); set_specifier_caching (Vtoolbar_visible_p[BOTTOM_TOOLBAR], - slot_offset (struct window, - toolbar_visible_p[BOTTOM_TOOLBAR]), + offsetof (struct window, + toolbar_visible_p[BOTTOM_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_visible_p[BOTTOM_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_visible_p[BOTTOM_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("left-toolbar-visible-p", &Vtoolbar_visible_p[LEFT_TOOLBAR] /* @@ -1860,12 +1820,12 @@ See `default-toolbar-visible-p' for more information. */ ); Vtoolbar_visible_p[LEFT_TOOLBAR] = Fmake_specifier (Qboolean); set_specifier_caching (Vtoolbar_visible_p[LEFT_TOOLBAR], - slot_offset (struct window, - toolbar_visible_p[LEFT_TOOLBAR]), + offsetof (struct window, + toolbar_visible_p[LEFT_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_visible_p[LEFT_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_visible_p[LEFT_TOOLBAR]), + frame_size_slipped, 0); DEFVAR_SPECIFIER ("right-toolbar-visible-p", &Vtoolbar_visible_p[RIGHT_TOOLBAR] /* @@ -1876,12 +1836,12 @@ See `default-toolbar-visible-p' for more information. */ ); Vtoolbar_visible_p[RIGHT_TOOLBAR] = Fmake_specifier (Qboolean); set_specifier_caching (Vtoolbar_visible_p[RIGHT_TOOLBAR], - slot_offset (struct window, - toolbar_visible_p[RIGHT_TOOLBAR]), + offsetof (struct window, + toolbar_visible_p[RIGHT_TOOLBAR]), toolbar_geometry_changed_in_window, - slot_offset (struct frame, - toolbar_visible_p[RIGHT_TOOLBAR]), - frame_size_slipped); + offsetof (struct frame, + toolbar_visible_p[RIGHT_TOOLBAR]), + frame_size_slipped, 0); /* initially, top inherits from default; this can be changed with `set-default-toolbar-position'. */ @@ -1902,10 +1862,9 @@ This is a specifier; use `set-specifier' to change it. */ ); Vtoolbar_buttons_captioned_p = Fmake_specifier (Qboolean); set_specifier_caching (Vtoolbar_buttons_captioned_p, - slot_offset (struct window, - toolbar_buttons_captioned_p), + offsetof (struct window, toolbar_buttons_captioned_p), toolbar_buttons_captioned_p_changed, - 0, 0); + 0, 0, 0); set_specifier_fallback (Vtoolbar_buttons_captioned_p, list1 (Fcons (Qnil, Qt))); }