2 grid-line-interface.cc -- implement Grid_line_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "grid-line-interface.hh"
12 #include "pointer-group-interface.hh"
14 #include "output-def.hh"
16 MAKE_SCHEME_CALLBACK (Grid_line_interface
, print
, 1);
18 Grid_line_interface::print (SCM smobbed_me
)
20 Grob
*me
= unsmob_grob (smobbed_me
);
22 extract_grob_set (me
, "elements", elts
);
23 /* compute common refpoint of elements */
24 Grob
*refp
= common_refpoint_of_array (elts
, me
, Y_AXIS
);
27 for (vsize i
= 0; i
< elts
.size (); i
++)
29 Grob
*point
= elts
[i
];
31 iv
.unite (point
->extent (refp
, Y_AXIS
));
40 Real staffline
= me
->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
41 Real thick
= robust_scm2double (me
->get_property ("thickness"), 1.0)
44 iv
+= -me
->relative_coordinate (refp
, Y_AXIS
);
45 Stencil st
= Lookup::filled_box (Box (Interval (0, thick
),
48 return st
.smobbed_copy ();
51 MAKE_SCHEME_CALLBACK (Grid_line_interface
, width
, 1);
53 Grid_line_interface::width (SCM smob
)
55 Grob
*me
= unsmob_grob (smob
);
57 Real staffline
= me
->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
58 Real thick
= robust_scm2double (me
->get_property ("thickness"), 1.0)
61 return ly_interval2scm (Interval (0, thick
));
65 Grid_line_interface::add_grid_point (Grob
*me
, Grob
*b
)
67 Pointer_group_interface::add_grob (me
, ly_symbol2scm ("elements"), b
);
70 ADD_INTERFACE (Grid_line_interface
,
71 "A line that is spanned between grid-points.",
78 ADD_INTERFACE (Grid_point_interface
,
79 "A spanning point for grid lines.",