]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
Use smaller font for beam debug output.
[lilypond.git] / lily / beam.cc
index 1cb48dade12133fa2e0dfc56ffe4a35d17014f3c..f983040bcabc51aaab2962563eac22135f43c1a0 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
 
 #include "beam.hh"
 
+#include "beam-scoring-problem.hh"
 #include "beaming-pattern.hh"
 #include "directional-element-interface.hh"
-#include "main.hh"
+#include "grob-array.hh"
 #include "international.hh"
 #include "interval-set.hh"
 #include "item.hh"
 #include "least-squares.hh"
 #include "lookup.hh"
+#include "main.hh"
 #include "misc.hh"
 #include "output-def.hh"
 #include "pointer-group-interface.hh"
@@ -52,7 +54,6 @@
 #include "staff-symbol-referencer.hh"
 #include "stem.hh"
 #include "warn.hh"
-#include "grob-array.hh"
 
 #if DEBUG_BEAM_SCORING
 #include "text-interface.hh" // debug output.
@@ -621,10 +622,13 @@ Beam::print (SCM grob)
       string str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
+      properties = scm_cons(scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-3), SCM_EOL),
+                            properties);
+      
       Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
 
       Stencil score = *unsmob_stencil (Text_interface::interpret_markup
-                                   (me->layout ()->self_scm (), properties, annotation));
+                                       (me->layout ()->self_scm (), properties, annotation));
 
       if (!score.is_empty ())
        {
@@ -1144,7 +1148,6 @@ Beam::slope_damping (SCM smob, SCM posns)
   if (normal_stem_count (me) <= 1)
     return posns;
 
-
   SCM s = me->get_property ("damping");
   Real damping = scm_to_double (s);
   Real concaveness = robust_scm2double (me->get_property ("concaveness"), 0.0);
@@ -1186,6 +1189,21 @@ Beam::slope_damping (SCM smob, SCM posns)
   return ly_interval2scm (pos);
 }
 
+
+MAKE_SCHEME_CALLBACK (Beam, quanting, 2);
+SCM
+Beam::quanting (SCM smob, SCM posns)
+{
+  Grob *me = unsmob_grob (smob);
+  Drul_array<Real> ys(0, 0);
+  ys = robust_scm2drul (posns, ys);
+  Beam_scoring_problem problem (me, ys);
+
+  ys = problem.solve ();
+  return ly_interval2scm (ys);
+}
+
+
 /*
   Report slice containing the numbers that are both in (car BEAMING)
   and (cdr BEAMING)
@@ -1468,12 +1486,8 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset)
 
   Grob *common_y = rest->common_refpoint (beam, Y_AXIS);
 
-  /*
-    TODO: this is dubious, because this call needs the info we're
-    computing right now.
-   */
-  Interval rest_extent = rest->extent (common_y, Y_AXIS);
-  rest_extent.translate (offset);
+  Interval rest_extent = rest->extent (rest, Y_AXIS);
+  rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS));
 
   Real rest_dim = rest_extent[d];
   Real minimum_distance