lilypond-1.4.4
[lilypond.git] / lily / bar-reg.cc
blob46f7bf3b82f3b0903690fbf332c75f4f2157703b
1 /*
2 bar-reg.cc -- implement Bar_register
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "bar-reg.hh"
10 #include "bar.hh"
11 #include "command-request.hh"
12 #include "time-description.hh"
14 Bar_register::Bar_register()
16 do_post_move_processing();
19 bool
20 Bar_register::do_try_request(Request*r_l)
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;
29 bar_req_l_ = b;
31 return true;
34 void
35 Bar_register::do_process_requests()
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;
44 if (bar_p_){
45 announce_element(Score_elem_info(bar_p_, bar_req_l_) );
50 void
51 Bar_register::do_pre_move_processing()
53 if (bar_p_) {
54 typeset_breakable_item(bar_p_);
55 bar_p_ =0;
59 void
60 Bar_register::do_post_move_processing()
62 bar_req_l_ = 0;
63 bar_p_ =0;
66 IMPLEMENT_STATIC_NAME(Bar_register);
67 IMPLEMENT_IS_TYPE_B1(Bar_register,Request_register);
68 ADD_THIS_REGISTER(Bar_register);