]> git.donarmstrong.com Git - lilypond.git/commitdiff
Search of context hierarchy for voice for lyrics is optional
authorTrevor Daniels <t.daniels@treda.co.uk>
Fri, 8 Apr 2011 07:26:15 +0000 (08:26 +0100)
committerTrevor Daniels <t.daniels@treda.co.uk>
Fri, 8 Apr 2011 07:26:15 +0000 (08:26 +0100)
 - 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

lily/lyric-engraver.cc
ly/engraver-init.ly
scm/define-context-properties.scm

index eafde88b33c6792e83bf304ddc6a0daab5c2dfc8..c52cba8356cb59f25bfb678ef3e9dc164dc8e4b0 100644 (file)
@@ -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 */
                ""
index 8cfd9db44ca4e969cd52e40d115cac00525c1288..6fccc5d134631328abaf0e4efe3292a8a7b712ed 100644 (file)
@@ -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 = #'()
index 439f68a72e08885eaf71919dfad4cf1a311d6437..a813f1421f6b90ae8d8d9e7fba41000e8ebcb84a 100644 (file)
@@ -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}.")