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 *ev);
34 virtual void process_music ();
40 Metronome_mark_engraver::Metronome_mark_engraver ()
47 Metronome_mark_engraver::acknowledge_grob (Grob_info inf)
49 if (Bar_line::has_interface (inf.grob_))
51 bar_line_ = inf.grob_;
53 else if (text_ && Time_signature::has_interface (inf.grob_))
55 text_->set_parent (inf.grob_, X_AXIS);
60 Metronome_mark_engraver::stop_translation_timestep ()
64 if (bar_line_ && !text_->get_parent (X_AXIS))
65 text_->set_parent (bar_line_, X_AXIS);
67 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());
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 daddy_trans_->self_scm());
106 text_->set_grob_property ("text", result);
110 ENTER_DESCRIPTION(Metronome_mark_engraver,
111 /* descr */ "Engrave metro nome marking. This delegates the real work to the function in the metronomeMarkFormatter property",
112 /* creats*/ "MetronomeMark",
113 /* accepts */ "metronome-change-event",
114 /* acks */ "time-signature-interface bar-line-interface",
115 /* reads */ "stavesFound metronomeMarkFormatter",