]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/auto-beam-engraver.cc
new file.
[lilypond.git] / lily / auto-beam-engraver.cc
index 662ebeff5fe3da1fa2b70cf8dbfd4ded3e0c10e7..94e49d549d961fa43ea6a858bd2c68a33953f1a3 100644 (file)
@@ -1,9 +1,9 @@
 /*   
-  auto-beam-engraver.cc --  implement Auto_beam_engraver
+  auto-beam-engraver.cc -- implement Auto_beam_engraver
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1999--2005 Jan Nieuwenhuizen <janneke@gnu.org>
   
  */
 
@@ -21,6 +21,7 @@
 class Auto_beam_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Auto_beam_engraver);
+
 protected:
   virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
@@ -113,7 +114,7 @@ Auto_beam_engraver::try_music (Music*m)
 
 /*
   Determine end moment for auto beaming (or begin moment, but mostly
-  0==anywhere) In order of increasing priority:
+  0== anywhere) In order of increasing priority:
   
   i.   begin anywhere, end at every beat
   ii.  end   *    <num> <den>
@@ -152,12 +153,12 @@ Auto_beam_engraver::test_moment (Direction dir, Moment test_mom)
   else
     function = scm_list_n (ly_symbol2scm ("end"), SCM_UNDEFINED);
   
-  Moment beat_length (1,4);
+  Moment beat_length (1, 4);
   if (Moment * m = unsmob_moment (get_property ("beatLength")))
     {
       beat_length = *m;
     }
-  Moment measure_length (1,1);
+  Moment measure_length (1, 1);
   int num = 4;
   if (Moment* m = unsmob_moment (get_property ("measureLength")))
     {
@@ -315,7 +316,7 @@ Auto_beam_engraver::begin_beam ()
   beam_start_location_ =
     robust_scm2moment (get_property ("measurePosition"), Moment(0));
   subdivide_beams_ = ly_scm2bool (get_property ("subdivideBeams"));
-  beat_length_ = robust_scm2moment (get_property ("beatLength"), Moment(1,4));
+  beat_length_ = robust_scm2moment (get_property ("beatLength"), Moment(1, 4));
 }
 
 void
@@ -364,7 +365,7 @@ Auto_beam_engraver::typeset_beam ()
       finished_beam_ = 0;
     
       delete finished_grouping_;
-      finished_grouping_= 0;
+      finished_grouping_ = 0;
     }
 }
 
@@ -406,6 +407,17 @@ Auto_beam_engraver::finalize ()
 void
 Auto_beam_engraver::acknowledge_grob (Grob_info info)
 {
+  /*
+    Duplicated from process_music(), since
+    Repeat_acknowledge_engraver::process_music() may also set whichBar
+   */
+  if (scm_is_string (get_property ("whichBar"))
+      && beam_start_moment_ < now_mom())
+    {
+      consider_end (shortest_mom_);
+      junk_beam ();
+    }
+  
   if (stems_)
     {
       if (Beam::has_interface (info.grob_))
@@ -534,7 +546,7 @@ Auto_beam_engraver::process_acknowledged_grobs ()
   count_ ++;
 }
 
-ENTER_DESCRIPTION (Auto_beam_engraver,
+ADD_TRANSLATOR (Auto_beam_engraver,
 /* descr */       "Generate beams based on measure characteristics and observed "
 "Stems.  Uses beatLength, measureLength and measurePosition to decide "
 "when to start and stop a beam.  Overriding beaming is done through "