Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / repeat-tie-engraver.cc
blob4766cb818611c2ee0b771643c631481056ccd9e8
1 /*
2 repeat-tie-engraver.cc -- implement Repeat_tie_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 */
11 #include "engraver.hh"
12 #include "item.hh"
13 #include "pointer-group-interface.hh"
14 #include "stream-event.hh"
16 #include "translator.icc"
18 class Repeat_tie_engraver : public Engraver
20 Stream_event *event_;
21 Grob *semi_tie_column_;
22 vector<Grob*> semi_ties_;
24 void stop_translation_timestep ();
25 DECLARE_ACKNOWLEDGER (note_head);
26 DECLARE_TRANSLATOR_LISTENER (repeat_tie);
28 public:
29 TRANSLATOR_DECLARATIONS (Repeat_tie_engraver);
32 Repeat_tie_engraver::Repeat_tie_engraver ()
34 event_ = 0;
35 semi_tie_column_ = 0;
38 void
39 Repeat_tie_engraver::stop_translation_timestep ()
41 event_ = 0;
42 semi_tie_column_ = 0;
43 semi_ties_.clear ();
46 IMPLEMENT_TRANSLATOR_LISTENER (Repeat_tie_engraver, repeat_tie);
47 void
48 Repeat_tie_engraver::listen_repeat_tie (Stream_event *ev)
50 ASSIGN_EVENT_ONCE (event_, ev);
53 void
54 Repeat_tie_engraver::acknowledge_note_head (Grob_info inf)
56 if (!event_)
57 return;
59 if (!semi_tie_column_)
61 semi_tie_column_ = make_item ("RepeatTieColumn", event_->self_scm ());
64 SCM cause = event_->self_scm ();
65 Grob *semi_tie = make_item ("RepeatTie", cause);
66 semi_tie->set_object ("note-head", inf.grob ()->self_scm ());
68 Pointer_group_interface::add_grob (semi_tie_column_, ly_symbol2scm ("ties"),
69 semi_tie);
70 semi_tie->set_parent (semi_tie_column_, Y_AXIS);
71 semi_ties_.push_back (semi_tie);
74 if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
76 Direction d = to_dir (unsmob_stream_event (cause)->get_property ("direction"));
77 semi_tie->set_property ("direction", scm_from_int (d));
82 ADD_ACKNOWLEDGER (Repeat_tie_engraver, note_head);
83 ADD_TRANSLATOR (Repeat_tie_engraver,
84 /* doc */
85 "Create repeat ties.",
87 /* create */
88 "RepeatTie "
89 "RepeatTieColumn ",
91 /* read */
92 "",
94 /* write */