]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.5.39.jcn4
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 14 Mar 2002 21:45:08 +0000 (22:45 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 14 Mar 2002 21:45:08 +0000 (22:45 +0100)
VERSION
input/baerenreiter-sarabande.ly
input/regression/beam-center-slope.ly
lily/include/new-beam.hh
lily/new-beam.cc
scm/grob-description.scm

diff --git a/VERSION b/VERSION
index b87d0a34aad419ed07c06b0397bcd5228cee5970..d9b2f019bc88b1c7bd4f0e5df2a07ff7f15c2d01 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=39
-MY_PATCH_LEVEL=jcn3
+MY_PATCH_LEVEL=jcn4
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 7a41495daa67888be615b5e821b77e6090188d9c..175735eef1798d96378819f88d08e621a60e07c4 100644 (file)
@@ -97,10 +97,10 @@ sarabandeA =  \context Voice \notes \relative c {
     \\
     { f,4 fis4. s8 |
       <d4 g,> gis4.   } >
-  \stemUp
+  \voiceOne
   d16(cis)d f,
   [a,8 e']
-  \stemBoth
+  \oneVoice
   [d' cis] |
   d4 d,,2 |
 }
index cec90fc4f202b3b2ea96502fdd0557dffab16293..c8536f79d350924dc1439c90223f383b4ef8bf57 100644 (file)
@@ -2,9 +2,9 @@
   texidoc="Simple beams on middle line should be allowed to have a slope."
 }
 \score{
-    \notes\relative c''{
-       [b'8 a] [a b]
-       [a,,8 b] [b a]
+    \notes\relative c'{
+       [b8 c] [c b]
+       [b''8 a] [a b]
     }
     \paper{
        linewidth = 0.0
index 2326be7f5bb9383531ec155dab50d236d8285b7d..660ec8e249f160c6db33ac0e3e9b5f0e5be3b831 100644 (file)
@@ -28,15 +28,13 @@ public:
   DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
+  DECLARE_SCHEME_CALLBACK (end_after_line_breaking, (SCM));
 
-  /*
-    y-dy callbacks
-   */
+  /* position callbacks */
   DECLARE_SCHEME_CALLBACK (least_squares, (SCM));
   DECLARE_SCHEME_CALLBACK (check_concave, (SCM));
   DECLARE_SCHEME_CALLBACK (slope_damping, (SCM));
   DECLARE_SCHEME_CALLBACK (quantise_position, (SCM));
-  DECLARE_SCHEME_CALLBACK (user_override, (SCM));
 
   static Molecule stem_beams (Grob*,Item *here, Item *next, Item *prev,
                              Real dydx);
index 3a27ce79834203defbc7364c596d1cb6ff2cd070..fd7efea0543ab689fbd0c6dca24a4f4e049fc3a7 100644 (file)
@@ -11,8 +11,8 @@
 /*
   [TODO]
 
-  * Fix XXX
-
+  * different left/right quanting: slope, multiplicity
+  
   * Fix TODO
   
   * Junk stem_info.
@@ -293,11 +293,18 @@ MAKE_SCHEME_CALLBACK (New_beam, after_line_breaking, 1);
 SCM
 New_beam::after_line_breaking (SCM smob)
 {
-  Grob *me =  unsmob_grob (smob);
+  Grob *me = unsmob_grob (smob);
   
   /* Copy to mutable list. */
-  me->set_grob_property ("position",
-                        ly_deep_copy (me->get_grob_property ("position")));
+  SCM s = ly_deep_copy (me->get_grob_property ("position"));
+  me->set_grob_property ("position", s);
+
+  if (ly_car (s) != SCM_BOOL_F)
+    return SCM_UNSPECIFIED;
+
+  SCM callbacks = me->get_grob_property ("position-callbacks");
+  for (SCM i = callbacks; gh_pair_p (i); i = ly_cdr (i))
+    gh_call1 (ly_car (i), smob);
 
   return SCM_UNSPECIFIED;
 }
@@ -327,8 +334,9 @@ New_beam::least_squares (SCM smob)
       if (!ideal[LEFT] && chord.delta () && count == 2)
        {
          Direction d = (Direction)(sign (chord.delta ()) * dir);
-         pos[d] = d * gh_scm2double (me->get_grob_property ("thickness")) / 2;
-         pos[-d] = 0;
+         pos[d] = gh_scm2double (me->get_grob_property ("thickness")) / 2
+           * dir;
+         pos[-d] = - pos[d];
        }
       else
        pos = ideal;
@@ -477,8 +485,8 @@ New_beam::quantise_interval (Grob *me, Interval pos, Direction quant_dir)
                                      SCM_UNDEFINED));
   
   Array<Real> a;
-  for (; gh_pair_p (quants); quants = ly_cdr (quants))
-    a.push (gh_scm2double (ly_car (quants)));
+  for (SCM i = quants; gh_pair_p (i); i = ly_cdr (i))
+    a.push (gh_scm2double (ly_car (i)));
   
   if (a.size () <= 1)
     return pos;
@@ -486,16 +494,42 @@ New_beam::quantise_interval (Grob *me, Interval pos, Direction quant_dir)
   Direction dir = Directional_element_interface::get (me);
   Interval left = quantise_iv (a, pos[LEFT]*dir/staff_space) * staff_space;
   Interval right = quantise_iv (a, pos[RIGHT]*dir/staff_space) * staff_space;
+  
+  Real dy = pos.delta ();
+  Real ady = abs (dy);
+
+  // quant direction hints disabled for now
+  int q = 0;//(int)quant_dir;
 
-  if (quant_dir)
-    return Interval (left[quant_dir]*dir, right[quant_dir]*dir);
+  /* TODO: make smart choice, find best left/right quants pair.
+
+     Slope should never be steeper than least_squares (before damping)
+     (save that value?)
+     Slope should never be reduced to zero.
+   */
+  Interval qpos (0, 20.0 *sign (dy));
+  Direction ldir = LEFT;
+  do
+    {
+      Direction rdir = LEFT;
+      do
+       {
+         Interval i (left[ldir]*dir, right[rdir]*dir);
+         if ((abs (abs (i.delta ()) - ady) <= abs (abs (qpos.delta ()) - ady)
+       && sign (i.delta ()) == sign (pos.delta ())
+       && (!q
+          || (i[LEFT]*q >= pos[LEFT]*q && i[RIGHT]*q >= pos[RIGHT]*q))))
+           qpos = i;
+       }
+      while (flip (&rdir) != LEFT);
+    }
+  while (flip (&ldir) != LEFT);
   
-  /* XXX TODO: some intelligent choice of quants */
-  return Interval (left[MAX]*dir, right[MAX]*dir);
+  return qpos;
 }
 
 
-/* Quantise vertial position (left and right) of beam.
+/* Quantise vertical position (left and right) of beam.
    Generalisation of [Ross]. */
 MAKE_SCHEME_CALLBACK (New_beam, quantise_position, 1);
 SCM
@@ -510,6 +544,7 @@ New_beam::quantise_position (SCM smob)
   
   me->set_grob_property ("position", ly_interval2scm (pos));
   set_stem_lengths (me);
+
   pos = ly_scm2interval (me->get_grob_property ("position"));
   
   y_shift = check_stem_length_f (me, pos);
@@ -529,37 +564,17 @@ New_beam::quantise_position (SCM smob)
     }
   
   me->set_grob_property ("position", ly_interval2scm (pos));
