2 mark-engraver.cc -- implement Mark_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "bar-line.hh"
12 #include "staff-symbol.hh"
13 #include "engraver-group-engraver.hh"
14 #include "engraver.hh"
15 #include "lily-guile.hh"
16 #include "paper-column.hh"
17 #include "paper-def.hh"
18 #include "side-position-interface.hh"
19 #include "staff-symbol-referencer.hh"
21 #include "group-interface.hh"
22 #include "text-item.hh"
25 put stuff over or next to bars. Examples: bar numbers, marginal notes,
28 class Mark_engraver
: public Engraver
31 TRANSLATOR_DECLARATIONS(Mark_engraver
);
36 virtual void stop_translation_timestep ();
37 virtual void acknowledge_grob (Grob_info
);
38 void create_items (Music
*);
39 virtual bool try_music (Music
*req
);
40 virtual void start_translation_timestep ();
41 virtual void process_music ();
51 Mark_engraver::Mark_engraver ()
58 Mark_engraver::acknowledge_grob (Grob_info inf
)
61 if (text_
&& Bar_line::has_interface (s
))
64 Ugh. Figure out how to do this right at beginning of line, (without
65 creating class Bar_script : public Item).
67 text_
->set_parent (s
, X_AXIS
);
72 Mark_engraver::stop_translation_timestep ()
76 text_
->set_grob_property ("side-support-elements" , get_property ("stavesFound"));
84 Mark_engraver::create_items (Music
*rq
)
89 SCM s
= get_property ("RehearsalMark");
93 announce_grob(text_
, rq
->self_scm());
98 Mark_engraver::start_translation_timestep ()
105 Mark_engraver::try_music (Music
* r
)
114 TODO: make the increment function in Scheme.
118 Mark_engraver::process_music ()
122 create_items (mark_req_
);
130 SCM m
= mark_req_
->get_mus_property ("label");
131 if (new_markup_p (m
))
133 text_
->set_grob_property ("text",m
);
134 text_
->set_grob_property ("molecule-callback", new_markup_brewer ());
136 if (gh_pair_p (m
)) // markup text
137 text_
->set_grob_property ("text",m
);
140 if (!gh_string_p (m
) && !gh_number_p (m
))
141 m
= get_property ("rehearsalMark");
145 int mark_count
= gh_scm2int (m
);
146 t
= to_string (mark_count
);
148 m
= gh_int2scm (mark_count
);
150 else if (gh_string_p (m
))
152 t
= ly_scm2string (m
);
158 next
= to_string (c
);
160 m
= scm_makfrom0str (next
.to_str0 ());
167 daddy_trans_
->set_property ("rehearsalMark", m
);
169 text_
->set_grob_property ("text",
170 scm_makfrom0str (t
.to_str0 ()));
172 String style
= "mark-number";
173 for (int i
=0; i
< t
.length (); i
++)
177 style
= "mark-letter";
181 SCM st
= ly_symbol2scm (style
.to_str0 ());
182 text_
->set_grob_property ("font-style", st
);
188 ENTER_DESCRIPTION(Mark_engraver
,
190 /* creats*/ "RehearsalMark",
191 /* accepts */ "mark-event",
192 /* acks */ "bar-line-interface",
193 /* reads */ "rehearsalMark stavesFound",