Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / slash-repeat-engraver.cc
blob0db3ceffb3c334a7ba1ba5fd57f162e0151ae46f
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>, Erik Sandberg
5 <mandolaerik@gmail.com>
7 LilyPond is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 LilyPond is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 #include "item.hh"
22 #include "engraver.hh"
23 #include "stream-event.hh"
25 #include "translator.icc"
28 This acknowledges repeated music with "percent" style. It typesets
29 a slash sign or double percent sign.
31 class Slash_repeat_engraver : public Engraver
33 public:
34 TRANSLATOR_DECLARATIONS (Slash_repeat_engraver);
35 protected:
36 Stream_event *slash_;
37 protected:
38 DECLARE_TRANSLATOR_LISTENER (repeat_slash);
39 void process_music ();
42 Slash_repeat_engraver::Slash_repeat_engraver ()
44 slash_ = 0;
47 IMPLEMENT_TRANSLATOR_LISTENER (Slash_repeat_engraver, repeat_slash);
48 void
49 Slash_repeat_engraver::listen_repeat_slash (Stream_event *ev)
51 ASSIGN_EVENT_ONCE (slash_, ev);
54 void
55 Slash_repeat_engraver::process_music ()
57 if (slash_)
59 SCM count = slash_->get_property ("slash-count");
60 if (scm_to_int (count) == 0)
61 make_item ("DoubleRepeatSlash", slash_->self_scm ());
62 else
63 make_item ("RepeatSlash", slash_->self_scm ());
64 slash_ = 0;
68 ADD_TRANSLATOR (Slash_repeat_engraver,
69 /* doc */
70 "Make beat repeats.",
72 /* create */
73 "DoubleRepeatSlash "
74 "RepeatSlash ",
76 /* read */
77 "",
79 /* write */