lilypond-1.3.67
[lilypond.git] / lily / staff-symbol.cc
blobae2167d98861ea3fc07ea8196aa61ed2d5d229f3
1 /*
2 staffsym.cc -- implement Staff_symbol
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #include "staff-symbol.hh"
9 #include "lookup.hh"
10 #include "dimensions.hh"
11 #include "paper-def.hh"
12 #include "molecule.hh"
13 #include "debug.hh"
14 #include "item.hh"
19 GLUE_SCORE_ELEMENT(Staff_symbol,brew_molecule);
21 SCM
22 Staff_symbol::member_brew_molecule () const
24 Score_element * common
25 = get_bound (LEFT)->common_refpoint (get_bound (RIGHT), X_AXIS);
27 Real width =
28 // right_shift - left_shift
29 + get_bound (RIGHT)->relative_coordinate (common , X_AXIS)
30 - get_bound (LEFT)->relative_coordinate (common, X_AXIS)
33 Real t = paper_l ()->get_var ("stafflinethickness");
34 int l = line_count ();
36 Real height = (l-1) * staff_space () /2;
37 Molecule m;
38 for (int i=0; i < l; i++)
40 Molecule a =
41 lookup_l ()->filledbox (Box (Interval (0,width),
42 Interval (-t/2, t/2)));
44 a.translate_axis (height - i * staff_space (), Y_AXIS);
45 m.add_molecule (a);
48 return m.create_scheme();
51 int
52 Staff_symbol::steps_i() const
54 return line_count () * 2;
57 int
58 Staff_symbol::line_count () const
60 return gh_scm2int (get_elt_property ("line-count"));
63 Real
64 Staff_symbol::staff_space ()const
66 return gh_scm2double (get_elt_property ("staff-space")) *
67 paper_l ()->get_var ("staffspace");
70 Staff_symbol::Staff_symbol( SCM s)
71 : Spanner (s)