]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar-number-engraver.cc
release: 1.3.41
[lilypond.git] / lily / bar-number-engraver.cc
1 /*
2   bar-number-grav.cc -- implement Bar_number_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "bar-number-engraver.hh"
10 #include "engraver-group-engraver.hh"
11 #include "text-item.hh"
12 #include "moment.hh"
13
14 Bar_number_engraver::Bar_number_engraver()
15 {
16   axis_ = Y_AXIS;
17   type_ = "barNumber";
18 }
19
20
21
22 void
23 Bar_number_engraver::do_process_music ()
24 {
25   // todo include (&&!time->cadenza_b_ )
26   SCM bn = get_property("currentBarNumber");
27   SCM smp = get_property ("measurePosition");
28   Moment mp =  (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
29   
30   if (gh_number_p (bn) &&
31       !mp && now_mom () > Moment (0))
32     {
33       create_items (0);
34
35       // guh.
36       text_p_->set_elt_property ("text",
37                                  ly_str02scm (to_str (gh_scm2int (bn)).ch_C()));
38                                  
39     }
40 }
41
42 ADD_THIS_TRANSLATOR(Bar_number_engraver);