]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
(setup_paths): mingw uses std string too.
[lilypond.git] / lily / beam.cc
index 4b6bfa3024f6e0f4b60dfca63d1124022ebfe878..5861dba32115cb4fa7aa7a3cd581a67ec15acd45 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 */
 
 #include "beam.hh"
-#include "interval-set.hh"
-#include "directional-element-interface.hh"
+
 #include "beaming.hh"
-#include "misc.hh"
+#include "directional-element-interface.hh"
+#include "international.hh"
+#include "interval-set.hh"
+#include "item.hh"
 #include "least-squares.hh"
-#include "stem.hh"
-#include "output-def.hh"
 #include "lookup.hh"
+#include "misc.hh"
+#include "output-def.hh"
 #include "pointer-group-interface.hh"
-#include "staff-symbol-referencer.hh"
-#include "item.hh"
 #include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "stem.hh"
 #include "warn.hh"
 
 #if DEBUG_QUANTING
@@ -140,13 +142,7 @@ Beam::calc_direction (SCM smob)
        }
       else
        {
-         /*
-           ugh.
-
-           can happen in stem-tremolo case.
-           TODO: fixme.
-          */
-         d = Stem::get_default_dir (stems[0]);
+         d = to_dir (stems[0]->get_property ("default-direction"));
        }
     }
 
@@ -273,7 +269,7 @@ Beam::calc_beaming (SCM smob)
        }
     }
 
-  return SCM_BOOL_T;
+  return SCM_EOL;
 }
 
 /*
@@ -504,7 +500,7 @@ Beam::print (SCM grob)
        should be switchable for those who want to twiddle with the
        parameters.
       */
-      String str;
+      std::string str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
       Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
@@ -538,7 +534,10 @@ Beam::get_default_dir (Grob *me)
       if (is_direction (stem_dir_scm))
        stem_dir = to_dir (stem_dir_scm);
       else
-       stem_dir = Stem::get_default_dir (s);
+       stem_dir = to_dir (s->get_property ("default-direction"));
+
+      if (!stem_dir)
+       stem_dir = to_dir (s->get_property ("neutral-direction"));
 
       if (stem_dir)
        {
@@ -548,12 +547,14 @@ Beam::get_default_dir (Grob *me)
     }
 
   Direction dir = CENTER;
-  
-  if (Direction d =  (Direction) sign (count[UP] - count[DOWN]))
+  Direction d = CENTER;
+  if ((d = (Direction) sign (count[UP] - count[DOWN])))
     dir = d;
-  else if (Direction d = (Direction)  sign (total[UP] / count[UP] - total[DOWN]/count[DOWN]))
+  else if (count[UP]
+          && count[DOWN]
+          && (d = (Direction)  sign (total[UP] / count[UP] - total[DOWN]/count[DOWN])))
     dir = d;
-  else if (Direction d = (Direction)  sign (total[UP] - total[DOWN]))
+  else if ((d = (Direction)  sign (total[UP] - total[DOWN])))
     dir = d;
   else
     dir = to_dir (me->get_property ("neutral-direction"));
@@ -1196,8 +1197,11 @@ Beam::forced_stem_count (Grob *me)
 
       /* I can imagine counting those boundaries as a half forced stem,
         but let's count them full for now. */
+      Direction defdir = to_dir (s->get_property ("default-direction"));
+      
       if (abs (Stem::chord_start_y (s)) > 0.1
-         && (get_grob_direction (s) != Stem::get_default_dir (s)))
+         && defdir
+         && get_grob_direction (s) != defdir)
        f++;
     }
   return f;
@@ -1287,9 +1291,9 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset)
 
   Drul_array<Grob*> visible_stems (first_visible_stem (beam),
                                   last_visible_stem (beam));
-                                   
-  Grob *common = visible_stems[RIGHT]
-    ->common_refpoint (visible_stems[LEFT], X_AXIS);
+  extract_grob_set (beam, "stems", stems);
+  
+  Grob *common = common_refpoint_of_array (stems, beam, X_AXIS);
   
   Real x0 = visible_stems[LEFT]->relative_coordinate (common, X_AXIS);
   Real dx = visible_stems[RIGHT]->relative_coordinate (common, X_AXIS) - x0;
@@ -1388,7 +1392,8 @@ ADD_INTERFACE (Beam,
 
               "A beam. \n\n"
               "The @code{thickness} property is the weight of beams, "
-              "measured in staffspace.  The @code{direction} property is not user-serviceable. Use "
+              "measured in staffspace.  The @code{direction} "
+              "property is not user-serviceable. Use "
               "the @code{direction} property of @code{Stem} instead. "
 
               ,
@@ -1396,6 +1401,7 @@ ADD_INTERFACE (Beam,
               /* properties */
               "auto-knee-gap "
               "beamed-stem-shorten "
+              "beaming "
               "break-overshoot "
               "chord-tremolo "
               "concaveness "