]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/auto-beam-engraver.cc
Doc-hu: translated first section of lilypond-book
[lilypond.git] / lily / auto-beam-engraver.cc
index c976688a0db257e74278b376294168835049ba59..0d5fa60ed2444cb8d5e9061fc3613c32613f4794 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1999--2010 Jan Nieuwenhuizen <janneke@gnu.org>
+  Copyright (C) 1999--2011 Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -80,6 +80,7 @@ private:
   Moment extend_mom_;
   Moment beam_start_moment_;
   Moment beam_start_location_;
+  Context *beam_start_context_;
 
   // We act as if beam were created, and start a grouping anyway.
   Beaming_pattern *grouping_;
@@ -137,8 +138,10 @@ Auto_beam_engraver::process_music ()
 
   if (forbid_)
     {
-      consider_end (measure_position (context ()), shortest_mom_);
-      junk_beam ();
+      if (stems_)
+       end_beam ();
+      else
+       junk_beam ();
     }
 }
 
@@ -217,7 +220,9 @@ Auto_beam_engraver::create_beam ()
   for (vsize i = 0; i < stems_->size (); i++)
     Beam::add_stem (beam, (*stems_)[i]);
 
-  announce_grob (beam, (*stems_)[0]->self_scm ());
+  Grob_info i = make_grob_info (beam, (*stems_)[0]->self_scm ());
+  i.rerouting_daddy_context_ = beam_start_context_;
+  announce_grob (i);
 
   return beam;
 }
@@ -236,6 +241,7 @@ Auto_beam_engraver::begin_beam ()
   beaming_options_.from_context (context ());
   beam_settings_ = updated_grob_properties (context (), ly_symbol2scm ("Beam"));
 
+  beam_start_context_ = context ()->get_parent_context ();
   beam_start_moment_ = now_mom ();
   beam_start_location_
     = robust_scm2moment (get_property ("measurePosition"), Moment (0));
@@ -267,7 +273,10 @@ Auto_beam_engraver::end_beam ()
 
       if (finished_beam_)
        {
-         announce_end_grob (finished_beam_, SCM_EOL);
+         Grob_info i = make_grob_info (finished_beam_, SCM_EOL);
+         i.rerouting_daddy_context_ = beam_start_context_;
+
+         announce_end_grob (i);
          finished_grouping_ = grouping_;
          finished_beaming_options_ = beaming_options_;
        }