2 mark-engraver.cc -- implement Mark_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2002 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "bar-line.hh"
11 #include "command-request.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"
24 put stuff over or next to bars. Examples: bar numbers, marginal notes,
27 class Mark_engraver
: public Engraver
30 TRANSLATOR_DECLARATIONS(Mark_engraver
);
35 virtual void stop_translation_timestep ();
36 virtual void acknowledge_grob (Grob_info
);
37 void create_items (Request
*);
38 virtual bool try_music (Music
*req_l
);
39 virtual void start_translation_timestep ();
40 virtual void process_music ();
43 Mark_req
* mark_req_l_
;
50 Mark_engraver::Mark_engraver ()
57 Mark_engraver::acknowledge_grob (Grob_info inf
)
59 Grob
* s
= inf
.grob_l_
;
60 if (text_p_
&& Bar_line::has_interface (s
))
63 Ugh. Figure out how to do this right at beginning of line, (without
64 creating class Bar_script : public Item).
66 text_p_
->set_parent (s
, X_AXIS
);
71 Mark_engraver::stop_translation_timestep ()
75 text_p_
->set_grob_property ("side-support-elements" , get_property ("stavesFound"));
76 typeset_grob (text_p_
);
83 Mark_engraver::create_items (Request
*rq
)
88 SCM s
= get_property ("RehearsalMark");
89 text_p_
= new Item (s
);
92 Side_position_interface::set_axis (text_p_
, Y_AXIS
);
94 announce_grob(text_p_
, rq
->self_scm());
99 Mark_engraver::start_translation_timestep ()
106 Mark_engraver::try_music (Music
* r_l
)
108 if (Mark_req
*mr
= dynamic_cast <Mark_req
*> (r_l
))
110 if (mark_req_l_
&& mr
->equal_b (mark_req_l_
))
123 TODO: make the increment function in Scheme.
127 Mark_engraver::process_music ()
131 create_items (mark_req_l_
);
139 SCM m
= mark_req_l_
->get_mus_property ("label");
140 if (gh_pair_p (m
)) // markup text
141 text_p_
->set_grob_property ("text",m
);
144 if (!gh_string_p (m
))
145 m
= get_property ("rehearsalMark");
150 int mark_count
= gh_scm2int (m
);
151 t
= to_str (mark_count
);
153 m
= gh_int2scm (mark_count
);
155 else if (gh_string_p (m
))
157 t
= ly_scm2string (m
);
165 m
= ly_str02scm (next
.ch_C ());
172 daddy_trans_l_
->set_property ("rehearsalMark", m
);
174 text_p_
->set_grob_property ("text",
175 ly_str02scm (t
.ch_C ()));
177 String style
= "mark";
178 for (int i
=0; i
< t
.length_i (); i
++)
186 SCM st
= ly_symbol2scm (style
.ch_C ());
187 text_p_
->set_grob_property ("font-style", st
);
193 ENTER_DESCRIPTION(Mark_engraver
,
195 /* creats*/ "RehearsalMark",
196 /* acks */ "bar-line-interface",
197 /* reads */ "rehearsalMark stavesFound",