2 mark-engraver.cc -- implement Metronome_mark_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "bar-line.hh"
12 #include "time-signature.hh"
13 #include "engraver.hh"
14 #include "engraver-group-engraver.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 virtual void stop_translation_timestep ();
32 virtual void acknowledge_grob (Grob_info);
33 void create_items (Music*);
34 virtual bool try_music (Music *ev);
35 virtual void process_music ();
41 Metronome_mark_engraver::Metronome_mark_engraver ()
48 Metronome_mark_engraver::acknowledge_grob (Grob_info inf)
50 if (Bar_line::has_interface (inf.grob_))
52 bar_line_ = inf.grob_;
54 else if (text_ && Time_signature::has_interface (inf.grob_))
56 text_->set_parent (inf.grob_, X_AXIS);
61 Metronome_mark_engraver::stop_translation_timestep ()
65 if (bar_line_ && !text_->get_parent (X_AXIS))
66 text_->set_parent (bar_line_, X_AXIS);
68 text_->set_property ("side-support-elements" , get_property ("stavesFound"));
77 Metronome_mark_engraver::create_items (Music *rq)
82 text_ = make_item ("MetronomeMark");
84 announce_grob (text_, rq->self_scm ());
89 Metronome_mark_engraver::try_music (Music* r)
96 Metronome_mark_engraver::process_music ()
100 create_items (mark_ev_);
102 SCM proc = get_property ("metronomeMarkFormatter");
103 SCM result= scm_call_2 (proc, mark_ev_->self_scm (),
104 context ()->self_scm ());
106 text_->set_property ("text", result);
110 ENTER_DESCRIPTION (Metronome_mark_engraver,
111 /* descr */ "Engrave metro nome marking. This delegates the formatting work "
112 "to the function in the metronomeMarkFormatter property. "
113 "The mark is put over all staves. "
114 "The staves are taken from the @code{stavesFound} property, "
115 "which is maintained by @code{@ref{Staff_collecting_engraver}}. "
118 /* creats*/ "MetronomeMark",
119 /* accepts */ "metronome-change-event",
120 /* acks */ "time-signature-interface bar-line-interface",
121 /* reads */ "stavesFound metronomeMarkFormatter",