]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
patch::: 1.5.22.jcn4
[lilypond.git] / lily / beam.cc
index d345e7de75ce6c34c44288e6114d534fa057428a..f744b4fff6bbdf75b2e7836a47e15d33060faba7 100644 (file)
@@ -14,7 +14,9 @@
   -* shorter! (now +- 1000 lines)
   
   -* less hairy code
-  
+
+  -* Remove #'direction from beam. The beam has no direction per se.
+  It may only set directions for stems.
   */
 
 
@@ -52,9 +54,9 @@ int
 Beam::get_multiplicity (Grob*me) 
 {
   int m = 0;
-  for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = gh_cdr (s))
+  for (SCM s = me->get_grob_property ("stems"); gh_pair_p (s); s = ly_cdr (s))
     {
-      Grob * sc = unsmob_grob (gh_car (s));
+      Grob * sc = unsmob_grob (ly_car (s));
 
       if (Stem::has_interface (sc))
        m = m >? Stem::beam_count (sc,LEFT) >? Stem::beam_count (sc,RIGHT);
@@ -299,8 +301,8 @@ Beam::after_line_breaking (SCM smob)
     somewhere (?), I guess, not by looping here. */
   
   SCM list = me->get_grob_property ("y-dy-callbacks");
-  for (SCM i = list; gh_pair_p (i); i = gh_cdr (i))
-    gh_call1 (gh_car (i), smob);
+  for (SCM i = list; gh_pair_p (i); i = ly_cdr (i))
+    gh_call1 (ly_car (i), smob);
 
   // UGH. Y is not in staff position unit?
   // Ik dacht datwe daar juist van weg wilden?
@@ -458,8 +460,8 @@ Beam::quantise_dy (SCM smob)
                         gh_double2scm (me->paper_l ()->get_var ("stafflinethickness")
                                        / 1.0));
   
-  for (SCM s = quants; gh_pair_p (s); s = gh_cdr (s))
-    a.push (gh_scm2double (gh_car (s)));
+  for (SCM s = quants; gh_pair_p (s); s = ly_cdr (s))
+    a.push (gh_scm2double (ly_car (s)));
   
   if (a.size () > 1)
     {
@@ -669,11 +671,14 @@ Beam::set_stem_lengths (Grob *me)
        continue;
 
       Real stem_y = calc_stem_y_f (me, s, y, dy);
-      //stem_y += Stem::get_direction (s)
-      if (Stem::get_direction (s) == Directional_element_interface::get (me))
-       stem_y += Stem::get_direction (s)
-         * gh_scm2double (me->get_grob_property ("thickness")) / 2;
 
+      // doesn't play well with dvips
+      if (scm_definedp (ly_symbol2scm ("ps-testing"), SCM_UNDEFINED)
+         == SCM_BOOL_T)
+       if (Stem::get_direction (s) == Directional_element_interface::get (me))
+         stem_y += Stem::get_direction (s)
+           * gh_scm2double (me->get_grob_property ("thickness")) / 2;
+      
       /* caution: stem measures in staff-positions */
       Real id = me->relative_coordinate (common, Y_AXIS)
        - stems[i]->relative_coordinate (common, Y_AXIS);
@@ -700,15 +705,15 @@ Beam::quantise_y_f (Grob*me,Real y, Real dy, int quant_dir)
   SCM proc = me->get_grob_property ("vertical-position-quant-function");
   SCM quants = scm_apply (proc,
                          me->self_scm (),
-                         gh_list (gh_int2scm (multiplicity),
+                         scm_list_n (gh_int2scm (multiplicity),
                                   gh_double2scm (dy/staff_space),
                                   gh_double2scm (thick/staff_space),
                                   SCM_EOL, SCM_UNDEFINED));
   
   Array<Real> a;
 
-  for (; gh_pair_p (quants); quants = gh_cdr (quants))
-    a.push (gh_scm2double (gh_car (quants)));
+  for (; gh_pair_p (quants); quants = ly_cdr (quants))
+    a.push (gh_scm2double (ly_car (quants)));
 
   if (a.size () <= 1)
     return y;
@@ -758,7 +763,7 @@ Beam::set_beaming (Grob*me,Beaming_info_list *beaming)
   */
 Molecule
 Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev,
-                 Real dy, Real dydx
+                 Real /* dy */ , Real dydx
                  ) 
 {
   // ugh -> use commonx
@@ -799,11 +804,12 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev,
 
 
   Direction dir = Directional_element_interface::get (me);
-  
+
   /* [Tremolo] beams on whole notes may not have direction set? */
  if (dir == CENTER)
     dir = Directional_element_interface::get (here);
-  
+
+
   /* half beams extending to the left. */
   if (prev)
     {