2 bar-engraver.cc -- implement Bar_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997, 1998, 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "bar-engraver.hh"
11 #include "staff-bar.hh"
12 #include "musical-request.hh"
13 #include "multi-measure-rest.hh"
14 #include "command-request.hh"
15 #include "time-description.hh"
16 #include "engraver-group.hh"
17 #include "repeated-music.hh"
19 Bar_engraver::Bar_engraver()
22 do_post_move_processing();
26 Bar_engraver::do_try_music (Music*r_l)
28 if (Bar_req * b= dynamic_cast <Bar_req *> (r_l))
30 if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh?
42 Bar_engraver::acknowledge_element (Score_element_info i)
44 if (Bar *b = dynamic_cast<Bar *> (i.elem_l_))
46 // only bar-engraver should create bars
52 Bar_engraver::create_bar ()
56 bar_p_ = new Staff_bar;
57 bar_p_->set_elt_property (break_priority_scm_sym, gh_int2scm (0));
59 // urg: "" != empty...
60 String default_type = get_property ("defaultBarType", 0);
61 if (default_type.length_i ())
63 bar_p_->type_str_ = default_type;
67 urg. Why did I implement this?
69 Scalar prop = get_property ("barAtLineStart", 0);
72 bar_p_->at_line_start_b_ = true;
74 announce_element (Score_element_info (bar_p_, bar_req_l_));
79 Bar_engraver::request_bar (String type_str)
81 Scalar prop = get_property ("barAtLineStart", 0);
84 Scalar prop = get_property ("barAtLineStart", 0);
89 if (((type_str == "|:") && (bar_p_->type_str_ == ":|"))
90 || ((type_str == ":|") && (bar_p_->type_str_ == "|:")))
91 bar_p_->type_str_ = ":|:";
93 bar_p_->type_str_ = type_str;
97 Bar_engraver::do_creation_processing ()
100 bar_p_->type_str_ = "";
104 Bar_engraver::do_removal_processing ()
108 typeset_element (bar_p_);
114 Bar_engraver::do_process_requests()
116 Time_description const *time = get_staff_info().time_C_;
120 bar_p_->type_str_ = bar_req_l_->type_str_;
122 else if (!now_mom ())
125 bar_p_->type_str_ = "|";
129 Scalar nonauto = get_property ("barNonAuto", 0);
130 if (!nonauto.to_bool ())
132 Scalar always = get_property ("barAlways", 0);
133 if ((time && !time->whole_in_measure_) || always.to_bool ())
141 r.penalty_i_ = Break_req::DISALLOW;
142 daddy_grav_l ()->try_music (&r);
148 Bar_engraver::do_pre_move_processing()
152 typeset_element (bar_p_);
158 Bar_engraver::do_post_move_processing()
165 ADD_THIS_TRANSLATOR(Bar_engraver);