X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmeasure-grouping-engraver.cc;h=c91fdc63418f748af80fdd4ddd0a421758226520;hb=5d84bfad4626892bcffd05adcced53c8a2329047;hp=91e9f6957df616ca54a764e7fda28f324be1616b;hpb=0706458a184d83d0776ffa03b07f710d9e3138ba;p=lilypond.git diff --git a/lily/measure-grouping-engraver.cc b/lily/measure-grouping-engraver.cc index 91e9f6957d..c91fdc6341 100644 --- a/lily/measure-grouping-engraver.cc +++ b/lily/measure-grouping-engraver.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2002--2010 Han-Wen Nienhuys + Copyright (C) 2002--2015 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 @@ -36,7 +36,7 @@ protected: void process_music (); virtual void finalize (); - DECLARE_ACKNOWLEDGER (note_column); + void acknowledge_note_column (Grob_info); }; void @@ -44,7 +44,7 @@ Measure_grouping_engraver::finalize () { if (grouping_) { - grouping_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn"))); + grouping_->set_bound (RIGHT, unsmob (get_property ("currentCommandColumn"))); grouping_->suicide (); grouping_ = 0; } @@ -64,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"))); + unsmob (get_property ("currentMusicalColumn"))); grouping_ = 0; } @@ -75,64 +75,70 @@ Measure_grouping_engraver::process_music () SCM grouping = get_property ("beatStructure"); if (scm_is_pair (grouping)) { - Moment *measpos = unsmob_moment (get_property ("measurePosition")); + Moment *measpos = unsmob (get_property ("measurePosition")); Rational mp = measpos->main_part_; - Moment *base_mom = unsmob_moment (get_property ("baseMoment")); + Moment *base_mom = 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))) * 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; - } + 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, unsmob_grob (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; - } - } - } + { + grouping_ = make_spanner ("MeasureGrouping", SCM_EOL); + grouping_->set_bound (LEFT, 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; + } + } + } } } -Measure_grouping_engraver::Measure_grouping_engraver () +Measure_grouping_engraver::Measure_grouping_engraver (Context *c) + : Engraver (c) { grouping_ = 0; } -ADD_ACKNOWLEDGER (Measure_grouping_engraver, note_column); +void +Measure_grouping_engraver::boot () +{ + ADD_ACKNOWLEDGER (Measure_grouping_engraver, note_column); +} + ADD_TRANSLATOR (Measure_grouping_engraver, - /* doc */ - "Create @code{MeasureGrouping} to indicate beat subdivision.", + /* doc */ + "Create @code{MeasureGrouping} to indicate beat subdivision.", - /* create */ - "MeasureGrouping ", + /* create */ + "MeasureGrouping ", - /* read */ + /* read */ "baseMoment " - "beatStructure " - "currentMusicalColumn " - "measurePosition ", + "beatStructure " + "currentMusicalColumn " + "measurePosition ", - /* write */ - "" - ); + /* write */ + "" + );