+
   return SCM_UNSPECIFIED;
 }
 
-/* It's tricky to have the user override y, dy directly, so we use this
-   translation func.  Also, if our staff_space != 1 (smaller staff, eg),
-   user will expect staff-position to be discrete values. */
-MAKE_SCHEME_CALLBACK (New_beam, user_override, 1);
+MAKE_SCHEME_CALLBACK (New_beam, end_after_line_breaking, 1);
 SCM
-New_beam::user_override (SCM smob)
+New_beam::end_after_line_breaking (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-
-  // UGR, MOVE ME
   set_stem_lengths (me);
-#if 0
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-  SCM s = me->get_grob_property ("staff-position");
-  if (gh_number_p (s))
-    {
-      Real y = gh_scm2double (s) * staff_space * 0.5;
-      me->set_grob_property ("y", gh_double2scm (y));
-    }
-
-  /* Name suggestions? Tilt, slope, vertical-* ? */
-  s = me->get_grob_property ("height");
-  if (gh_number_p (s))
-    {
-      Real dy = gh_scm2double (s) * staff_space * 0.5;
-      me->set_grob_property ("dy", gh_double2scm (dy));
-    }
-#endif  
+  
   return SCM_UNSPECIFIED;
 }
 
index ccd0c0afa7d5418a7535a2d5201419ec8bc8cc85..78a8fad33851632aca807b21665c394e3be00456 100644 (file)
        (position-callbacks . (,New_beam::least_squares
                               ,New_beam::check_concave
                               ,New_beam::slope_damping
-                              ,New_beam::quantise_position
-                              ,New_beam::user_override))
+                              ,New_beam::quantise_position))
        
        (thickness . 0.48) ; in staff-space
        (before-line-breaking-callback . ,Beam::before_line_breaking)
        ;;(after-line-breaking-callback . ,Beam::after_line_breaking)
        (after-line-breaking-callback . (,New_beam::after_line_breaking
-                                        ,New_beam::least_squares
-                                        ,New_beam::check_concave
-                                        ,New_beam::slope_damping
-                                        ,New_beam::quantise_position
-                                        ,New_beam::user_override))
+                                        ,New_beam::end_after_line_breaking))
        (neutral-direction . -1)
        (dir-function . ,beam-dir-majority)
        (height-quant-function .  ,default-beam-dy-quants)