2 rest.cc -- implement Rest
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "paper-def.hh"
14 #include "paper-score.hh"
15 #include "staff-symbol-referencer.hh"
18 MAKE_SCHEME_CALLBACK(Rest
,after_line_breaking
);
20 Rest::after_line_breaking (SCM smob
)
22 Score_element
*me
= unsmob_element (smob
);
23 int bt
= gh_scm2int (me
->get_elt_property ("duration-log"));
27 me
->translate_axis (Staff_symbol_referencer::staff_space (me
) , Y_AXIS
);
30 Score_element
* d
= unsmob_element (me
->get_elt_property ("dot"));
31 if (d
&& bt
> 4) // UGH.
33 d
->set_elt_property ("staff-position",
34 gh_int2scm ((bt
== 7) ? 4 : 3));
41 MAKE_SCHEME_CALLBACK(Rest
,brew_molecule
)
43 Rest::brew_molecule (SCM smob
)
45 Score_element
* me
= unsmob_element (smob
);
49 SCM balltype
= me
->get_elt_property ("duration-log");
51 if (balltype
== gh_int2scm (0) || balltype
== gh_int2scm (1))
53 int sz
= Staff_symbol_referencer::line_count (me
);
54 Real dif
= abs(Staff_symbol_referencer::position_f (me
) - (2* gh_scm2int (balltype
) - 1));
59 SCM style_sym
=me
->get_elt_property ("style");
60 if (gh_scm2int (balltype
) >= 2 && gh_string_p (style_sym
))
62 style
= ly_scm2string (style_sym
);
65 String idx
= ("rests-") + to_str (gh_scm2int (balltype
))
66 + (ledger_b
? "o" : "") + style
;
68 return me
-> lookup_l ()->afm_find (idx
).create_scheme();
73 Rest::has_interface (Score_element
*m
)
75 return m
&& m
->has_interface (ly_symbol2scm ("rest-interface"));