add_bound_item (dynamic_cast<Spanner*> (me), dynamic_cast<Item*> (s));
}
-
-/*
- TODO: fix this for grace notes.
- */
Real
Beam::get_interbeam (Grob *me)
{
- int multiplicity = get_multiplicity (me);
- Real ss = Staff_symbol_referencer::staff_space (me);
-
- SCM s = me->get_grob_property ("beam-space");
- if (gh_number_p (s))
- return gh_scm2double (s) * ss;
- else if (s != SCM_EOL && gh_list_p (s))
- return gh_scm2double (scm_list_ref (s,
- gh_int2scm (multiplicity - 1
- <? scm_ilength (s) - 1)))
- * ss;
-
- Real slt = me->paper_l ()->get_var ("linethickness");
- Real thickness = gh_scm2double (me->get_grob_property ("thickness")) * ss;
-
- Real interbeam = multiplicity < 4
- ? (2*ss + slt - thickness) / 2.0
- : (3*ss + slt - thickness) / 3.0;
-
- return interbeam;
+ SCM func = me->get_grob_property ("space-function");
+ SCM s = gh_call2 (func, me->self_scm (), gh_int2scm (get_multiplicity (me)));
+ return gh_scm2double (s);
}
int
return m;
}
+MAKE_SCHEME_CALLBACK (Beam, space_function, 2);
+SCM
+Beam::space_function (SCM smob, SCM multiplicity)
+{
+ Grob *me = unsmob_grob (smob);
+
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Real line = me->paper_l ()->get_var ("linethickness");
+ Real thickness = gh_scm2double (me->get_grob_property ("thickness"))
+ * staff_space;
+
+ Real interbeam = gh_scm2int (multiplicity) < 4
+ ? (2*staff_space + line - thickness) / 2.0
+ : (3*staff_space + line - thickness) / 3.0;
+
+ return gh_double2scm (interbeam);
+}
+
+
/* After pre-processing all directions should be set.
Several post-processing routines (stem, slur, script) need stem/beam
direction.
do {
Grob *s = stems[i];
Direction sd = Directional_element_interface::get (s);
- int current = sd ? (1 + d * sd)/2
- : Stem::get_center_distance (s, (Direction)-d);
+
+ int center_distance = int(- d * Stem::head_positions (s) [-d]) >? 0;
+ int current = sd ? (1 + d * sd)/2 : center_distance;
if (current)
{
if (ly_car (s) != SCM_BOOL_F)
return SCM_UNSPECIFIED;
+ // one wonders if such genericity is necessary --hwn.
SCM callbacks = me->get_grob_property ("position-callbacks");
for (SCM i = callbacks; gh_pair_p (i); i = ly_cdr (i))
gh_call1 (ly_car (i), smob);
+ set_stem_lengths (me);
return SCM_UNSPECIFIED;
}
demerit_score += 5 * shrink_extra_weight (d * current_y - info.ideal_y);
}
- demerit_score *= 2.0 /stems.size ();
+ demerit_score *= 2.0 / stems.size ();
return demerit_score;
}
me->set_grob_property ("positions", ly_interval2scm (pos));
}
- return SCM_UNSPECIFIED;
-}
-
-MAKE_SCHEME_CALLBACK (Beam, end_after_line_breaking, 1);
-SCM
-Beam::end_after_line_breaking (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
- set_stem_lengths (me);
-
return SCM_UNSPECIFIED;
}
}
-bool
-Beam::has_interface (Grob *me)
-{
- return me->has_interface (ly_symbol2scm ("beam-interface"));
-}
ADD_INTERFACE (Beam, "beam-interface",
take the best scoring combination.
",
- "beam-space concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy direction damping flag-width-function neutral-direction positions thickness");
+ "position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy direction damping flag-width-function neutral-direction positions space-function thickness");