]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/auto-beam-engraver.cc
* lily/stem.cc (head_count): Change function name. Change property
[lilypond.git] / lily / auto-beam-engraver.cc
index 97451c6a4ef6da5811bddb7d4c4f211f1636232a..5126db27dbea7046bf1c20bb4c46a6fd4120ffee 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1999--2002 Jan Nieuwenhuizen <janneke@gnu.org>
   
  */
 
@@ -13,7 +13,7 @@
 #include "stem.hh"
 #include "debug.hh"
 #include "engraver-group-engraver.hh"
-#include "bar.hh"
+#include "bar-line.hh"
 #include "rest.hh"
 #include "engraver.hh"
 #include "item.hh"
@@ -61,6 +61,8 @@ private:
   Moment extend_mom_;
   Moment beam_start_moment_;
   Moment beam_start_location_;
+
+  bool subdivide_beams_;
   
   // We act as if beam were created, and start a grouping anyway.
   Beaming_info_list*grouping_p_;  
@@ -189,8 +191,8 @@ Auto_beam_engraver::test_moment (Direction dir, Moment test_mom)
 void
 Auto_beam_engraver::consider_begin (Moment test_mom)
 {
-  bool off = to_boolean (get_property ("noAutoBeaming"));
-  if (!stem_l_arr_p_ && ! off)
+  bool on = to_boolean (get_property ("autoBeaming"));
+  if (!stem_l_arr_p_ && on)
     {
       bool b = test_moment (START, test_mom);
       if (b)
@@ -204,7 +206,7 @@ Auto_beam_engraver::consider_end (Moment test_mom)
   if (stem_l_arr_p_)
     {
       /* Allow already started autobeam to end:
-        don't check for noAutoBeaming */
+        don't check for autoBeaming */
       bool b = test_moment (STOP, test_mom);
       if (b)
        end_beam ();
@@ -233,7 +235,7 @@ Auto_beam_engraver::create_beam_p ()
       Beam::add_stem (beam_p, (*stem_l_arr_p_)[i]);
     }
   
-  announce_grob (beam_p, 0);
+  announce_grob(beam_p, SCM_EOL);
 
   return beam_p;
 }
@@ -247,8 +249,7 @@ Auto_beam_engraver::begin_beam ()
   grouping_p_ = new Beaming_info_list;
   beam_start_moment_ = now_mom ();
   beam_start_location_ = *unsmob_moment (get_property ("measurePosition"));
-
-
+  subdivide_beams_ = gh_scm2bool(get_property("subdivideBeams")); 
 }
 
 
@@ -291,7 +292,8 @@ Auto_beam_engraver::typeset_beam ()
 {
   if (finished_beam_p_)
     {
-      finished_grouping_p_->beamify ();
+      finished_grouping_p_->beamify(*unsmob_moment (get_property ("beatLength")),
+                                   subdivide_beams_);
       Beam::set_beaming (finished_beam_p_, finished_grouping_p_);
       typeset_grob (finished_beam_p_);
       finished_beam_p_ = 0;
@@ -344,7 +346,7 @@ Auto_beam_engraver::acknowledge_grob (Grob_info info)
        {
          end_beam ();
        }
-      else if (Bar::has_interface (info.grob_l_))
+      else if (Bar_line::has_interface (info.grob_l_))
        {
          end_beam ();
        }
@@ -358,7 +360,7 @@ Auto_beam_engraver::acknowledge_grob (Grob_info info)
     {
       Item* stem_l = dynamic_cast<Item *> (info.grob_l_);
                                       
-      Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.req_l_);
+      Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.music_cause ());
       if (!rhythmic_req)
        {
          programming_error ("Stem must have rhythmic structure");
@@ -368,7 +370,7 @@ Auto_beam_engraver::acknowledge_grob (Grob_info info)
       /*
        Don't (start) auto-beam over empty stems; skips or rests
        */
-      if (!Stem::heads_i (stem_l))
+      if (!Stem::head_count (stem_l))
        {
          if (stem_l_arr_p_)
            end_beam ();
@@ -479,5 +481,5 @@ stemRightBeamCount.
 ",
 /* creats*/       "Beam",
 /* acks  */       "stem-interface rest-interface beam-interface bar-line-interface",
-/* reads */       "noAutoBeaming autoBeamSettings",
+/* reads */       "autoBeaming autoBeamSettings subdivideBeams",
 /* write */       "");