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"
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()
23 do_post_move_processing();
27 Bar_engraver::do_try_music (Music*r_l)
29 if (Bar_req * b= dynamic_cast <Bar_req *> (r_l))
31 if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh?
44 Bar_engraver::acknowledge_element (Score_element_info i)
46 if (Bar *b = dynamic_cast<Bar *> (i.elem_l_))
49 // auto_create_bar_b_ = false;
54 Bar_engraver::create_bar ()
59 bar_p_->break_priority_i_ = 0;
60 // urg: "" != empty...
61 String default_type = get_property ("defaultBarType", 0);
62 if (default_type.length_i ())
64 bar_p_->type_str_ = default_type;
66 announce_element (Score_element_info (bar_p_, bar_req_l_));
72 Bar_engraver::do_creation_processing ()
75 bar_p_->type_str_ = "";
76 Scalar prop = get_property ("barAuto", 0);
77 auto_create_bar_b_ = prop.to_bool ();
81 Bar_engraver::do_removal_processing ()
85 typeset_element (bar_p_);
91 Bar_engraver::do_process_requests()
93 Time_description const *time = get_staff_info().time_C_;
99 bar_p_->type_str_ = bar_req_l_->type_str_;
103 Scalar always = get_property ("barAlways", 0);
104 if ((time && !time->whole_in_measure_) || always.to_bool ())
106 if (auto_create_bar_b_)
108 Scalar prop = get_property ("barAuto", 0);
109 auto_create_bar_b_ = prop.to_bool ();
114 hmm, perhaps it's Better to create empty bars if you want none
115 displayed, and keep bars for breakpoints ?
118 if ((time && time->whole_in_measure_)
119 && !always.to_bool ()
120 && !bar_p_ && !bar_l_)
122 if (!bar_p_ && !bar_l_)
125 r.penalty_i_ = Break_req::DISALLOW;
126 daddy_grav_l ()->try_music (&r);
132 Bar_engraver::do_pre_move_processing()
145 typeset_element (bar_p_);
151 Bar_engraver::do_post_move_processing()
158 ADD_THIS_TRANSLATOR(Bar_engraver);