]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/measure-grouping-engraver.cc
Add test for collisions and grace notes.
[lilypond.git] / lily / measure-grouping-engraver.cc
index d77cf8d499e6384661c88571a25734839c54e472..7a788dc3d263d637dbb5cc0e40131e2fc229c88f 100644 (file)
@@ -1,9 +1,20 @@
 /*
-  measure-grouping-engraver.cc -- implement Measure_grouping_engraver
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 2002--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 2002--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "warn.hh"
@@ -11,7 +22,6 @@
 #include "global-context.hh"
 #include "engraver.hh"
 #include "spanner.hh"
-#include "beam-settings.hh"
 
 #include "translator.icc"
 
@@ -62,27 +72,18 @@ Measure_grouping_engraver::process_music ()
   if (now.grace_part_)
     return;
 
-  SCM settings = get_property ("beamSettings");
-  SCM grouping = SCM_EOL;
-  if (scm_is_pair (settings))
-    {
-      SCM time_signature_fraction = get_property ("timeSignatureFraction");
-      grouping = ly_beam_grouping (settings,
-                                   time_signature_fraction,
-                                   ly_symbol2scm ("end"),
-                                   ly_symbol2scm ("*"));
-    }
+  SCM grouping = get_property ("beatStructure");
   if (scm_is_pair (grouping))
     {
       Moment *measpos = unsmob_moment (get_property ("measurePosition"));
       Rational mp = measpos->main_part_;
 
-      Moment *beatlen_mom = unsmob_moment (get_property ("beatLength"));
-      Rational beat_length = beatlen_mom->main_part_;
+      Moment *base_mom = unsmob_moment (get_property ("baseMoment"));
+      Rational base_moment = base_mom->main_part_;
 
       Rational where (0);
       for (SCM s = grouping; scm_is_pair (s);
-          where += Rational ((int) scm_to_int (scm_car (s))) * beat_length,
+          where += Rational ((int) scm_to_int (scm_car (s))) * base_moment,
             s = scm_cdr (s))
        {
          int grouplen = scm_to_int (scm_car (s));
@@ -98,7 +99,7 @@ Measure_grouping_engraver::process_music ()
                 grouping_ = make_spanner ("MeasureGrouping", SCM_EOL);
                 grouping_->set_bound (LEFT, unsmob_grob (get_property ("currentMusicalColumn")));
 
-                stop_grouping_mom_ = now.main_part_ + Rational (grouplen - 1) * beat_length;
+                stop_grouping_mom_ = now.main_part_ + Rational (grouplen - 1) * base_moment;
                 get_global_context ()->add_moment_to_process (Moment (stop_grouping_mom_));
 
                 if (grouplen == 3)
@@ -127,10 +128,10 @@ ADD_TRANSLATOR (Measure_grouping_engraver,
                "MeasureGrouping ",
 
                /* read */
-               "beatLength "
+                "baseMoment "
+               "beatStructure "
                "currentMusicalColumn "
-               "measurePosition "
-               "beamSettings ",
+               "measurePosition ",
 
                /* write */
                ""