]> git.donarmstrong.com Git - lilypond.git/commitdiff
bfs
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 13 Jul 2002 18:05:19 +0000 (18:05 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 13 Jul 2002 18:05:19 +0000 (18:05 +0000)
ChangeLog
lily/beam.cc
lily/include/lily-guile.hh
lily/include/stem.hh
lily/lily-guile.cc
lily/stem-tremolo.cc
lily/stem.cc

index c55040994f937df333df5df95e8539f3f6e26f25..fc55e0ef80d8460c4e237fdbde59cd649d59369b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2002-07-13  Han-Wen  <hanwen@cs.uu.nl>
 
+       * lily/stem-tremolo.cc (brew_molecule): add code for stem tremolos.
+
        * lily/auto-beam-engraver.cc (create_beam_p): remember Beam
        settings at the start of a potential auto beam.
 
index acfb18ff7a43d229d419840941d9f03b355016d6..2cd3887e2518a552a66a72d4607a9195e9ce6f9c 100644 (file)
@@ -71,33 +71,6 @@ shrink_extra_weight (Real x)
   return fabs (x) * ((x < 0) ? 1.5 : 1.0);
 }
 
-// move to somewhree?
-Slice
-int_list_to_slice (SCM l)
-{
-  Slice s;
-  s.set_empty ();
-  for (; gh_pair_p (l); l = gh_cdr (l))
-    {
-      if (gh_number_p (gh_car (l)))
-       s.add_point (gh_scm2int (gh_car (l))); 
-    }
-
-  return s;
-}
-
-// move to stem?
-Slice
-stem_beam_multiplicity (Grob *stem)
-{
-  SCM beaming= stem->get_grob_property ("beaming");
-  Slice l = int_list_to_slice (gh_car (beaming));
-  Slice r = int_list_to_slice (gh_cdr (beaming));
-  l.unite (r);
-
-  return l;
-}
-
 void
 Beam::add_stem (Grob *me, Grob *s)
 {
@@ -130,7 +103,7 @@ Beam::get_beam_count (Grob *me)
     {
       Grob *sc = unsmob_grob (ly_car (s));
       
-      m = m >? (stem_beam_multiplicity (sc).length () + 1);
+      m = m >? (Stem::beam_multiplicity (sc).length () + 1);
     }
   return m;
 }
@@ -306,7 +279,9 @@ Beam::brew_molecule (SCM grob)
   SCM last_beaming = SCM_EOL;;
   Real last_xposn = -1;
   Real last_width = -1 ;
-  
+
+
+  SCM gap = me->get_grob_property ("gap");
   Molecule the_beam;
   Real lt = me->paper_l ()->get_var ("linethickness");
   for (int i = 0; i< stems.size(); i++)
@@ -363,6 +338,13 @@ Beam::brew_molecule (SCM grob)
            {
              width_corr += stem_width/2;
            }
+
+         if (gh_number_p (gap))
+           {
+             Real g = gh_scm2double (gap);
+             stem_offset += g;
+             width_corr -= 2*g; 
+           }
          
          Molecule whole = Lookup::beam (dydx, w + width_corr, thick);
          for (int j = fullbeams.size(); j--;)
@@ -1388,7 +1370,7 @@ Beam::calc_stem_y (Grob *me, Grob* s, Interval pos, bool french)
     }
   else
     {
-      stem_y += (stem_beam_multiplicity(s)[my_dir]) * beam_space;
+      stem_y += (Stem::beam_multiplicity(s)[my_dir]) * beam_space;
     }
 
   return stem_y;
index 105c1030f0b13ea7ba18903e47f9d72650b85f7e..03bdd0bbf46ecc550bb68bab64d210609ce4456e 100644 (file)
@@ -146,6 +146,7 @@ Offset ly_scm2offset (SCM);
 SCM ly_assoc_chain (SCM key, SCM achain);
 SCM ly_assoc_cdr (SCM key, SCM alist);
 Interval ly_scm2interval (SCM);
+Slice int_list_to_slice (SCM l);
 SCM ly_interval2scm (Drul_array<Real>);
 
 void taint (SCM *);
index 13146d21650d8e80e6884fc944bd18eafd6ce4aa..db82579fd30e5e62bcaf2aafa03f5da23c40d910 100644 (file)
@@ -31,6 +31,7 @@ public:
   static Direction get_direction (Grob*) ;
   static void set_stemend (Grob *,Real);
   static Direction get_default_dir (Grob *) ;
+  static Slice Stem::beam_multiplicity (Grob *stem);
 
   static int head_count (Grob *) ;
   static bool invisible_b (Grob *) ;
index 8e31e897e673354fb3980c18d94cffcfa2840541..69990c82b1015e7253c3c2623afd3fc9d4e3c08a 100644 (file)
@@ -797,3 +797,18 @@ display_list (SCM s)
   scm_puts (")", p);
   return SCM_UNSPECIFIED;
 }
+
+Slice
+int_list_to_slice (SCM l)
+{
+  Slice s;
+  s.set_empty ();
+  for (; gh_pair_p (l); l = gh_cdr (l))
+    {
+      if (gh_number_p (gh_car (l)))
+       s.add_point (gh_scm2int (gh_car (l))); 
+    }
+
+  return s;
+}
+
index dc31df02702f3fa72fd7cdfea255e999f36c0c03..24f15420f0432d2c71e29ad3ceb91038f78fe6fc 100644 (file)
@@ -120,14 +120,13 @@ Stem_tremolo::brew_molecule (SCM smob)
   Interval mol_ext = mol.extent (Y_AXIS);
 
   // ugh, rather calc from Stem_tremolo_req
+  int beams_i = (beam) ? (Stem::beam_multiplicity (stem).length ()+ 1): 0;
 
   /*
     TODO.
    */
-  
-  assert(false);
 
-  int beams_i = 0;  
+
   Real beamthickness = 0.0;
   SCM sbt = (beam) ? beam->get_grob_property ("thickness") : SCM_EOL ;
   if (gh_number_p (sbt))
index f7a8752e9f023505db4e3082702f518f7c69adac..4803c3ba065d65157a33a359398e0790c0bfeba8 100644 (file)
@@ -920,7 +920,22 @@ Stem::calc_stem_info (Grob*me)
   return si;
 }
 
+
+// move to stem?
+Slice
+Stem::beam_multiplicity (Grob *stem)
+{
+  SCM beaming= stem->get_grob_property ("beaming");
+  Slice l = int_list_to_slice (gh_car (beaming));
+  Slice r = int_list_to_slice (gh_cdr (beaming));
+  l.unite (r);
+
+  return l;
+}
+
+
 ADD_INTERFACE (Stem,"stem-interface",
   "A stem",
   "up-to-staff avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length style no-stem-extend flag-style dir-forced");
 
+