lilypond-1.4.1
[lilypond.git] / lily / bar-number-grav.cc
blobbe49f69b3f9632936f9d439e5b31a4221431bc8d
1 /*
2 bar-number-grav.cc -- implement Bar_number_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
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 #include "stem.hh"
16 #include "time-description.hh"
18 Bar_number_engraver::Bar_number_engraver()
20 script_p_ =0;
23 static Command_script_req dummy;
24 static Stem support;
26 void
27 Bar_number_engraver::acknowledge_element (Score_elem_info i)
29 if (i.origin_grav_l_arr_.size() == 1 &&
30 i.elem_l_->is_type_b (Bar::static_name()) && !script_p_)
32 Time_description const * time = get_staff_info().time_C_;
33 if (!time || time->cadenza_b_)
34 return ;
36 script_p_ = new Script;
37 Text_def *td_p =new Text_def;
38 td_p->text_str_ = time->bars_i_;
39 td_p->align_i_ = LEFT;
41 script_p_->specs_l_ = td_p;
42 script_p_->breakable_b_ = true;
44 // ugh, howto move this up?
45 script_p_->dir_ = UP;
46 //// script_p_->y_ += 2;
47 script_p_->y_ = 10;
49 support.dir_ = UP;
50 support.set_stemend (10);
51 script_p_->set_stem (&support);
53 announce_element (Score_elem_info (script_p_, &dummy));
57 void
58 Bar_number_engraver::do_pre_move_processing()
60 if (script_p_)
62 typeset_element (script_p_);
63 script_p_ =0;
67 IMPLEMENT_IS_TYPE_B1(Bar_number_engraver,Engraver);
68 ADD_THIS_TRANSLATOR(Bar_number_engraver);