Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / slash-repeat-engraver.cc
blob16af23613a61af626342ae4ea5b87c41a91d7e6c
1 /*
2 slash-repeat-engraver.cc -- implement Slash_repeat_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg
7 <mandolaerik@gmail.com>
8 */
10 #include "bar-line.hh"
11 #include "global-context.hh"
12 #include "international.hh"
13 #include "item.hh"
14 #include "misc.hh"
15 #include "repeated-music.hh"
16 #include "score-engraver.hh"
17 #include "spanner.hh"
18 #include "stream-event.hh"
19 #include "warn.hh"
21 #include "translator.icc"
23 /**
24 This acknowledges repeated music with "percent" style. It typesets
25 a slash sign.
27 class Slash_repeat_engraver : public Engraver
29 public:
30 TRANSLATOR_DECLARATIONS (Slash_repeat_engraver);
31 protected:
32 Stream_event *slash_;
33 protected:
34 DECLARE_TRANSLATOR_LISTENER (percent);
35 void process_music ();
38 Slash_repeat_engraver::Slash_repeat_engraver ()
40 slash_ = 0;
43 IMPLEMENT_TRANSLATOR_LISTENER (Slash_repeat_engraver, percent);
44 void
45 Slash_repeat_engraver::listen_percent (Stream_event *ev)
47 /*todo: separate events for percent and slash */
48 Moment meas_length
49 = robust_scm2moment (get_property ("measureLength"), Moment (0));
51 if (get_event_length (ev) < meas_length)
52 ASSIGN_EVENT_ONCE (slash_, ev);
55 don't warn if nothing happens: this can happen if there are whole
56 measure repeats.
60 void
61 Slash_repeat_engraver::process_music ()
63 if (slash_)
65 make_item ("RepeatSlash", slash_->self_scm ());
66 slash_ = 0;
70 ADD_TRANSLATOR (Slash_repeat_engraver,
71 /* doc */
72 "Make beat repeats.",
74 /* create */
75 "RepeatSlash ",
77 /* read */
78 "measureLength ",
80 /* write */