source file of the GNU LilyPond music typesetter
- (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg <mandolaerik@gmail.com>
+ (c) 2000--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg <mandolaerik@gmail.com>
*/
#include "international.hh"
#include "item.hh"
#include "misc.hh"
-#include "percent-repeat-iterator.hh"
#include "repeated-music.hh"
#include "side-position-interface.hh"
#include "spanner.hh"
Spanner *percent_;
Spanner *percent_counter_;
+
+ Grob *first_command_column_;
+ Moment command_moment_;
+
protected:
virtual void finalize ();
DECLARE_TRANSLATOR_LISTENER (percent);
{
percent_ = 0;
percent_counter_ = 0;
-
percent_event_ = 0;
+
+ first_command_column_ = 0;
+ command_moment_ = Moment (-1);
+}
+
+void
+Percent_repeat_engraver::start_translation_timestep ()
+{
+ if (now_mom ().main_part_ != command_moment_.main_part_)
+ {
+ first_command_column_ = unsmob_grob (get_property ("currentCommandColumn"));
+ command_moment_ = now_mom ();
+ }
+
+ if (stop_mom_.main_part_ == now_mom ().main_part_)
+ {
+ if (percent_)
+ typeset_perc ();
+ percent_event_ = 0;
+ repeat_sign_type_ = UNKNOWN;
+ }
}
IMPLEMENT_TRANSLATOR_LISTENER (Percent_repeat_engraver, percent);
}
else
{
- ev->origin ()->warning (_ ("Junking percent repeat event: Duration must be exactly one or two measures"));
+ /*
+ don't warn about percent repeats: slash repeats are not
+ exactly 1 or 2 measures long.
+ */
return;
}
percent_event_ = ev;
{
if (percent_)
typeset_perc ();
+
percent_ = make_spanner ("PercentRepeat", percent_event_->self_scm ());
- Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
+ Grob *col = first_command_column_;
percent_->set_bound (LEFT, col);
SCM count = percent_event_->get_property ("repeat-count");
&& to_boolean (get_property ("countPercentRepeats")))
{
Item *double_percent_counter = make_item ("DoublePercentRepeatCounter",
- percent_event_->self_scm());
+ percent_event_->self_scm ());
SCM text = scm_number_to_string (count,
scm_from_int (10));
{
percent_event_->origin ()->warning (_ ("unterminated percent repeat"));
percent_->suicide ();
- percent_counter_->suicide();
+ percent_counter_->suicide ();
}
}
{
if (percent_)
{
- Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
+ Grob *col = first_command_column_;
percent_->set_bound (RIGHT, col);
percent_ = 0;
}
}
-void
-Percent_repeat_engraver::start_translation_timestep ()
-{
- if (stop_mom_.main_part_ == now_mom ().main_part_)
- {
- if (percent_)
- typeset_perc ();
- percent_event_ = 0;
- repeat_sign_type_ = UNKNOWN;
- }
-}
+
void
Percent_repeat_engraver::stop_translation_timestep ()
"DoublePercentRepeatCounter "
"PercentRepeat "
"PercentRepeatCounter ",
-
- /* accept */
- "percent-event ",
/* read */
"countPercentRepeats "