- assert( !next || next->hpos_f() > here->hpos_f() );
- assert( !prev || prev->hpos_f() < here->hpos_f() );
- Real dy=paper()->internote()*2;
- Real stemdx = paper()->rule_thickness();
- Real sl = slope*paper()->internote();
- paper()->lookup_l()->beam(sl, 20 PT);
-
- Molecule leftbeams;
- Molecule rightbeams;
-
- /* half beams extending to the left. */
- if (prev) {
- int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ;
- int lwholebeams= here->beams_left_i_ <? prev->beams_right_i_ ;
- Real w = (here->hpos_f() - prev->hpos_f())/4;
- Symbol dummy;
- Atom a(dummy);
- if (lhalfs) // generates warnings if not
- a = paper()->lookup_l()->beam(sl, w);
- a.translate(Offset (-w, -w * sl));
- for (int j = 0; j < lhalfs; j++) {
- Atom b(a);
- b.translate(Offset(0, -dir_i_ * dy * (lwholebeams+j)));
- leftbeams.add( b );
+ if ((next && !(next->relative_coordinate (0, X_AXIS) > here->relative_coordinate (0, X_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 = paper_l ()->get_var ("stafflinethickness");
+ int multiplicity = get_multiplicity ();
+
+
+ Real interbeam_f = paper_l ()->interbeam_f (multiplicity);
+ Real thick = gh_scm2double (get_elt_property ("beam-thickness"));
+ thick *= paper_l ()->get_var ("staffspace");
+
+ Real bdy = interbeam_f;
+ Real stemdx = staffline_f;
+
+ Real dx = visible_stem_count () ?
+ last_visible_stem ()->relative_coordinate (0, X_AXIS) - first_visible_stem ()->relative_coordinate (0, X_AXIS)
+ : 0.0;
+ Real dy = gh_scm2double (get_elt_property ("height"));
+ Real dydx = dy && dx ? dy/dx : 0;
+
+ Molecule leftbeams;
+ Molecule rightbeams;
+
+ // UGH
+ Real nw_f;
+ if (!here->first_head ())
+ nw_f = 0;
+ else if (here->type_i ()== 1)
+ nw_f = paper_l ()->get_var ("wholewidth");
+ else if (here->type_i () == 2)
+ nw_f = paper_l ()->get_var ("notewidth") * 0.8;
+ else
+ nw_f = paper_l ()->get_var ("quartwidth");
+
+
+ Direction dir = directional_element (this).get ();
+
+ /* half beams extending to the left. */
+ if (prev)
+ {
+ int lhalfs= lhalfs = here->beam_count (LEFT) - prev->beam_count (RIGHT);
+ int lwholebeams= here->beam_count (LEFT) <? prev->beam_count (RIGHT) ;
+ /*
+ 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);
+ w = w/2 <? nw_f;
+ Molecule a;
+ if (lhalfs) // generates warnings if not
+ a = lookup_l ()->beam (dydx, w, thick);
+ a.translate (Offset (-w, -w * dydx));
+ for (int j = 0; j < lhalfs; j++)
+ {
+ Molecule b (a);
+ b.translate_axis (-dir * bdy * (lwholebeams+j), Y_AXIS);
+ leftbeams.add_molecule (b);