/*
[TODO]
- * shorter! (now +- 1000 lines)
- * less hairy code
+ -* shorter! (now +- 1000 lines)
+
+ -* less hairy code
+
*/
/*
If dir is not determined: get default
*/
- return to_dir (me->get_grob_property ("default-neutral-direction"));
+ return to_dir (me->get_grob_property ("neutral-direction"));
}
SCM s = me->get_grob_property ("staff-position");
if (gh_number_p (s))
{
- Real y = gh_scm2double (s) * staff_space;
+ Real y = gh_scm2double (s) * staff_space * 0.5;
me->set_grob_property ("y", gh_double2scm (y));
}
s = me->get_grob_property ("height");
if (gh_number_p (s))
{
- Real dy = gh_scm2double (s) * staff_space;
+ Real dy = gh_scm2double (s) * staff_space * 0.5;
me->set_grob_property ("dy", gh_double2scm (dy));
}
Real stem_y = calc_stem_y_f (me, s, y, dy);
+ // doesn't play well with dvips
+ if (scm_definedp (ly_symbol2scm ("ps-testing"), SCM_UNDEFINED)
+ == SCM_BOOL_T)
+ if (Stem::get_direction (s) == Directional_element_interface::get (me))
+ stem_y += Stem::get_direction (s)
+ * gh_scm2double (me->get_grob_property ("thickness")) / 2;
+
/* caution: stem measures in staff-positions */
Real id = me->relative_coordinate (common, Y_AXIS)
- stems[i]->relative_coordinate (common, Y_AXIS);
(prev && ! (prev->relative_coordinate (0, X_AXIS) < here->relative_coordinate (0, X_AXIS))))
programming_error ("Beams are not left-to-right");
- Real staffline_f = me->paper_l ()->get_var ("stafflinethickness");
int multiplicity = get_multiplicity (me);
SCM space_proc = me->get_grob_property ("space-function");
Real interbeam_f = gh_scm2double (space) ;
Real bdy = interbeam_f;
- Real stemdx = staffline_f;
-
+
+#if 0
// ugh -> use commonx
Real dx = visible_stem_count (me) ?
last_visible_stem (me)->relative_coordinate (0, X_AXIS) - first_visible_stem (me)->relative_coordinate (0, X_AXIS)
: 0.0;
-
+#endif
+
Molecule leftbeams;
Molecule rightbeams;
Direction dir = Directional_element_interface::get (me);
+ /* [Tremolo] beams on whole notes may not have direction set? */
+ if (dir == CENTER)
+ dir = Directional_element_interface::get (here);
+
/* half beams extending to the left. */
if (prev)
{
Half beam should be one note-width,
but let's make sure two half-beams never touch
*/
- Real w = here->relative_coordinate (0, X_AXIS) - prev->relative_coordinate (0, X_AXIS);
+
+ // FIXME: TODO (check) stem width / sloped beams
+ Real w = here->relative_coordinate (0, X_AXIS)
+ - prev->relative_coordinate (0, X_AXIS);
+ Real stem_w = gh_scm2double (prev->get_grob_property ("thickness"))
+ // URG
+ * me->paper_l ()->get_var ("stafflinethickness");
+
w = w/2 <? nw_f;
Molecule a;
if (lhalfs) // generates warnings if not
- a = Lookup::beam (dydx, w, thick);
+ a = Lookup::beam (dydx, w + stem_w, thick);
a.translate (Offset (-w, -w * dydx));
+ a.translate_axis (-stem_w/2, X_AXIS);
for (int j = 0; j < lhalfs; j++)
{
Molecule b (a);
if (next)
{
- int rhalfs = Stem::beam_count (here,RIGHT) - Stem::beam_count (next,LEFT);
- int rwholebeams= Stem::beam_count (here,RIGHT) <? Stem::beam_count (next,LEFT) ;
+ int rhalfs = Stem::beam_count (here,RIGHT)
+ - Stem::beam_count (next,LEFT);
+ int rwholebeams= Stem::beam_count (here,RIGHT)
+ <? Stem::beam_count (next,LEFT) ;
+
+ Real w = next->relative_coordinate (0, X_AXIS)
+ - here->relative_coordinate (0, X_AXIS);
- Real w = next->relative_coordinate (0, X_AXIS) - here->relative_coordinate (0, X_AXIS);
- Molecule a = Lookup::beam (dydx, w + stemdx, thick);
- a.translate_axis (- stemdx/2, X_AXIS);
+ Real stem_w = gh_scm2double (next->get_grob_property ("thickness"))
+ // URG
+ * me->paper_l ()->get_var ("stafflinethickness");
+
+ Molecule a = Lookup::beam (dydx, w + stem_w, thick);
+ a.translate_axis (- stem_w/2, X_AXIS);
int j = 0;
Real gap_f = 0;
-
+
SCM gap = me->get_grob_property ("gap");
if (gh_number_p (gap))
{
b.translate_axis (-dir * bdy * j, Y_AXIS);
rightbeams.add_molecule (b);
}
- // TODO: notehead widths differ for different types
- gap_f = nw_f / 2;
+ if (Stem::invisible_b (here))
+ gap_f = nw_f;
+ else
+ gap_f = nw_f / 2;
w -= 2 * gap_f;
- a = Lookup::beam (dydx, w + stemdx, thick);
+ a = Lookup::beam (dydx, w + stem_w, thick);
}
for (; j < rwholebeams; j++)
{
Molecule b (a);
- b.translate (Offset (Stem::invisible_b (here) ? 0 : gap_f, -dir * bdy * j));
+ Real tx = 0;
+ if (Stem::invisible_b (here))
+ // ugh, see chord-tremolo.ly
+ tx = (-dir + 1) / 2 * nw_f * 1.5 + gap_f/4;
+ else
+ tx = gap_f;
+ b.translate (Offset (tx, -dir * bdy * j));
rightbeams.add_molecule (b);
}