]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
trim outdated comment
[lilypond.git] / lily / beam.cc
index 18cfae23cd2f58462b524a5387c95ad8871d7b92..f2f0c645f35fe12ba30d4d290c0794e105ce2d7a 100644 (file)
@@ -233,7 +233,7 @@ position_with_maximal_common_beams (SCM left_beaming, SCM right_beaming,
   return best_start;
 }
 
-MAKE_SCHEME_CALLBACK(Beam, calc_beaming, 1)
+MAKE_SCHEME_CALLBACK (Beam, calc_beaming, 1)
 SCM
 Beam::calc_beaming (SCM smob)
 {
@@ -405,7 +405,7 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
          do
            {
              bool on_bound = (event_dir == LEFT) ? j == 0 :
-               j == segs.size() - 1;
+               j == segs.size () - 1;
 
              bool inside_stem = (event_dir == LEFT)
                        ? segs[j].stem_index_ > 0
@@ -427,7 +427,7 @@ 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
@@ -453,13 +453,30 @@ 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)
                {
                  segments.push_back (current);
-                 current = Beam_segment();
+                 current = Beam_segment ();
                }
            }
          while (flip (&event_dir) != LEFT);
@@ -470,7 +487,7 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
   return segments;
 }
 
-MAKE_SCHEME_CALLBACK(Beam, print, 1);
+MAKE_SCHEME_CALLBACK (Beam, print, 1);
 SCM
 Beam::print (SCM grob)
 {
@@ -790,7 +807,7 @@ set_minimum_dy (Grob *me, Real *dy)
 
   
 
-MAKE_SCHEME_CALLBACK(Beam, calc_stem_shorten, 1)
+MAKE_SCHEME_CALLBACK (Beam, calc_stem_shorten, 1)
 SCM
 Beam::calc_stem_shorten (SCM smob)
 {
@@ -1151,7 +1168,7 @@ Beam::calc_stem_y (Grob *me, Grob *stem, Grob **common,
   Hmm.  At this time, beam position and slope are determined.  Maybe,
   stem directions and length should set to relative to the chord's
   position of the beam.  */
-MAKE_SCHEME_CALLBACK(Beam, set_stem_lengths, 1); 
+MAKE_SCHEME_CALLBACK (Beam, set_stem_lengths, 1); 
 SCM
 Beam::set_stem_lengths (SCM smob)
 {
@@ -1431,9 +1448,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)));
 }