X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmelody-spanner.cc;h=8e95b4dc8c0c4c90509a8e81a781c8da0a5ded63;hb=dd8957f427c18ac448be3e0e0d84110c599430aa;hp=d4901f2c9b1a12a9958132fdc7b133e0af3ef928;hpb=44ad1d66c072e4d6545e75c769c86a460cb1df13;p=lilypond.git diff --git a/lily/melody-spanner.cc b/lily/melody-spanner.cc index d4901f2c9b..8e95b4dc8c 100644 --- a/lily/melody-spanner.cc +++ b/lily/melody-spanner.cc @@ -1,10 +1,21 @@ /* - melody-spanner.cc -- implement Melody_spanner + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2005--2010 Han-Wen Nienhuys - (c) 2005--2006 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "melody-spanner.hh" @@ -20,14 +31,14 @@ /* Interpolate stem directions for neutral stems. */ -MAKE_SCHEME_CALLBACK(Melody_spanner,calc_neutral_stem_direction, 1); +MAKE_SCHEME_CALLBACK (Melody_spanner, calc_neutral_stem_direction, 1); SCM Melody_spanner::calc_neutral_stem_direction (SCM smob) { Grob *stem = unsmob_grob (smob); Grob *me = unsmob_grob (stem->get_object ("melody-spanner")); if (!me || !me->is_live ()) - return SCM_UNSPECIFIED; + return scm_from_int (DOWN); extract_grob_set (me, "stems", stems); @@ -41,7 +52,8 @@ Melody_spanner::calc_neutral_stem_direction (SCM smob) && !dirs[next_nonneutral]) next_nonneutral++; - while (last_nonneutral == VPOS || last_nonneutral < dirs.size () - 1) + SCM retval = SCM_EOL; + while (last_nonneutral == VPOS || last_nonneutral + 1 < dirs.size ()) { Direction d1 = CENTER; Direction d2 = CENTER; @@ -61,8 +73,12 @@ Melody_spanner::calc_neutral_stem_direction (SCM smob) total = to_dir (me->get_property ("neutral-direction")); for (vsize i = last_nonneutral + 1; i < next_nonneutral; i++) - stems[i]->set_property ("neutral-direction", scm_from_int (total)); - + { + if (stems[i] == stem) + retval = scm_from_int (total); + else + stems[i]->set_property ("neutral-direction", scm_from_int (total)); + } last_nonneutral = next_nonneutral; while (last_nonneutral < dirs.size () @@ -76,8 +92,7 @@ Melody_spanner::calc_neutral_stem_direction (SCM smob) next_nonneutral++; } - me->suicide (); - return SCM_UNSPECIFIED; + return retval; } void @@ -91,7 +106,9 @@ Melody_spanner::add_stem (Grob *me, Grob *stem) ADD_INTERFACE (Melody_spanner, "Context dependent typesetting decisions.", + /* properties */ "stems " - "neutral-direction "); + "neutral-direction " + );