From: hanwen Date: Thu, 18 Sep 2003 10:05:05 +0000 (+0000) Subject: * lily/beam.cc (set_stem_lengths): single-stem-beam fix. X-Git-Tag: release/2.1.3~148 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=acf55408a86c2861167b2156f6eabab37225ee66;p=lilypond.git * 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. --- diff --git a/ChangeLog b/ChangeLog index cc4a250761..236123afae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2003-09-18 Han-Wen Nienhuys + * 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. diff --git a/input/regression/keys.ly b/input/regression/keys.ly index 6fdae31c50..923085adc1 100644 --- a/input/regression/keys.ly +++ b/input/regression/keys.ly @@ -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 } } diff --git a/input/regression/voice-follower.ly b/input/regression/voice-follower.ly index ab84d342ae..6c0036572a 100644 --- a/input/regression/voice-follower.ly +++ b/input/regression/voice-follower.ly @@ -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. }} diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 238d040137..c7dc984887 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -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 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 const &stems, Direction d = DOWN; do { - if(count[d]) - score[d] /= count[d]; + score[d] /= (count[d] >? 1); } while (flip (&d) != DOWN); diff --git a/lily/beam.cc b/lily/beam.cc index ef9f56ec37..ebec7111a4 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -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 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); } } diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 50bfefca46..0a933e2b06 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -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 diff --git a/stepmake/stepmake/c++-rules.make b/stepmake/stepmake/c++-rules.make index 2b7d2f0989..2f561180c9 100644 --- a/stepmake/stepmake/c++-rules.make +++ b/stepmake/stepmake/c++-rules.make @@ -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$@ $< diff --git a/stepmake/stepmake/c-rules.make b/stepmake/stepmake/c-rules.make index 8a95ef6a9e..289e6c2485 100644 --- a/stepmake/stepmake/c-rules.make +++ b/stepmake/stepmake/c-rules.make @@ -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$@ $<