]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
Issue 4550 (1/2) Avoid "using namespace std;" in included files
[lilypond.git] / lily / beam.cc
index 064f5d7b665ef440e15857d9611071b9c535e7b9..6bdaab9d9fc3ece40cb5311cf422d10957d940ce 100644 (file)
 
 #include <map>
 
+using std::map;
+using std::string;
+using std::vector;
+
 Beam_stem_segment::Beam_stem_segment ()
 {
   max_connect_ = 1000;          // infinity
@@ -119,11 +123,13 @@ Beam::get_beam_translation (Grob *me)
   Real beam_thickness = get_beam_thickness (me);
   Real fract = robust_scm2double (me->get_property ("length-fraction"), 1.0);
 
-  Real beam_translation = beam_count < 4
-                          ? (2 * staff_space + line - beam_thickness) / 2.0
-                          : (3 * staff_space + line - beam_thickness) / 3.0;
-
-  return fract * beam_translation;
+  /*
+    if fract != 1.0, as is the case for grace notes, we want the gap
+    to decrease too. To achieve this, we divide the thickness by
+    fract */
+  return (beam_count < 4
+          ? (2 * staff_space * fract + line * fract - beam_thickness) / 2.0
+          : (3 * staff_space * fract + line * fract - beam_thickness) / 3.0);
 }
 
 /* Maximum beam_count. */
@@ -1230,7 +1236,7 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset)
     return scm_from_double (0.0);
   Grob *beam = unsmob<Grob> (stem->get_object ("beam"));
   if (!beam
-      || !Beam::has_interface (beam)
+      || !has_interface<Beam> (beam)
       || !Beam::normal_stem_count (beam))
     return scm_from_double (0.0);