return gh_scm2double (s);
}
-/*
- Maximum beam_count.
- */
+/* Maximum beam_count. */
int
Beam::get_beam_count (Grob *me)
{
int m = 0;
for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = ly_cdr (s))
{
- Grob *sc = unsmob_grob (ly_car (s));
-
- m = m >? (Stem::beam_multiplicity (sc).length () + 1);
+ Grob *stem = unsmob_grob (ly_car (s));
+ m = m >? (Stem::beam_multiplicity (stem).length () + 1);
}
return m;
}
{
me->warning (_ ("Beam has less than two stems. Removing beam."));
- unsmob_grob (gh_car (stems))->remove_grob_property ("beam");
+ unsmob_grob (gh_car (stems))->set_grob_property ("beam", SCM_EOL);
me->suicide ();
return SCM_UNSPECIFIED;
for (int i=0; i <stems.size (); i++)
{
Grob *s = stems[i];
- /* For knees, non-forced stems should probably have their
- natural direction. In any case, when knee, beam direction is
- foe.
-
- TODO: for x staff knees, set direction pointing to 'the
- other' staff, rather than natural.
- */
- if (knee_b(me))
- {
- Stem::get_direction (s); // this actually sets it, if necessary
- }
- else
- {
- SCM force = s->remove_grob_property ("dir-forced");
- if (!gh_boolean_p (force) || !gh_scm2bool (force))
- Directional_element_interface::set (s, d);
- }
+
+ SCM forcedir = s->get_grob_property ("direction");
+ if (!to_dir (forcedir))
+ Directional_element_interface::set (s, d);
}
-}
+}
/*
A union of intervals in the real line.
Grob* stem = stems[i];
if (Stem::invisible_b (stem))
continue;
-
Interval hps = Stem::head_positions (stem);
-
if(!hps.empty_b())
{
hps[LEFT] += -1;
hps[RIGHT] += 1;
hps *= staff_space * 0.5 ;
+
+ /*
+ We could subtract beam Y position, but this routine only
+ sets stem directions, a constant shift does not have an
+ influence.
+
+ */
hps += stem->relative_coordinate (common, Y_AXIS);
-
- if (to_boolean (stem->get_grob_property ("dir-forced")))
+
+ if (to_dir (stem->get_grob_property ("direction")))
{
- Direction stemdir =Directional_element_interface::get (stem);
+ Direction stemdir = to_dir (stem->get_grob_property ("direction"));
hps[-stemdir] = - stemdir * infinity_f;
}
}
UP : DOWN ;
stem->set_grob_property ("direction", scm_int2num (d));
-
- /*
- UGH. Check why we still need dir-forced; I think we can
- junk it.
- */
- stem->set_grob_property ("dir-forced", SCM_BOOL_T);
hps.intersect (max_gap);
assert (hps.empty_b () || hps.length () < 1e-6 );
if (knee_b(me))
return ;
- Real forced_fraction = forced_stem_count (me) / visible_stem_count (me);
+ Real forced_fraction = 1.0 * forced_stem_count (me)
+ / visible_stem_count (me);
int beam_count = get_beam_count (me);
Grob *fvs = first_visible_stem (me);
Grob *lvs = last_visible_stem (me);
- Interval ideal (Stem::calc_stem_info (fvs).ideal_y_
+ Interval ideal (Stem::get_stem_info (fvs).ideal_y_
+ fvs->relative_coordinate (commony, Y_AXIS) -my_y,
- Stem::calc_stem_info (lvs).ideal_y_
+ Stem::get_stem_info (lvs).ideal_y_
+ lvs->relative_coordinate (commony, Y_AXIS) - my_y);
Real x0 = first_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
if (Stem::invisible_b (s))
continue;
ideals.push (Offset (x_posns[i],
- Stem::calc_stem_info (s).ideal_y_
+ Stem::get_stem_info (s).ideal_y_
+ s->relative_coordinate (commony, Y_AXIS)
- my_y));
}
Direction d = Stem::get_direction (s);
Real left_y =
- Stem::calc_stem_info (s).shortest_y_
+ Stem::get_stem_info (s).shortest_y_
- dydx * x_posns [i];
/*
if (Stem::invisible_b (s))
continue;
- if (((int)Stem::chord_start_y (s))
+ /* I can imagine counting those boundaries as a half forced stem,
+ but let's count them full for now. */
+ if (abs (Stem::chord_start_y (s)) > 0.1
&& (Stem::get_direction (s) != Stem::get_default_dir (s)))
f++;
}