- SCM proc = me->get_property ("flag-width-function");
- SCM result = scm_call_1 (proc, scm_int2num (t));
- nw_f = scm_to_double (result);
- }
- else
- nw_f = break_overshoot / 2;
-
- /* Half beam should be one note-width,
- but let's make sure two half-beams never touch */
- Real lw = nw_f;
- Real rw = nw_f;
- if (i > 0)
- rw = nw_f <? ( (xposn - last_xposn) / 2);
- else
- /*
- TODO: 0.5 is a guess.
- */
- rw = xposn - me->get_bound (LEFT)->extent (xcommon, X_AXIS)[RIGHT]
- - 0.5;
-
- if (st)
- lw = nw_f <? ( (xposn - last_xposn) / 2);
- else
- lw = me->get_bound (RIGHT)->relative_coordinate (xcommon, X_AXIS)
- - last_xposn;
-
- Stencil rhalf = Lookup::beam (slope, rw, thick, blot);
- Stencil lhalf = Lookup::beam (slope, lw, thick, blot);
- for (int j = lfliebertjes.size (); j--;)
- {
- Stencil b (lhalf);
- b.translate_axis (last_xposn - x0, X_AXIS);
- b.translate_axis (slope * (last_xposn-x0) + bdy * lfliebertjes[j], Y_AXIS);
- the_beam.add_stencil (b);
- }
- for (int j = rfliebertjes.size (); j--;)
- {
- Stencil b (rhalf);
- b.translate_axis (xposn - x0 - rw , X_AXIS);
- b.translate_axis (slope * (xposn-x0 -rw) + bdy * rfliebertjes[j], Y_AXIS);
- the_beam.add_stencil (b);
- }
- }
+MAKE_SCHEME_CALLBACK(Beam, print, 1);
+SCM
+Beam::print (SCM grob)
+{
+ Spanner *me = unsmob_spanner (grob);
+ Grob *commonx = 0;
+ vector<Beam_segment> segments = get_beam_segments (me, &commonx);
+
+ Interval span;
+ if (visible_stem_count (me))
+ {
+ span[LEFT] = first_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
+ span[RIGHT] = last_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
+ }
+ else
+ {
+ extract_grob_set (me, "stems", stems);
+ span[LEFT] = stems[0]->relative_coordinate (commonx, X_AXIS);
+ span[RIGHT] = stems.back ()->relative_coordinate (commonx, X_AXIS);
+ }