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>
9 #include "score-engraver.hh"
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-engraver.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?
43 Bar_engraver::create_bar ()
47 bar_p_ = new Staff_bar;
48 bar_p_->set_elt_property (break_priority_scm_sym, gh_int2scm (0));
50 // urg: "" != empty...
51 String default_type = get_property ("defaultBarType", 0);
52 if (default_type.length_i ())
54 bar_p_->type_str_ = default_type;
58 urg. Why did I implement this?
60 Scalar prop = get_property ("barAtLineStart", 0);
63 bar_p_->set_elt_property (at_line_start_scm_sym, SCM_BOOL_T);
65 prop = get_property ("barSize", 0);
68 bar_p_->set_elt_property (bar_size_scm_sym,
69 gh_double2scm (Real(prop)));
71 announce_element (Score_element_info (bar_p_, bar_req_l_));
76 Make a barline. If there are both |: and :| requested, merge them
81 Bar_engraver::request_bar (String type_str)
83 Scalar prop = get_property ("barAtLineStart", 0);
86 Scalar prop = get_property ("barAtLineStart", 0);
92 if (((type_str == "|:") && (bar_p_->type_str_ == ":|"))
93 || ((type_str == ":|") && (bar_p_->type_str_ == "|:")))
94 bar_p_->type_str_ = ":|:";
95 else if (type_str_.length_i ())
96 bar_p_->type_str_ = type_str;
100 Bar_engraver::do_creation_processing ()
103 bar_p_->type_str_ = "";
107 Bar_engraver::do_removal_processing ()
111 typeset_element (bar_p_);
117 Bar_engraver::do_process_requests()
119 Time_description const *time = get_staff_info().time_C_;
123 bar_p_->type_str_ = bar_req_l_->type_str_;
125 else if (!now_mom ())
128 bar_p_->type_str_ = "|";
132 Scalar nonauto = get_property ("barNonAuto", 0);
133 if (!nonauto.to_bool ())
135 Scalar always = get_property ("barAlways", 0);
136 if ((time && !time->whole_in_measure_) || always.to_bool ())
143 Score_engraver * e = 0;
144 Translator * t = daddy_grav_l ();
145 for (; !e && t; t = t->daddy_trans_l_)
147 e = dynamic_cast<Score_engraver*> (t);
151 programming_error ("No score engraver!");
159 Bar_engraver::do_pre_move_processing()
163 typeset_element (bar_p_);
169 Bar_engraver::do_post_move_processing()
176 ADD_THIS_TRANSLATOR(Bar_engraver);