]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stem-tremolo.cc
release: 1.3.88
[lilypond.git] / lily / stem-tremolo.cc
index a0797cff862b4cc905f3181649b12b05743a76ae..2bfd4dfcbe423176dfff102c54b43dcfd362656f 100644 (file)
@@ -13,8 +13,7 @@
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "stem.hh"
-#include "offset.hh"
-
+#include "item.hh"
 #include "staff-symbol-referencer.hh"
 #include "directional-element-interface.hh"
 
@@ -26,7 +25,6 @@
 void
 Stem_tremolo::set_interface (Score_element *me)
 {
-me->set_elt_property ("stem", SCM_EOL);
 }
 
 
@@ -45,7 +43,7 @@ Stem_tremolo::brew_molecule (SCM smob)
 {
   Score_element *me= unsmob_element (smob);
   Score_element * stem = unsmob_element (me->get_elt_property ("stem"));
-  Beam * beam = Stem::beam_l (stem);
+  Score_element * beam = Stem::beam_l (stem);
   
   Real dydx;
   if (beam)
@@ -54,8 +52,8 @@ Stem_tremolo::brew_molecule (SCM smob)
       SCM s = beam->get_elt_property ("height");
       if (gh_number_p (s))
        dy = gh_scm2double (s);
-      Real dx = beam->last_visible_stem ()->relative_coordinate (0, X_AXIS)
-       - beam->first_visible_stem ()->relative_coordinate (0, X_AXIS);
+      Real dx = Beam::last_visible_stem (beam)->relative_coordinate (0, X_AXIS)
+       - Beam::first_visible_stem (beam)->relative_coordinate (0, X_AXIS);
       dydx = dx ? dy/dx : 0;
     }
   else
@@ -79,8 +77,12 @@ Stem_tremolo::brew_molecule (SCM smob)
     // huh?
     tremolo_flags = 1;
 
-  int mult = beam ? beam->get_multiplicity () : 0;
-  Real interbeam_f = me->paper_l ()->interbeam_f (mult);
+  int mult = beam ? Beam::get_multiplicity (beam) : 0;
+  SCM space_proc = me->get_elt_property ("beam-space-function");
+  SCM space = gh_call1 (space_proc, gh_int2scm (mult));
+  Real interbeam_f = gh_scm2double (space) * ss;
+
+
   Molecule mol; 
   for (int i = 0; i < tremolo_flags; i++)
     {
@@ -96,7 +98,7 @@ Stem_tremolo::brew_molecule (SCM smob)
       int beams_i = Stem::beam_count(stem, RIGHT) >? Stem::beam_count (stem, LEFT);
       mol.translate (Offset(stem->relative_coordinate (0, X_AXIS) - me->relative_coordinate (0, X_AXIS),
                            Stem::stem_end_position (stem ) * ss / 2 - 
-                           Directional_element_interface (beam).get () * beams_i * interbeam_f));
+                           Directional_element_interface::get (beam) * beams_i * interbeam_f));
     }
   else
     {  
@@ -127,6 +129,6 @@ Stem_tremolo::brew_molecule (SCM smob)
 void
 Stem_tremolo::set_stem (Score_element*me,Score_element *s)
 {
-  me->set_elt_property ("stem", s->self_scm_);
+  me->set_elt_property ("stem", s->self_scm ());
 }