WEB: Found more hardcoded names, yay! Fix linking to essay, images in essay.
[lilypond/patrick.git] / lily / spanner-break-forbid-engraver.cc
blobbaac8f83a219f923d1c4a6fb7f30e2b32a393462
1 /*
2 spanner-break-forbid-engraver.cc -- implement Spanner_break_forbid_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2007--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
7 */
11 #include "engraver.hh"
12 #include "international.hh"
13 #include "spanner.hh"
14 #include "stream-event.hh"
15 #include "warn.hh"
16 #include "context.hh"
18 #include "translator.icc"
20 class Spanner_break_forbid_engraver : public Engraver
22 TRANSLATOR_DECLARATIONS (Spanner_break_forbid_engraver);
23 vector<Spanner*> running_spanners_;
24 protected:
25 DECLARE_ACKNOWLEDGER (unbreakable_spanner);
26 DECLARE_END_ACKNOWLEDGER (unbreakable_spanner);
28 void process_music ();
32 void
33 Spanner_break_forbid_engraver::process_music ()
35 if (running_spanners_.size ())
37 context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
41 void
42 Spanner_break_forbid_engraver::acknowledge_end_unbreakable_spanner (Grob_info gi)
44 vector<Spanner*>::iterator i = find (running_spanners_.begin (), running_spanners_.end (),
45 gi.spanner ());
46 if (i != running_spanners_.end ())
47 running_spanners_.erase (i);
50 void
51 Spanner_break_forbid_engraver::acknowledge_unbreakable_spanner (Grob_info gi)
53 if (!to_boolean (gi.grob ()->get_property ("breakable")))
54 running_spanners_.push_back (gi.spanner ());
57 Spanner_break_forbid_engraver::Spanner_break_forbid_engraver ()
62 ADD_END_ACKNOWLEDGER (Spanner_break_forbid_engraver, unbreakable_spanner);
63 ADD_ACKNOWLEDGER (Spanner_break_forbid_engraver, unbreakable_spanner);
64 ADD_TRANSLATOR (Spanner_break_forbid_engraver,
65 /* doc */
66 "Forbid breaks in certain spanners.",
68 /* create */
69 "",
71 /* read */
72 "",
74 /* write */