2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2005--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "grid-line-interface.hh"
23 #include "pointer-group-interface.hh"
25 #include "output-def.hh"
27 MAKE_SCHEME_CALLBACK (Grid_line_interface
, print
, 1);
29 Grid_line_interface::print (SCM smobbed_me
)
31 Grob
*me
= unsmob_grob (smobbed_me
);
33 extract_grob_set (me
, "elements", elts
);
34 /* compute common refpoint of elements */
35 Grob
*refp
= common_refpoint_of_array (elts
, me
, Y_AXIS
);
38 for (vsize i
= 0; i
< elts
.size (); i
++)
40 Grob
*point
= elts
[i
];
42 iv
.unite (point
->extent (refp
, Y_AXIS
));
51 Real staffline
= me
->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
52 Real thick
= robust_scm2double (me
->get_property ("thickness"), 1.0)
55 iv
+= -me
->relative_coordinate (refp
, Y_AXIS
);
56 Stencil st
= Lookup::filled_box (Box (Interval (0, thick
),
59 return st
.smobbed_copy ();
62 MAKE_SCHEME_CALLBACK (Grid_line_interface
, width
, 1);
64 Grid_line_interface::width (SCM smob
)
66 Grob
*me
= unsmob_grob (smob
);
68 Real staffline
= me
->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
69 Real thick
= robust_scm2double (me
->get_property ("thickness"), 1.0)
72 return ly_interval2scm (Interval (0, thick
));
76 Grid_line_interface::add_grid_point (Grob
*me
, Grob
*b
)
78 Pointer_group_interface::add_grob (me
, ly_symbol2scm ("elements"), b
);
81 ADD_INTERFACE (Grid_line_interface
,
82 "A line that is spanned between grid-points.",
89 ADD_INTERFACE (Grid_point_interface
,
90 "A spanning point for grid lines.",