2 mark-engraver.cc -- implement Metronome_mark_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2003 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"
18 put stuff over or next to bars. Examples: bar numbers, marginal notes,
21 class Metronome_mark_engraver : public Engraver
24 TRANSLATOR_DECLARATIONS(Metronome_mark_engraver);
30 virtual void stop_translation_timestep ();
31 virtual void acknowledge_grob (Grob_info);
32 void create_items (Music*);
33 virtual bool try_music (Music *req);
34 virtual void start_translation_timestep ();
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_grob_property ("side-support-elements" , get_property ("stavesFound"));
76 Metronome_mark_engraver::create_items (Music *rq)
81 SCM s = get_property ("MetronomeMark");
84 announce_grob(text_, rq->self_scm());
88 Metronome_mark_engraver::start_translation_timestep ()
94 Metronome_mark_engraver::try_music (Music* r)
101 Metronome_mark_engraver::process_music ()
105 create_items (mark_req_);
107 SCM proc = get_property ("metronomeMarkFormatter");
108 SCM result= scm_call_2 (proc, mark_req_->self_scm (),
109 daddy_trans_->self_scm());
111 text_->set_grob_property ("text", result);
115 ENTER_DESCRIPTION(Metronome_mark_engraver,
116 /* descr */ "Engrave metro nome marking. This delegates the real work to the function in the metronomeMarkFormatter property",
117 /* creats*/ "MetronomeMark",
118 /* accepts */ "metronome-change-event",
119 /* acks */ "time-signature-interface bar-line-interface",
120 /* reads */ "stavesFound metronomeMarkFormatter",