]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
Update texinfo.tex from Texinfo CVS
[lilypond.git] / lily / beam.cc
index c1ad71198a1805e805158578899d341e72b4c155..183a936440ff12fe7038025671431264a7ae7ae3 100644 (file)
@@ -427,7 +427,8 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
                      && me->get_bound (event_dir)->break_status_dir ())
                    {
                      current.horizontal_[event_dir]
-                       = (me->get_bound (event_dir)->extent (commonx, X_AXIS)[RIGHT]
+                       = (robust_relative_extent (me->get_bound (event_dir),
+                                                  commonx, X_AXIS)[RIGHT]
                           + event_dir * break_overshoot[event_dir]);
                    }
                  else
@@ -441,7 +442,8 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
                      if (inside_stem)
                        {
                          Grob *neighbor_stem = stems[segs[j].stem_index_ + event_dir];
-                         Real neighbor_stem_x = neighbor_stem->relative_coordinate (commonx, X_AXIS);
+                         Real neighbor_stem_x
+                           = neighbor_stem->relative_coordinate (commonx, X_AXIS);
 
                          notehead_width = min (notehead_width,
                                                fabs (neighbor_stem_x - segs[j].stem_x_)/2);
@@ -453,7 +455,26 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
                {
                  current.horizontal_[event_dir] += event_dir * segs[j].width_/2;
                  if (segs[j].gapped_)
-                   current.horizontal_[event_dir] -= event_dir * gap_length;  
+                   {
+                     current.horizontal_[event_dir] -= event_dir * gap_length;
+
+                     if (Stem::is_invisible (segs[j].stem_))
+                       {
+                         /*
+                           Need to do this in case of whole notes. We don't want the
+                           heads to collide with the beams.
+                          */
+                         extract_grob_set (segs[j].stem_, "note-heads", heads);
+
+                         for (vsize k = 0; k < heads.size (); k ++)
+                           current.horizontal_[event_dir]
+                             = event_dir * min  (event_dir * current.horizontal_[event_dir],
+                                                 - gap_length/2
+                                                 + event_dir
+                                                   * heads[k]->extent (commonx,
+                                                                       X_AXIS)[-event_dir]);
+                       }
+                   }
                }
 
              if (event_dir == RIGHT)
@@ -1431,9 +1452,9 @@ Beam::is_cross_staff (Grob *me)
   return false;
 }
 
-MAKE_SCHEME_CALLBACK (Beam, cross_staff, 1)
+MAKE_SCHEME_CALLBACK (Beam, calc_cross_staff, 1)
 SCM
-Beam::cross_staff (SCM smob)
+Beam::calc_cross_staff (SCM smob)
 {
   return scm_from_bool (is_cross_staff (unsmob_grob (smob)));
 }