X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmeasure-grouping-engraver.cc;h=003e8b418b54832b1b52ed08d00a3b1a43b4dcc4;hb=5bbfc22fce036b9b69df5e420de93e11da23c05e;hp=fe7abf1ea4a137d1bfbd01f04483815fc287957b;hpb=44ad1d66c072e4d6545e75c769c86a460cb1df13;p=lilypond.git diff --git a/lily/measure-grouping-engraver.cc b/lily/measure-grouping-engraver.cc index fe7abf1ea4..003e8b418b 100644 --- a/lily/measure-grouping-engraver.cc +++ b/lily/measure-grouping-engraver.cc @@ -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--2014 Han-Wen Nienhuys - (c) 2002--2006 Han-Wen Nienhuys + 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 . */ #include "warn.hh" @@ -33,7 +44,7 @@ Measure_grouping_engraver::finalize () { if (grouping_) { - grouping_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn"))); + grouping_->set_bound (RIGHT, Grob::unsmob (get_property ("currentCommandColumn"))); grouping_->suicide (); grouping_ = 0; } @@ -53,7 +64,7 @@ Measure_grouping_engraver::process_music () if (grouping_ && now.main_part_ >= stop_grouping_mom_ && !now.grace_part_) { grouping_->set_bound (RIGHT, - unsmob_grob (get_property ("currentMusicalColumn"))); + Grob::unsmob (get_property ("currentMusicalColumn"))); grouping_ = 0; } @@ -61,43 +72,45 @@ Measure_grouping_engraver::process_music () if (now.grace_part_) return; - SCM grouping = get_property ("beatGrouping"); + SCM grouping = get_property ("beatStructure"); if (scm_is_pair (grouping)) { - Moment *measpos = unsmob_moment (get_property ("measurePosition")); + Moment *measpos = Moment::unsmob (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 = Moment::unsmob (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, - s = scm_cdr (s)) - { - int grouplen = scm_to_int (scm_car (s)); - if (where == mp) - { - if (grouping_) - { - programming_error ("last grouping not finished yet"); - continue; - } - - 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; - get_global_context ()->add_moment_to_process (Moment (stop_grouping_mom_)); - - if (grouplen == 3) - grouping_->set_property ("style", ly_symbol2scm ("triangle")); - else - grouping_->set_property ("style", ly_symbol2scm ("bracket")); - - break; - } - } + where += Rational ((int) scm_to_int (scm_car (s))) * base_moment, + s = scm_cdr (s)) + { + int grouplen = scm_to_int (scm_car (s)); + if (where == mp) + { + if (grouping_) + { + programming_error ("last grouping not finished yet"); + continue; + } + if (grouplen > 1) + { + grouping_ = make_spanner ("MeasureGrouping", SCM_EOL); + grouping_->set_bound (LEFT, Grob::unsmob (get_property ("currentMusicalColumn"))); + + 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) + grouping_->set_property ("style", ly_symbol2scm ("triangle")); + else + grouping_->set_property ("style", ly_symbol2scm ("bracket")); + + break; + } + } + } } } @@ -108,15 +121,18 @@ Measure_grouping_engraver::Measure_grouping_engraver () ADD_ACKNOWLEDGER (Measure_grouping_engraver, note_column); ADD_TRANSLATOR (Measure_grouping_engraver, - /* doc */ - "Creates MeasureGrouping to indicate beat subdivision.", - /* create */ - "MeasureGrouping", - /* read */ - "beatLength " - "currentMusicalColumn " - "measurePosition " - "beatGrouping " - , - /* write */ - ""); + /* doc */ + "Create @code{MeasureGrouping} to indicate beat subdivision.", + + /* create */ + "MeasureGrouping ", + + /* read */ + "baseMoment " + "beatStructure " + "currentMusicalColumn " + "measurePosition ", + + /* write */ + "" + );