source file of the GNU LilyPond music typesetter
- (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg
- <mandolaerik@gmail.com>
+ (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg <mandolaerik@gmail.com>
*/
-#include "bar-line.hh"
+#include "repeated-music.hh"
#include "global-context.hh"
-#include "international.hh"
-#include "item.hh"
+#include "warn.hh"
#include "misc.hh"
-#include "repeated-music.hh"
-#include "score-engraver.hh"
#include "spanner.hh"
-#include "stream-event.hh"
-#include "warn.hh"
-
-#include "translator.icc"
+#include "item.hh"
+#include "percent-repeat-iterator.hh"
+#include "bar-line.hh"
+#include "score-engraver.hh"
/**
This acknowledges repeated music with "percent" style. It typesets
public:
TRANSLATOR_DECLARATIONS (Slash_repeat_engraver);
protected:
- Stream_event *slash_;
+ Music *slash_;
protected:
- DECLARE_TRANSLATOR_LISTENER (percent);
+ virtual bool try_music (Music *);
void process_music ();
};
slash_ = 0;
}
-IMPLEMENT_TRANSLATOR_LISTENER (Slash_repeat_engraver, percent);
-void
-Slash_repeat_engraver::listen_percent (Stream_event *ev)
+bool
+Slash_repeat_engraver::try_music (Music *m)
{
/*todo: separate events for percent and slash */
- Moment meas_length
- = robust_scm2moment (get_property ("measureLength"), Moment (0));
-
- if (get_event_length (ev) < meas_length)
- ASSIGN_EVENT_ONCE (slash_, ev);
+ if (m->is_mus_type ("percent-event"))
+ {
+ Moment meas_length
+ = robust_scm2moment (get_property ("measureLength"), Moment (0));
+
+ if (m->get_length () < meas_length)
+ slash_ = m;
+ else
+ return false;
- /*
- don't warn if nothing happens: this can happen if there are whole
- measure repeats.
- */
+ return true;
+ }
+
+ return false;
}
void
}
}
+#include "translator.icc"
+
ADD_TRANSLATOR (Slash_repeat_engraver,
/* doc */ "Make beat repeats.",
/* create */ "RepeatSlash",