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 GLUE_SCORE_ELEMENT(Rest,after_line_breaking);
20 Rest::member_after_line_breaking ()
22 if (balltype_i () == 0)
24 Staff_symbol_referencer_interface si (this);
25 si.set_position (si.position_f () + 2);
28 if (d && balltype_i () > 4) // UGH.
33 staff_symbol_referencer (d)
34 .set_position ((balltype_i () == 7) ? 4 : 3);
41 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Rest,brew_molecule)
44 Rest::brew_molecule (SCM smob)
46 Score_element* sc = unsmob_element (smob);
50 SCM balltype = sc->get_elt_property ("duration-log");
52 if (balltype == gh_int2scm (0) || balltype == gh_int2scm (1))
54 Staff_symbol_referencer_interface si(sc);
55 ledger_b = abs(si.position_f () - (2* gh_scm2int (balltype) - 1))
60 SCM style_sym =sc->get_elt_property ("style");
61 if (gh_scm2int (balltype) >= 2 && gh_string_p (style_sym))
63 style = ly_scm2string (style_sym);
66 String idx = ("rests-") + to_str (gh_scm2int (balltype))
67 + (ledger_b ? "o" : "") + style;
69 return sc-> lookup_l ()->afm_find (idx).create_scheme();