]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam-engraver.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / beam-engraver.cc
index 4ba9dd7a99c0afe6b31e5cf35d32186a528800f9..c8104d0bd09f8a877c6c50cb68f23ab9927e3caa 100644 (file)
@@ -3,21 +3,22 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-#include "engraver.hh"
 #include "beam.hh"
-#include "stem.hh"
-#include "warn.hh"
-#include "beaming.hh"
-#include "score-engraver.hh"
-#include "rest.hh"
+#include "beaming-pattern.hh"
+#include "context.hh"
 #include "drul-array.hh"
+#include "duration.hh"
+#include "engraver.hh"
+#include "international.hh"
 #include "item.hh"
+#include "rest.hh"
+#include "score-context.hh"
 #include "spanner.hh"
-#include "context.hh"
-#include "duration.hh"
+#include "stem.hh"
+#include "warn.hh"
 
 #include "translator.icc"
 
@@ -35,8 +36,8 @@ protected:
 
   Music *now_stop_ev_;
 
-  Beaming_info_list *beam_info_;
-  Beaming_info_list *finished_beam_info_;
+  Beaming_pattern *beam_info_;
+  Beaming_pattern *finished_beam_info_;
 
   /// location  within measure where beam started.
   Moment beam_start_location_;
@@ -126,7 +127,7 @@ void
 Beam_engraver::process_music ()
 {
   if (beam_ && !to_boolean (get_property ("allowBeamBreak")))
-    get_score_engraver ()->forbid_breaks ();
+    context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
 
   if (start_ev_)
     {
@@ -144,8 +145,7 @@ Beam_engraver::process_music ()
       beam_start_location_ = mp;
       beam_start_mom_ = now_mom ();
 
-      beam_info_ = new Beaming_info_list;
-
+      beam_info_ = new Beaming_pattern;
       /* urg, must copy to Auto_beam_engraver too */
     }
 }
@@ -155,7 +155,10 @@ Beam_engraver::typeset_beam ()
 {
   if (finished_beam_)
     {
-      finished_beam_info_->beamify (beat_length_, subdivide_beams_);
+      if (!finished_beam_->get_bound (RIGHT))
+       finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
+         
+      finished_beam_info_->beamify (context ());
       Beam::set_beaming (finished_beam_, finished_beam_info_);
 
       delete finished_beam_info_;
@@ -172,9 +175,6 @@ Beam_engraver::start_translation_timestep ()
   if (beam_)
     {
       set_melisma (true);
-
-      subdivide_beams_ = to_boolean (get_property ("subdivideBeams"));
-      beat_length_ = robust_scm2moment (get_property ("beatLength"), Moment (1, 4));
     }
 }
 
@@ -242,7 +242,7 @@ Beam_engraver::acknowledge_stem (Grob_info info)
   Music *m = info.ultimate_music_cause ();
   if (!m->is_mus_type ("rhythmic-event"))
     {
-      String s = _ ("stem must have Rhythmic structure");
+      string s = _ ("stem must have Rhythmic structure");
       if (info.music_cause ())
        info.music_cause ()->origin ()->warning (s);
       else
@@ -276,12 +276,21 @@ ADD_ACKNOWLEDGER (Beam_engraver, stem);
 ADD_ACKNOWLEDGER (Beam_engraver, rest);
 
 ADD_TRANSLATOR (Beam_engraver,
-               /* doc */ "Handles Beam events by engraving Beams.    If omitted, then notes will be "
+               /* doc */
+
+               "Handles Beam events by engraving Beams.  If omitted, then notes will be "
                "printed with flags instead of beams.",
+               
                /* create */ "Beam",
                /* accept */ "beam-event",
-               /* read */ "beamMelismaBusy beatLength subdivideBeams",
-               /* write */ "");
+
+               /* read */
+               "beamMelismaBusy "
+               "beatLength "
+               "subdivideBeams "
+               ,
+               /* write */
+               "forbidBreak");
 
 class Grace_beam_engraver : public Beam_engraver
 {
@@ -313,12 +322,22 @@ Grace_beam_engraver::valid_end_point ()
 
 ADD_ACKNOWLEDGER (Grace_beam_engraver, stem);
 ADD_ACKNOWLEDGER (Grace_beam_engraver, rest);
+
 ADD_TRANSLATOR (Grace_beam_engraver,
-               /* doc */ "Handles Beam events by engraving Beams.  If omitted, then notes will "
+
+               /* doc */
+
+               "Handles Beam events by engraving Beams.  If omitted, then notes will "
                "be printed with flags instead of beams. Only engraves beams when we "
                " are at grace points in time. ",
+               
                /* create */ "Beam",
                /* accept */ "beam-event",
-               /* read */ "beamMelismaBusy beatLength allowBeamBreak subdivideBeams",
+               /* read */
+               "beamMelismaBusy "
+               "beatLength "
+               "allowBeamBreak "
+               "subdivideBeams "
+               ,
                /* write */ "");