]> git.donarmstrong.com Git - lilypond.git/commitdiff
(staff_eligible): new function.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 23 Sep 2003 10:31:17 +0000 (10:31 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 23 Sep 2003 10:31:17 +0000 (10:31 +0000)
(stop_translation_timestep): kill off spanners if not eligible.

ChangeLog
Documentation/user/refman.itely
input/regression/repeat-volta-skip-alternatives.ly
lily/volta-engraver.cc

index 33174d74cbe6244ce53a0e22949f9f25fede66e4..3e8b7b451a17fa6ad93528c2fe880f6ec590c227 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-09-23  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * 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
index 8e3eae139c92cd638f73ee24cd2e2b6828c78f0f..36868bac6e773a5703b12bb9e56f31f3f8cd3767 100644 (file)
@@ -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 
 
index 963407b5abc685908cc127a6facac3d28e92a460..30effa0c484f012fa3602650f1c8d24a19c43fec 100644 (file)
@@ -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 } } 
 
index e95718b12156e896dcb099de6bea87095dd9e991..195a258c580dd8591654d1bfd464db890f293e42 100644 (file)
@@ -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_);