protected:
virtual void finalize ();
virtual bool try_music (Music *);
- virtual void stop_translation_timestep ();
- virtual void start_translation_timestep ();
- virtual void process_music ();
+ void stop_translation_timestep ();
+ void start_translation_timestep ();
+ void process_music ();
};
Percent_repeat_engraver::Percent_repeat_engraver ()
if (meas_len == body_length_)
repeat_sign_type_ = MEASURE;
else if (Moment (2) * meas_len == body_length_)
- {
- repeat_sign_type_ = DOUBLE_MEASURE;
- next_moment_ += meas_len;
- }
+ repeat_sign_type_ = DOUBLE_MEASURE;
else
{
- warning (_ ("Don't know how to handle a percent repeat of this length."));
+ warning (_f ("can't handle a percent repeat of length: %s",
+ body_length_.to_string ()));
return false;
}
repeat_ = m;
Global_context *global = get_global_context ();
- for (int i = 0; i < count; i++)
+ for (int i = 1; i < count; i++)
{
- global->add_moment_to_process (next_moment_ + Moment (i) * body_length_);
+ Moment m = next_moment_ + Moment (i) * body_length_;
+ global->add_moment_to_process (m);
- /*
- bars between % too.
- */
+ /* bars between % too. */
if (repeat_sign_type_ == DOUBLE_MEASURE)
- global->add_moment_to_process (next_moment_ + meas_len + Moment (i) * body_length_);
+ global->add_moment_to_process (m - meas_len);
}
+ if (repeat_sign_type_ == DOUBLE_MEASURE)
+ next_moment_ += meas_len;
+
return true;
}
else if (repeat_sign_type_ == DOUBLE_MEASURE)
{
double_percent_ = make_item ("DoublePercentRepeat", repeat_->self_scm ());
+
/*
forbid breaks on a % line. Should forbid all breaks, really.
- */
- get_score_engraver ()->forbid_breaks (); // guh. Use properties!
+ Ugh. Why can't this be regular communication between
+ contexts?
+ */
+ get_score_engraver ()->forbid_breaks ();
}
next_moment_ = next_moment_ + body_length_;
-
- get_global_context ()->add_moment_to_process (next_moment_);
}
}
typeset_perc ();
}
+#include "translator.icc"
+
ADD_TRANSLATOR (Percent_repeat_engraver,
- /* descr */ "Make whole bar and double bar repeats.",
- /* creats*/ "PercentRepeat DoublePercentRepeat",
- /* accepts */ "repeated-music",
- /* acks */ "",
- /* reads */ "measureLength currentCommandColumn",
+ /* doc */ "Make whole bar and double bar repeats.",
+ /* create */ "PercentRepeat DoublePercentRepeat",
+ /* accept */ "repeated-music",
+ /* read */ "measureLength currentCommandColumn",
/* write */ "");