X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Faccidental-engraver.cc;h=fcc9fcb97792643723097414cbe6cbdb600ba289;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=5bc78357b25d861b50f73377909af0419aa5bde7;hpb=5bbfc22fce036b9b69df5e420de93e11da23c05e;p=lilypond.git diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 5bc78357b2..fcc9fcb977 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1997--2014 Han-Wen Nienhuys + Copyright (C) 1997--2015 Han-Wen Nienhuys Modified 2001--2002 by Rune Zedeler LilyPond is free software: you can redistribute it and/or modify @@ -131,7 +131,7 @@ Accidental_engraver::update_local_key_signature (SCM new_sig) */ SCM val; - while (trans && trans->where_defined (ly_symbol2scm ("localAlterations"), &val) == trans) + while (trans && trans->here_defined (ly_symbol2scm ("localAlterations"), &val)) { trans->set_property ("localAlterations", ly_deep_copy (last_keysig_)); trans = trans->get_parent_context (); @@ -367,6 +367,18 @@ Accidental_engraver::stop_translation_timestep () for (vsize j = ties_.size (); j--;) { Grob *r = Tie::head (ties_[j], RIGHT); + Grob *l = Tie::head (ties_[j], LEFT); + if (l && r) + { + // Don't mark accidentals as "tied" when the pitch is not + // actually the same. This is relevant for enharmonic ties. + Stream_event *le = Stream_event::unsmob (l->get_property ("cause")); + Stream_event *re = Stream_event::unsmob (r->get_property ("cause")); + if (le && re + && !ly_is_equal (le->get_property ("pitch"), re->get_property ("pitch"))) + continue; + } + for (vsize i = accidentals_.size (); i--;) if (accidentals_[i].head_ == r) { @@ -452,22 +464,20 @@ Accidental_engraver::acknowledge_rhythmic_head (Grob_info info) Stream_event *note = info.event_cause (); if (note && (note->in_event_class ("note-event") - || note->in_event_class ("trill-span-event"))) + || note->in_event_class ("trill-span-event")) + // option to skip accidentals on string harmonics + && (to_boolean (get_property ("harmonicAccidentals")) + || info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic")) + // ignore accidentals in non-printing voices like NullVoice + && !to_boolean (info.context ()->get_property ("nullAccidentals"))) { - /* - string harmonics usually don't have accidentals. - */ - if (info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic") - || to_boolean (get_property ("harmonicAccidentals"))) - { - Accidental_entry entry; - entry.head_ = info.grob (); - entry.origin_engraver_ = dynamic_cast (info.origin_translator ()); - entry.origin_ = entry.origin_engraver_->context (); - entry.melodic_ = note; + Accidental_entry entry; + entry.head_ = info.grob (); + entry.origin_engraver_ = dynamic_cast (info.origin_translator ()); + entry.origin_ = entry.origin_engraver_->context (); + entry.melodic_ = note; - accidentals_.push_back (entry); - } + accidentals_.push_back (entry); } }