From a684cb8c12ae5ad35b1e08b05fee2f23617f3963 Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Fri, 16 May 2008 22:57:42 +0100 Subject: [PATCH] Fix issue 463 followVoice switching problem --- input/regression/follow-voice-consecutive.ly | 23 +++++++++++++++++++++++ lily/note-head-line-engraver.cc | 23 +++++++++++------------ 2 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 input/regression/follow-voice-consecutive.ly diff --git a/input/regression/follow-voice-consecutive.ly b/input/regression/follow-voice-consecutive.ly new file mode 100644 index 0000000..97ffc41 --- /dev/null +++ b/input/regression/follow-voice-consecutive.ly @@ -0,0 +1,23 @@ +\version "2.11.46" + +\header { + texidoc= "The voice follower is not confused when set for consecutive +sets of staff switches." +} + +\new PianoStaff \relative c' << + \new Staff = "one" { + c4 + \showStaffSwitch + \change Staff = two + a4 + \hideStaffSwitch + \change Staff = one + c4 + \showStaffSwitch + \change Staff = two + a4 + \hideStaffSwitch + } + \new Staff = "two" { \clef bass s1 } +>> diff --git a/lily/note-head-line-engraver.cc b/lily/note-head-line-engraver.cc index 152297d..c00da9e 100644 --- a/lily/note-head-line-engraver.cc +++ b/lily/note-head-line-engraver.cc @@ -54,20 +54,19 @@ void Note_head_line_engraver::acknowledge_rhythmic_head (Grob_info info) { head_ = info.grob (); - if (to_boolean (get_property ("followVoice"))) + Context *tr = context (); + + while (tr && !tr->is_alias (ly_symbol2scm ("Staff"))) + tr = tr->get_parent_context (); + + if (tr + && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_ + && to_boolean (get_property ("followVoice"))) { - Context *tr = context (); - while (tr && !tr->is_alias (ly_symbol2scm ("Staff"))) - tr = tr->get_parent_context (); - - if (tr - && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_) - { - if (last_head_) - follow_ = true; - last_staff_ = tr; - } + if (last_head_) + follow_ = true; } + last_staff_ = tr; } void -- 1.5.4.3