2 grid-line-interface.cc -- implement Grid_line_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "group-interface.hh"
11 #include "output-def.hh"
14 #include "grid-line-interface.hh"
18 MAKE_SCHEME_CALLBACK (Grid_line_interface, print, 1);
20 Grid_line_interface::print (SCM smobbed_me)
22 Grob *me = unsmob_grob (smobbed_me);
23 SCM first_elt = me->get_property ("elements");
25 /* compute common refpoint of elements */
26 Grob *refp = common_refpoint_of_list (first_elt, me, Y_AXIS);
29 for (SCM elts = first_elt; scm_is_pair (elts); elts = scm_cdr (elts))
31 Grob *point = unsmob_grob (scm_car (elts));
33 iv.unite (point->extent (refp, Y_AXIS));
42 Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
43 Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
47 iv += - me->relative_coordinate (refp, Y_AXIS);
48 Stencil st = Lookup::filled_box (Box (Interval (0, thick),
51 return st.smobbed_copy ();
54 MAKE_SCHEME_CALLBACK (Grid_line_interface, width_callback, 2);
56 Grid_line_interface::width_callback (SCM element_smob, SCM scm_axis)
58 Grob *me = unsmob_grob (element_smob);
60 assert (scm_to_int (scm_axis) == X_AXIS);
62 Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
63 Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
66 return ly_interval2scm (Interval (0, thick));
70 Grid_line_interface::add_grid_point (Grob *me, Grob *b)
72 Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), b);
73 me->add_dependency (b);
76 ADD_INTERFACE (Grid_line_interface, "grid-line-interface",
77 "A line that spanned between grid-points. ",
78 "elements thickness");
81 ADD_INTERFACE (Grid_point_interface, "grid-point-interface",
82 "A spanning point for grid lines. ",