From: Han-Wen Nienhuys Date: Tue, 23 Sep 2003 10:31:17 +0000 (+0000) Subject: (staff_eligible): new function. X-Git-Tag: release/1.9.10~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4e8105927a6c0e82b761b3462d905e84b8b1f908;p=lilypond.git (staff_eligible): new function. (stop_translation_timestep): kill off spanners if not eligible. --- diff --git a/ChangeLog b/ChangeLog index 33174d74cb..3e8b7b451a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-09-23 Han-Wen Nienhuys + * lily/volta-engraver.cc (staff_eligible): new function. + (stop_translation_timestep): kill off spanners if not eligible. + * VERSION (PATCH_LEVEL): release 1.9.9 * input/regression/beam-quanting-32nd.ly (texidoc): new file diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 8e3eae139c..36868bac6e 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -4315,6 +4315,14 @@ adding fermatas: R2.^\fermataMarkup @end lilypond +If you want to have a text on the left end of a multi-measure rest, +attach the text to a zero-length skip note, i.e. + +@example + s1*0^"Allegro" + R1*4 +@end example + @cindex whole rests for a full measure diff --git a/input/regression/repeat-volta-skip-alternatives.ly b/input/regression/repeat-volta-skip-alternatives.ly index 963407b5ab..30effa0c48 100644 --- a/input/regression/repeat-volta-skip-alternatives.ly +++ b/input/regression/repeat-volta-skip-alternatives.ly @@ -1,11 +1,13 @@ \version "1.9.8" \header { - texidoc = "When too few alternatives are present, the first alternative is repeated, -by printing a range for the 1st repeat." - } + texidoc = "When too few alternatives are present, the first +alternative is repeated, by printing a range for the 1st repeat." -\score { \notes \context Voice { +} + + +\score { \notes \relative c'' \context Voice { \repeat volta 3 c1 \alternative { d f } e4 } } diff --git a/lily/volta-engraver.cc b/lily/volta-engraver.cc index e95718b121..195a258c58 100644 --- a/lily/volta-engraver.cc +++ b/lily/volta-engraver.cc @@ -31,13 +31,15 @@ protected: virtual void finalize (); virtual void stop_translation_timestep (); virtual void process_music (); - virtual void process_acknowledged_grobs (); Moment started_mom_; Spanner *volta_span_; Spanner *end_volta_span_; SCM staff_; SCM start_string_; + + bool staff_eligible (); + }; Volta_engraver::Volta_engraver () @@ -48,11 +50,23 @@ Volta_engraver::Volta_engraver () } -void -Volta_engraver::process_music () +/* + TODO: this logic should be rewritten, it is buggy. + + One of the problems is that we can't determine wether or not to + print the volta bracket during the first step, since that requires + acknowledging the staff. + */ +bool +Volta_engraver::staff_eligible () { - if (unsmob_grob (staff_) - && !to_boolean (get_property ("voltaOnThisStaff"))) + /* + UGH. + */ + if (!unsmob_grob (staff_)) + return true; + + if (!to_boolean (get_property ("voltaOnThisStaff"))) { /* TODO: this does weird things when you open a piece with a @@ -69,14 +83,27 @@ Volta_engraver::process_music () */ if (!gh_pair_p (staffs)) - programming_error ("Huh? Volta engraver can't find staffs?"); + { + programming_error ("Huh? Volta engraver can't find staffs?"); + return false; + } else if (ly_car (scm_last_pair (staffs)) != staff_) - return ; + { + return false; + } } - - + return true; +} + +void +Volta_engraver::process_music () +{ SCM cs = get_property ("repeatCommands"); + if (!staff_eligible ()) + return ; + + bool end = false; start_string_ = SCM_EOL; while (gh_pair_p (cs)) @@ -132,14 +159,7 @@ Volta_engraver::process_music () end_volta_span_ = volta_span_; volta_span_ = 0; } -} -/* - this could just as well be done in process_music (), but what the hack. - */ -void -Volta_engraver::process_acknowledged_grobs () -{ if (!volta_span_ && (gh_string_p (start_string_) || gh_pair_p (start_string_))) { @@ -152,6 +172,7 @@ Volta_engraver::process_acknowledged_grobs () } } + void Volta_engraver::acknowledge_grob (Grob_info i) { @@ -201,6 +222,19 @@ Volta_engraver::finalize () void Volta_engraver::stop_translation_timestep () { + if (volta_span_ && !staff_eligible ()) + { + /* + THIS IS A KLUDGE. + + we need to do this here, because STAFF_ is not initialized yet + in the 1st call of process_music() + */ + + volta_span_->suicide( ); + volta_span_ = 0; + } + if (end_volta_span_) { typeset_grob (end_volta_span_);