]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar-grav.cc
release: 0.0.73pre
[lilypond.git] / lily / bar-grav.cc
1 /*
2   bar-reg.cc -- implement Bar_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "bar-grav.hh"
10 #include "bar.hh"
11 #include "command-request.hh"
12 #include "time-description.hh"
13
14 Bar_engraver::Bar_engraver()
15 {
16     do_post_move_processing();
17 }
18
19 bool
20 Bar_engraver::do_try_request(Request*r_l)
21 {
22     Command_req* c_l = r_l->command();
23     if (!c_l|| !c_l->bar()) 
24         return false;
25     Bar_req  * b= c_l->bar();
26     if (bar_req_l_ && bar_req_l_->compare(*b))
27         return false;
28     
29     bar_req_l_ = b;
30
31     return true;
32 }
33
34 void
35 Bar_engraver::do_process_requests()
36 {
37     if (bar_req_l_ ) {
38         bar_p_ = new Bar;
39         bar_p_->type_str_=bar_req_l_->type_str_;
40     } else if (!get_staff_info().time_C_->whole_in_measure_) {
41         bar_p_ = new Bar;
42     }
43     
44     if (bar_p_){
45         announce_element(Score_elem_info(bar_p_, bar_req_l_) );
46     }
47 }
48
49
50 void 
51 Bar_engraver::do_pre_move_processing()
52 {
53       if (bar_p_) {
54           typeset_breakable_item(bar_p_);
55           bar_p_ =0;
56       }
57 }
58
59 void
60 Bar_engraver::do_post_move_processing()
61 {
62     bar_req_l_ = 0;
63     bar_p_ =0;
64 }
65
66 IMPLEMENT_STATIC_NAME(Bar_engraver);
67 IMPLEMENT_IS_TYPE_B1(Bar_engraver,Engraver);
68 ADD_THIS_ENGRAVER(Bar_engraver);
69
70