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 "grid-line-interface.hh"
13 #include "group-interface.hh"
15 #include "output-def.hh"
19 MAKE_SCHEME_CALLBACK (Grid_line_interface, print, 1);
21 Grid_line_interface::print (SCM smobbed_me)
23 Grob *me = unsmob_grob (smobbed_me);
24 SCM first_elt = me->get_property ("elements");
26 /* compute common refpoint of elements */
27 Grob *refp = common_refpoint_of_list (first_elt, me, Y_AXIS);
30 for (SCM elts = first_elt; scm_is_pair (elts); elts = scm_cdr (elts))
32 Grob *point = unsmob_grob (scm_car (elts));
34 iv.unite (point->extent (refp, Y_AXIS));
43 Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
44 Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
48 iv += - me->relative_coordinate (refp, Y_AXIS);
49 Stencil st = Lookup::filled_box (Box (Interval (0, thick),
52 return st.smobbed_copy ();
55 MAKE_SCHEME_CALLBACK (Grid_line_interface, width_callback, 2);
57 Grid_line_interface::width_callback (SCM element_smob, SCM scm_axis)
59 Grob *me = unsmob_grob (element_smob);
61 assert (scm_to_int (scm_axis) == X_AXIS);
63 Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
64 Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
67 return ly_interval2scm (Interval (0, thick));
71 Grid_line_interface::add_grid_point (Grob *me, Grob *b)
73 Pointer_group_interface::add_grob (me, ly_symbol2scm ("elements"), b);
74 me->add_dependency (b);
77 ADD_INTERFACE (Grid_line_interface, "grid-line-interface",
78 "A line that spanned between grid-points. ",
79 "elements thickness");
82 ADD_INTERFACE (Grid_point_interface, "grid-point-interface",
83 "A spanning point for grid lines. ",