]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
(stop_translation_timestep):
[lilypond.git] / lily / beam.cc
index 975b6685c2f7a3107624314920a5606668f65777..fc93ed4bc20f40fa330a9304bad41d5fe1f75f1d 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -98,6 +98,10 @@ Beam::get_beam_count (Grob *me)
   return m;
 }
 
+
+/*
+  Space return space between beams.
+ */
 MAKE_SCHEME_CALLBACK (Beam, space_function, 2);
 SCM
 Beam::space_function (SCM smob, SCM beam_count)
@@ -335,6 +339,7 @@ Beam::brew_molecule (SCM grob)
   SCM gap = me->get_grob_property ("gap");
   Molecule the_beam;
   Real lt = me->get_paper ()->get_var ("linethickness");
+  
   for (int i = 0; i< stems.size(); i++)
     {
       Grob * st =stems[i];
@@ -343,6 +348,11 @@ Beam::brew_molecule (SCM grob)
       Real xposn = st->relative_coordinate (xcommon, X_AXIS);
       Real stem_width = gh_scm2double (st->get_grob_property ("thickness")) *lt;
 
+      /*
+       We do the space left of ST, with lfliebertjes pointing to the
+       right from the left stem, and rfliebertjes pointing left from
+       right stem.
+       */
       if (i > 0)
        {
          SCM left = gh_cdr (last_beaming);
@@ -408,18 +418,14 @@ Beam::brew_molecule (SCM grob)
 
          if (lfliebertjes.size() || rfliebertjes.size())
            {
-
              Real nw_f;
-             if (!Stem::first_head (st))
-               nw_f = 0;
-             else
-               {
-                 int t = Stem::duration_log (st); 
 
-                 SCM proc = me->get_grob_property ("flag-width-function");
-                 SCM result = gh_call1 (proc, scm_int2num (t));
-                 nw_f = gh_scm2double (result);
-               }
+             int t = Stem::duration_log (st); 
+
+             SCM proc = me->get_grob_property ("flag-width-function");
+             SCM result = gh_call1 (proc, scm_int2num (t));
+             nw_f = gh_scm2double (result);
+               
              
              /* Half beam should be one note-width,
                 but let's make sure two half-beams never touch */
@@ -473,7 +479,7 @@ Beam::brew_molecule (SCM grob)
 
       
       Molecule tm = Text_item::text2molecule (me, scm_makfrom0str (str.to_str0 ()), properties);
-      the_beam.add_at_edge (Y_AXIS, UP, tm, 5.0);
+      the_beam.add_at_edge (Y_AXIS, UP, tm, 5.0, 0);
     }
 #endif
     
@@ -776,6 +782,10 @@ Beam::after_line_breaking (SCM smob)
   return SCM_UNSPECIFIED;
 }
 
+
+/*
+  Compute  a first approximation to the beam slope.
+ */
 MAKE_SCHEME_CALLBACK (Beam, least_squares, 1);
 SCM
 Beam::least_squares (SCM smob)
@@ -1066,9 +1076,13 @@ Beam::check_concave (SCM smob)
       concave *= dir;
       concaveness2 = concave / (stems.size () - 2);
       
-      /* ugh: this is the a kludge to get
-        input/regression/beam-concave.ly to behave as
-        baerenreiter. */
+      /*
+
+      ugh: this is the a kludge to get
+      input/regression/beam-concave.ly to behave as
+      baerenreiter.
+
+      */
 
       /*
        huh? we're dividing twice (which is not scalable) meaning that
@@ -1213,9 +1227,6 @@ Beam::set_stem_lengths (Grob *me)
   Interval pos = ly_scm2interval (me->get_grob_property ("positions"));
   Real staff_space = Staff_symbol_referencer::staff_space (me);
 
-  bool french = to_boolean (me->get_grob_property ("french-beaming"));
-
-  
   bool gap = false;
   Real thick =0.0;
   if (gh_number_p (me->get_grob_property ("gap"))
@@ -1238,6 +1249,8 @@ Beam::set_stem_lengths (Grob *me)
       if (Stem::invisible_b (s))
        continue;
 
+      
+      bool french = to_boolean (s->get_grob_property ("french-beaming"));
       Real stem_y = calc_stem_y (me, s, common,
                                 xl, xr,
                                 pos, french && i > 0&& (i < stems.size  () -1));
@@ -1273,13 +1286,18 @@ Beam::set_beaming (Grob *me, Beaming_info_list *beaming)
              ||(d == RIGHT && i == stems.size () -1))
            continue;
 
-
-         SCM beaming_prop = stems[i]->get_grob_property ("beaming");
+         Grob *st =  stems[i];
+         SCM beaming_prop = st->get_grob_property ("beaming");
          if (beaming_prop == SCM_EOL ||
              index_get_cell (beaming_prop, d) == SCM_EOL)
            {
              int b = beaming->infos_.elem (i).beams_i_drul_[d];
-             Stem::set_beaming (stems[i], b, d);
+             if (i>0
+                 && i < stems.size() -1
+                 && Stem::invisible_b (st))
+               b = b <? beaming->infos_.elem(i).beams_i_drul_[-d];
+             
+             Stem::set_beaming (st, b, d);
            }
        }
       while (flip (&d) != LEFT);
@@ -1484,23 +1502,22 @@ Beam::get_direction_beam_count (Grob *me, Direction d )
 
 
 ADD_INTERFACE (Beam, "beam-interface",
-  "A beam.
-
-#'thickness= weight of beams, in staffspace
-
-
-We take the least squares line through the ideal-length stems, and
-then damp that using
-
-       damped = tanh (slope)
-
-this gives an unquantized left and right position for the beam end.
-Then we take all combinations of quantings near these left and right
-positions, and give them a score (according to how close they are to
-the ideal slope, how close the result is to the ideal stems, etc.). We
-take the best scoring combination.
-
-",
-  "knee french-beaming position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness");
+  "A beam. \n\n"
+" "
+"#'thickness= weight of beams, in staffspace "
+" "
+" "
+"We take the least squares line through the ideal-length stems, and "
+"then damp that using "
+" \n"
+"      damped = tanh (slope) \n"
+" \n"
+"this gives an unquantized left and right position for the beam end. "
+"Then we take all combinations of quantings near these left and right "
+"positions, and give them a score (according to how close they are to "
+"the ideal slope, how close the result is to the ideal stems, etc.). We "
+"take the best scoring combination. "
+,
+  "knee position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness");