lilypond-0.0.77.jcn1
[lilypond.git] / src / bar-reg.cc
blobb72eca87550c880d3681a92044dbd159f017fde6
1 /*
2 bar-reg.cc -- implement Bar_register
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "bar-reg.hh"
10 #include "bar.hh"
11 #include "commandrequest.hh"
12 #include "score-column.hh"
13 #include "time-description.hh"
15 Bar_register::Bar_register()
17 post_move_processing();
20 bool
21 Bar_register::try_request(Request*r_l)
23 Command_req* c_l = r_l->command();
24 if (!c_l|| !c_l->bar())
25 return false;
27 assert(!bar_req_l_);
28 bar_req_l_ = c_l->bar();
30 return true;
33 void
34 Bar_register::process_requests()
36 if (bar_req_l_ ) {
37 bar_p_ = new Bar(bar_req_l_->type_str_);
38 } else if (!get_staff_info().time_c_l_->whole_in_measure_) {
39 bar_p_ = new Bar("|");
42 if (bar_p_){
43 announce_element(Staff_elem_info(bar_p_, bar_req_l_) );
47 void
48 Bar_register::split_bar(Bar *& pre, Bar * no, Bar * &post)
50 String s= no->type;
51 if (s == ":|:") {
52 pre = new Bar(":|");
53 post = new Bar("|:");
54 }else if (s=="|:") {
55 post = new Bar(s);
56 } else {
57 pre = new Bar(*no);
61 void
62 Bar_register::pre_move_processing()
64 if (bar_p_) {
65 Bar * post_p =0;
66 Bar * pre_p =0;
67 split_bar(pre_p, bar_p_, post_p);
69 typeset_breakable_item(pre_p, bar_p_, post_p);
70 bar_p_ =0;
74 void
75 Bar_register::post_move_processing()
77 bar_req_l_ = 0;
78 bar_p_ =0;