* less hairy code
* move paper vars to scm
+
+ remove *-hs variables.
+
*/
#include <math.h> // tanh.
-
#include "directional-element-interface.hh"
#include "beaming.hh"
#include "dimensions.hh"
#include "group-interface.hh"
#include "staff-symbol-referencer.hh"
#include "cross-staff.hh"
-#include "lily-guile.icc"
Beam::Beam ()
{
Group_interface g (this, "stems");
g.set_interface ();
+
+ set_elt_property ("height", gh_int2scm (0)); // ugh.
+ set_elt_property ("y-position" ,gh_int2scm (0));
}
void
return;
int multiplicity = get_multiplicity ();
+
// grace stems?
- SCM shorten = ly_eval_str ("beamed-stem-shorten");
+ SCM shorten = scm_eval (ly_symbol2scm ("beamed-stem-shorten"));
- Array<Real> a;
- scm_to_array (shorten, &a);
- if (!a.size ())
+ if (shorten == SCM_EOL)
return;
+ int sz = scm_ilength (shorten);
+
Staff_symbol_referencer_interface st (this);
Real staff_space = st.staff_space ();
- Real shorten_f = a[multiplicity <? (a.size () - 1)] * staff_space;
+ SCM shorten_elt = scm_list_ref (shorten, gh_int2scm (multiplicity <? (sz - 1)));
+ Real shorten_f = gh_scm2double (shorten_elt) * staff_space;
/* cute, but who invented this -- how to customise ? */
if (forced_fraction < 1)
{
/* first, calculate y, dy */
Real y, dy;
- calc_position_and_height (&y, &dy);
+ calc_default_position_and_height (&y, &dy);
if (visible_stem_count ())
{
if (suspect_slope_b (y, dy))
See Documentation/tex/fonts.doc
*/
void
-Beam::calc_position_and_height (Real* y, Real* dy) const
+Beam::calc_default_position_and_height (Real* y, Real* dy) const
{
- *y = *dy = 0;
+ *y = 0;
+ *dy = 0;
if (visible_stem_count () <= 1)
return;
Real
Beam::quantise_dy_f (Real dy) const
{
- SCM quants = ly_eval_str ("beam-height-quants");
-
Array<Real> a;
- scm_to_array (quants, &a);
+ for (SCM s = scm_eval (ly_symbol2scm ("beam-height-quants")); s !=SCM_EOL; s = gh_cdr (s))
+ a.push (gh_scm2double (gh_car (s)));
+
if (a.size () <= 1)
return dy;
int multiplicity = get_multiplicity ();
Staff_symbol_referencer_interface st (this);
Real staff_space = st.staff_space ();
- SCM quants = scm_eval (gh_list (
- ly_symbol2scm ("beam-vertical-position-quants"),
+ SCM quants = scm_eval (gh_list (ly_symbol2scm ("beam-vertical-position-quants"),
gh_int2scm (multiplicity),
gh_double2scm (dy/staff_space),
SCM_UNDEFINED));
+
Array<Real> a;
- scm_to_array (quants, &a);
+
+ for (; quants != SCM_EOL; quants = gh_cdr (quants))
+ a.push (gh_scm2double (gh_car (quants)));
+
if (a.size () <= 1)
return y;
return f;
}
-
-
/*
TODO: Fix this class. This is wildly inefficient.
And it sux. Yet another array/list 'interface'.
SCM s = get_elt_property ("stems");
return gh_pair_p (s) ? dynamic_cast<Stem*> (unsmob_element (gh_car (s))) : 0;
-
- //Group_interface__extract_elements ((Beam*) this, (Stem*) 0, "stems")[stem_count () - 1];
}
/* burp */