#include "staff-symbol-referencer.hh"
// -> offset callback
-void
-Rest::after_line_breaking ()
+MAKE_SCHEME_CALLBACK(Rest,after_line_breaking);
+SCM
+Rest::after_line_breaking (SCM smob)
{
- if (balltype_i () == 0)
+ Score_element *me = unsmob_element (smob);
+ int bt = gh_scm2int (me->get_elt_property ("duration-log"));
+ if (bt == 0)
{
- Staff_symbol_referencer_interface si (this);
- si.set_position (si.position_f () + 2);
+ me->translate_axis (Staff_symbol_referencer::staff_space (me) , Y_AXIS);
}
-
- Dots * d = dots_l ();
- if (d && balltype_i () > 4) // UGH.
+
+ Score_element * d = unsmob_element (me->get_elt_property ("dot"));
+ if (d && bt > 4) // UGH.
{
- /*
- UGH.
- */
- staff_symbol_referencer (d)
- .set_position ((balltype_i () == 7) ? 4 : 3);
+ d->set_elt_property ("staff-position",
+ gh_int2scm ((bt == 7) ? 4 : 3));
}
-}
+ return SCM_UNSPECIFIED;
+}
-MAKE_SCHEME_SCORE_ELEMENT_NON_DEFAULT_CALLBACKS(Rest)
+MAKE_SCHEME_CALLBACK(Rest,brew_molecule)
SCM
-Rest::scheme_molecule (SCM smob)
+Rest::brew_molecule (SCM smob)
{
- Score_element* sc = unsmob_element (smob);
+ Score_element* me = unsmob_element (smob);
bool ledger_b =false;
- SCM balltype = sc->get_elt_property ("duration-log");
+ SCM balltype = me->get_elt_property ("duration-log");
if (balltype == gh_int2scm (0) || balltype == gh_int2scm (1))
{
- Staff_symbol_referencer_interface si(sc);
- ledger_b = abs(si.position_f () - (2* gh_scm2int (balltype) - 1))
- > si.line_count ();
+ int sz = Staff_symbol_referencer::line_count (me);
+ Real dif = abs(Staff_symbol_referencer::position_f (me) - (2* gh_scm2int (balltype) - 1));
+ ledger_b = dif > sz;
}
String style;
- SCM style_sym =sc->get_elt_property ("style");
+ SCM style_sym =me->get_elt_property ("style");
if (gh_scm2int (balltype) >= 2 && gh_string_p (style_sym))
{
style = ly_scm2string (style_sym);
String idx = ("rests-") + to_str (gh_scm2int (balltype))
+ (ledger_b ? "o" : "") + style;
- return sc-> lookup_l ()->afm_find (idx).create_scheme();
+ return me-> lookup_l ()->afm_find (idx).create_scheme();
}
-
-Rest::Rest (SCM s)
- : Rhythmic_head (s)
+bool
+Rest::has_interface (Score_element*m)
{
+ return m && m->has_interface (ly_symbol2scm ("rest-interface"));
}
-