2 mark-engraver.cc -- implement 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"
13 #include "engraver-group-engraver.hh"
14 #include "engraver.hh"
17 #include "text-item.hh"
20 put stuff over or next to bars. Examples: bar numbers, marginal notes,
23 class Mark_engraver : public Engraver
26 TRANSLATOR_DECLARATIONS(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 ();
45 Mark_engraver::Mark_engraver ()
52 Mark_engraver::acknowledge_grob (Grob_info inf)
55 if (text_ && Bar_line::has_interface (s))
58 TODO: make this configurable. RehearsalMark cannot be
59 break-aligned, since the width of the object should not be taken
60 into alignment considerations.
62 text_->set_parent (s, X_AXIS);
67 Mark_engraver::stop_translation_timestep ()
71 text_->set_grob_property ("side-support-elements" , get_property ("stavesFound"));
80 Mark_engraver::create_items (Music *ev)
85 text_ = make_item ("RehearsalMark");
86 announce_grob(text_, ev->self_scm());
91 Mark_engraver::try_music (Music* r)
100 TODO: make the increment function in Scheme.
103 TODO: junk the number type for rehearsalMark
106 Mark_engraver::process_music ()
110 create_items (mark_ev_);
117 SCM m = mark_ev_->get_mus_property ("label");
118 SCM proc = get_property ("markFormatter");
119 if (!Text_item::markup_p (m) &&
120 gh_procedure_p (proc))
122 if (!gh_number_p (m))
123 m = get_property ("rehearsalMark");
125 if (scm_integer_p (m) == SCM_BOOL_T
126 && scm_exact_p (m) == SCM_BOOL_T)
128 int mark_count = gh_scm2int (m);
130 daddy_context_->set_property ("rehearsalMark",
131 gh_int2scm (mark_count));
135 m = scm_call_2 (proc, m, daddy_context_->self_scm ());
137 warning ("rehearsalMark does not have integer value.");
140 if (Text_item::markup_p (m))
141 text_->set_grob_property ("text", m);
143 warning ("Mark label should be markup object.");
147 ENTER_DESCRIPTION(Mark_engraver,
149 /* creats*/ "RehearsalMark",
150 /* accepts */ "mark-event",
151 /* acks */ "bar-line-interface",
152 /* reads */ "rehearsalMark markFormatter stavesFound",