From: Trevor Daniels Date: Fri, 8 Apr 2011 07:26:15 +0000 (+0100) Subject: Search of context hierarchy for voice for lyrics is optional X-Git-Tag: release/2.13.59-1~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4133b4e0ec939a427a70361ad838c65a84a0dfda;p=lilypond.git Search of context hierarchy for voice for lyrics is optional - add new context property, searchForVoice, to indicate whether the extended search for a voice containing lyric rhythms should be conducted - fixes 1579 * lily/lyric-engraver.cc test searchForVoice in get_voice_to_lyrics () to decide whether to conduct an extended search * ly/engraver-init.ly set default value of searchForVoice to #f (also in passing remove duplicated instrumentname and shortInstrumentName settings) * scm/define-context-properties.scm add and document searchForVoice --- diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index eafde88b33..c52cba8356 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -92,6 +92,8 @@ Lyric_engraver::process_music () Context * get_voice_to_lyrics (Context *lyrics) { + bool searchForVoice = to_boolean (lyrics->get_property ("searchForVoice")); + SCM avc = lyrics->get_property ("associatedVoiceContext"); if (Context *c = unsmob_context (avc)) return c; @@ -101,7 +103,7 @@ get_voice_to_lyrics (Context *lyrics) if (scm_is_string (voice_name)) nm = ly_scm2string (voice_name); - else if (nm == "") + else if (nm == "" || !searchForVoice) return 0; else { @@ -202,7 +204,8 @@ ADD_TRANSLATOR (Lyric_engraver, /* read */ "ignoreMelismata " "includeGraceNotes " - "lyricMelismaAlignment ", + "lyricMelismaAlignment " + "searchForVoice", /* write */ "" diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 8cfd9db44c..6fccc5d134 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -421,9 +421,6 @@ centered between the staves surrounding this context." printing of a single line of lyrics." \name "Lyrics" - instrumentName = #'() - shortInstrumentName = #'() - \consists "Lyric_engraver" \consists "Extender_engraver" \consists "Hyphen_engraver" @@ -431,6 +428,7 @@ printing of a single line of lyrics." \consists "Instrument_name_engraver" \consists "Font_size_engraver" \consists "Hara_kiri_engraver" + searchForVoice = ##f %% explicitly set instrument, so it is not inherited from the parent instrumentName = #'() shortInstrumentName = #'() diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 439f68a72e..a813f1421f 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -418,7 +418,9 @@ is set.") (restNumberThreshold ,number? "If a multimeasure rest has more measures than this, a number is printed.") - + (searchForVoice ,boolean? "Signal whether a search should be made +of all contexts in the context hierarchy for a voice to provide rhythms +for the lyrics.") (shapeNoteStyles ,vector? "Vector of symbols, listing style for each note head relative to the tonic (qv.) of the scale.") (shortInstrumentName ,markup? "See @code{instrumentName}.")