]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam.cc (set_stem_lengths): single-stem-beam fix.
authorhanwen <hanwen>
Thu, 18 Sep 2003 10:05:05 +0000 (10:05 +0000)
committerhanwen <hanwen>
Thu, 18 Sep 2003 10:05:05 +0000 (10:05 +0000)
* stepmake/stepmake/c-rules.make ($(outdir)/%.c): use -o for flex.

* lily/beam-quanting.cc (quanting): check french-beaming per stem.
(score_stem_lengths): do something sensible for single stem beams.

* lily/beam.cc (least_squares): add kludge for single stem beams.

* scripts/convert-ly.py (FatalConversionError.sub_alteration): add
keySignature to list of broken things.

* input/regression/keys.ly: fix.

ChangeLog
input/regression/keys.ly
input/regression/voice-follower.ly
lily/beam-quanting.cc
lily/beam.cc
scripts/convert-ly.py
stepmake/stepmake/c++-rules.make
stepmake/stepmake/c-rules.make

index cc4a2507617278dffa990d2bfd4dacf5019dc51f..236123afae35631c666370daa4ff02a57747951b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2003-09-18  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * lily/beam.cc (set_stem_lengths): single-stem-beam fix.
+
+       * stepmake/stepmake/c-rules.make ($(outdir)/%.c): use -o for flex.
+
+       * lily/beam-quanting.cc (quanting): check french-beaming per stem.
+       (score_stem_lengths): do something sensible for single stem beams.
+
+       * lily/beam.cc (least_squares): add kludge for single stem beams.
+
+       * scripts/convert-ly.py (FatalConversionError.sub_alteration): add
+       keySignature to list of broken things.
+
+       * input/regression/keys.ly: fix.
+
        * VERSION (PACKAGE_NAME): release 1.9.7
 
        * Documentation/topdocs/NEWS.texi (Top): add quarter tones.
index 6fdae31c50d35bd3491833089e310533e74e8ac1..923085adc15cd47bae511b1661299a6bb5a8dae6 100644 (file)
@@ -1,5 +1,5 @@
 
-\version "1.9.4"
+\version "1.9.7"
 \header{
 texidoc="
 Key signatures appear on key  changes. They may also
@@ -22,7 +22,7 @@ also created on a clef change.
     \break
     \key bes \major % \major
     c2 \clef alto c2   \key d \major \clef treble c2
-       \property Staff. keySignature = #'((2 . -1)  (6 . -1) (4 . -1))
+       \property Staff. keySignature = #'((2 . -1)  (6 . 3) (4 . -2))
        e2
   }
 }
index ab84d342ae7d9290f17e2327c1ca092c4b1c6c7f..6c0036572a335704acffa3811acd53478d4d452d 100644 (file)
@@ -13,12 +13,12 @@ can be printed automatically. This is enabled if the property
 \notes \relative c'
 \context PianoStaff <<
     \property PianoStaff.followVoice = ##t
-    \context Staff \context Voice {
+    \context Staff = one \context Voice {
       c1
       \translator Staff=two
       b2 a
     }
-    \new Staff {\clef bass \skip 1*2 }
+    \context Staff = two {\clef bass \skip 1*2 }
   >>\paper{ 
 linewidth =-1.
 }}
index 238d0401371ef48163f2590c7f13962b489db98b..c7dc9848879c2f37e65f4529a1b576a0febe9fb6 100644 (file)
@@ -141,14 +141,15 @@ Beam::quanting (SCM smob)
     stem_y != 0.0, when we're cross staff.
     
    */
