2 mark-engraver.cc -- implement Metronome_mark_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
12 #include "engraver.hh"
14 #include "note-column.hh"
16 #include "grob-array.hh"
19 put stuff over or next to bars. Examples: bar numbers, marginal notes,
22 class Metronome_mark_engraver : public Engraver
25 TRANSLATOR_DECLARATIONS (Metronome_mark_engraver);
31 void create_items (Music *);
33 void stop_translation_timestep ();
34 virtual bool try_music (Music *ev);
35 void process_music ();
38 Metronome_mark_engraver::Metronome_mark_engraver ()
45 Metronome_mark_engraver::stop_translation_timestep ()
49 Grob *mc = unsmob_grob (get_property ("currentMusicalColumn"));
50 text_->set_parent (mc, X_AXIS);
51 text_->set_object ("side-support-elements",
52 grob_list_to_grob_array (get_property ("stavesFound")));
60 Metronome_mark_engraver::create_items (Music *rq)
65 text_ = make_item ("MetronomeMark", rq->self_scm ());
69 Metronome_mark_engraver::try_music (Music *r)
76 Metronome_mark_engraver::process_music ()
80 create_items (mark_ev_);
82 SCM proc = get_property ("metronomeMarkFormatter");
83 SCM result = scm_call_2 (proc, mark_ev_->self_scm (),
84 context ()->self_scm ());
86 text_->set_property ("text", result);
90 #include "translator.icc"
92 ADD_TRANSLATOR (Metronome_mark_engraver,
93 /* doc */ "Engrave metro nome marking. This delegates the formatting work "
94 "to the function in the metronomeMarkFormatter property. "
95 "The mark is put over all staves. "
96 "The staves are taken from the @code{stavesFound} property, "
97 "which is maintained by @code{@ref{Staff_collecting_engraver}}. ",
98 /* create */ "MetronomeMark",
99 /* accept */ "metronome-change-event",
100 /* read */ "stavesFound metronomeMarkFormatter",