]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar-number-grav.cc
release: 0.1.7
[lilypond.git] / lily / bar-number-grav.cc
1 /*
2   bar-number-grav.cc -- implement Bar_number_grav
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #include "bar-number-grav.hh"
11 #include "script.hh"
12 #include "text-def.hh"
13 #include "command-request.hh"
14 #include "bar.hh"
15
16 Bar_number_grav::Bar_number_grav()
17 {
18     number_i_ =1;
19     script_p_ =0;
20 }
21
22 static Command_script_req dummy;
23
24 void
25 Bar_number_grav::acknowledge_element(Score_elem_info i)
26 {
27     if (i.origin_grav_l_arr_.size() == 1 &&
28         i.elem_l_->is_type_b( Bar::static_name()) && !script_p_) {
29
30         script_p_ = new Script;
31         Text_def *td_p =new Text_def;
32         td_p->text_str_ = number_i_++;
33         script_p_->specs_l_ = td_p;
34         script_p_->breakable_b_ = true;
35         script_p_->dir_i_ = 1;
36
37         announce_element(Score_elem_info( script_p_, &dummy));
38     }
39 }
40
41 void
42 Bar_number_grav::do_pre_move_processing()
43 {
44     if ( script_p_ ) {
45         typeset_element(script_p_);
46         script_p_ =0;
47     }
48 }
49
50 IMPLEMENT_IS_TYPE_B1(Bar_number_grav,Engraver);
51 ADD_THIS_ENGRAVER(Bar_number_grav);