-  bool french = to_boolean (me->get_grob_property ("french-beaming"));
   for (int i= 0; i < stems.size(); i++)
     {
       Grob*s = stems[i];
       stem_infos.push (Stem::get_stem_info (s));
       dirs_found[stem_infos.top ().dir_] = true;
 
-      bool f = french && i > 0&& (i < stems.size  () -1);
+      bool f = to_boolean (s->get_grob_property ("french-beaming"))
+        && s != lvs && s != fvs;
+
       base_lengths.push (calc_stem_y (me, s, common, xl, xr,
                                      Interval (0,0), f));
       stem_xposns.push (s->relative_coordinate (common[X_AXIS], X_AXIS));
@@ -272,7 +273,7 @@ Beam::score_stem_lengths (Link_array<Grob> const &stems,
 
       Real x = stem_xs[i];
       Real dx = xr-xl;
-      Real beam_y = yr *(x - xl)/dx + yl * ( xr - x)/dx;
+      Real beam_y = dx ? yr *(x - xl)/dx + yl * ( xr - x)/dx : (yr + yl)/2;
       Real current_y = beam_y + base_stem_ys[i];
       Real length_pen = STEM_LENGTH_DEMERIT_FACTOR;
       
@@ -298,8 +299,7 @@ Beam::score_stem_lengths (Link_array<Grob> const &stems,
   Direction d = DOWN;
   do
     { 
-      if(count[d])
-       score[d] /= count[d];
+      score[d] /= (count[d] >? 1);
     }
   while (flip (&d) != DOWN);
 
index ef9f56ec379305a1af08ab9412734447e3f4f037..ebec7111a432c1a2944d619bd7b8fa70b02f627f 100644 (file)
@@ -799,7 +799,7 @@ Beam::least_squares (SCM smob)
   int count = visible_stem_count (me);
   Interval pos (0, 0);
   
-  if (count <= 1)
+  if (count < 1)
     {
       me->set_grob_property ("positions", ly_interval2scm (pos));
       return SCM_UNSPECIFIED;
@@ -832,6 +832,7 @@ Beam::least_squares (SCM smob)
     }
   Real dx = last_visible_stem (me)->relative_coordinate (commonx, X_AXIS) - x0;
 
+  
   Real y =0;  
   Real dydx = 0;
   Real dy = 0;
@@ -860,9 +861,18 @@ Beam::least_squares (SCM smob)
          pos = ideal;
        }
 
+      /*
+       For broken beams this doesn't work well. In this case, the
+        slope esp. of the first part of a broken beam should predict
+        where the second part goes.
+       */
+
       y = pos[LEFT];
       dy = pos[RIGHT]- y;
       dydx = dy/dx;
+
+
+
     }
   else
     {
@@ -877,6 +887,7 @@ Beam::least_squares (SCM smob)
                               + s->relative_coordinate (commony, Y_AXIS)
                               - my_y));
        }
+      
       minimise_least_squares (&dydx, &y, ideals);
 
       dy = dydx * dx;
@@ -1225,7 +1236,7 @@ Beam::set_stem_lengths (Grob *me)
   Link_array<Grob> stems=
     Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems");
 
-  if (stems.size () <= 1)
+  if (!stems.size ())
     return;
   
   Grob *common[2];
@@ -1239,10 +1250,10 @@ Beam::set_stem_lengths (Grob *me)
   Real thick =0.0;
   if (gh_number_p (me->get_grob_property ("gap"))
       &&gh_scm2double (me->get_grob_property ("gap")))
-  {
-    gap = true;
-    thick = get_thickness(me);
-  }
+    {
+      gap = true;
+      thick = get_thickness(me);
+    }
       
   // ugh -> use commonx
   Grob * fvs = first_visible_stem (me);
@@ -1257,11 +1268,10 @@ 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));
+                                pos, french && s != lvs && s!= fvs);
 
       /*
        Make the stems go up to the end of the beam. This doesn't matter
@@ -1269,7 +1279,7 @@ Beam::set_stem_lengths (Grob *me)
        */
       if (gap)
        stem_y += thick * 0.5 * Directional_element_interface::get(s);
-      
+
       Stem::set_stemend (s, 2* stem_y / staff_space);
     }
 }
index 50bfefca46c0fba02a3f998b9cd887874091a6a6..0a933e2b0650a7ba46e99b34bc10e0f370b045ab 100644 (file)
@@ -1558,11 +1558,15 @@ Please hand-edit, using
 as a substitution text.""" % (m.group (1), m.group (2)) )
                raise FatalConversionError ()
 
-       if re.search ("ly:(make-pitch|pitch-alteration)", str):
+       if re.search ("ly:(make-pitch|pitch-alteration)", str) \
+              or re.search ("keySignature", str):
                sys.stderr.write (
 """The alteration field of Scheme pitches was multiplied by 2
-to support quarter tone accidentals. Please edit ly:make-pitch and
-ly:pitch-alteration calls by hand""")
+to support quarter tone accidentals. You have to edit the following constructs by hand:
+
+* calls of  ly:make-pitch and ly:pitch-alteration
+* keySignature settings made with \property
+""")
                raise FatalConversionError ()
        
        return str
index 2b7d2f0989c4acd5b7277690980b2c664a0fa6a6..2f561180c9cab78f8ef653435daa0c6ea0ca8f16 100644 (file)
@@ -25,4 +25,4 @@ $(outdir)/%.hh: %.yy
        rm -f $(outdir)/$(*F).cc # avoid recompiling the .cc file 
 
 $(outdir)/%.cc: %.ll
-       $(FLEX) -Cfe -p -p -t $< > $@
+       $(FLEX) -Cfe -p -p -o$@ $< 
index 8a95ef6a9eb8d46d5748059006fbc4a797ed1c8d..289e6c24850cda7bce55432263e6a901c43aab4b 100644 (file)
@@ -22,7 +22,7 @@ $(outdir)/%.h: %.y
        rm -f $(*F).tab.c # if this happens in the wrong order it triggers recompile of the .cc file 
 
 $(outdir)/%.c: %.l
-       $(FLEX) -Cfe -p -p -t $< > $@
+       $(FLEX) -Cfe -p -p -o$@ $<
 # could be faster:
-#      $(FLEX) -8 -Cf -t $< > $@
+#      $(FLEX) -8 -Cf -o$@ $<