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"
18 Bar_engraver::Bar_engraver()
21 do_post_move_processing();
25 Bar_engraver::do_try_music (Music
*r_l
)
27 if (Bar_req
* b
= dynamic_cast <Bar_req
*> (r_l
))
29 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 announce_element (Score_element_info (bar_p_
, bar_req_l_
));
70 Bar_engraver::request_bar (String type_str
)
72 Scalar prop
= get_property ("barAtLineStart", 0);
75 Scalar prop
= get_property ("barAtLineStart", 0);
80 if (((type_str
== "|:") && (bar_p_
->type_str_
== ":|"))
81 || ((type_str
== ":|") && (bar_p_
->type_str_
== "|:")))
82 bar_p_
->type_str_
= ":|:";
84 bar_p_
->type_str_
= type_str
;
88 Bar_engraver::do_creation_processing ()
91 bar_p_
->type_str_
= "";
95 Bar_engraver::do_removal_processing ()
99 typeset_element (bar_p_
);
105 Bar_engraver::do_process_requests()
107 Time_description
const *time
= get_staff_info().time_C_
;
111 bar_p_
->type_str_
= bar_req_l_
->type_str_
;
113 else if (!now_mom ())
116 bar_p_
->type_str_
= "|";
120 Scalar nonauto
= get_property ("barNonAuto", 0);
121 if (!nonauto
.to_bool ())
123 Scalar always
= get_property ("barAlways", 0);
124 if ((time
&& !time
->whole_in_measure_
) || always
.to_bool ())
132 r
.penalty_i_
= Break_req::DISALLOW
;
133 daddy_grav_l ()->try_music (&r
);
139 Bar_engraver::do_pre_move_processing()
143 typeset_element (bar_p_
);
149 Bar_engraver::do_post_move_processing()
156 ADD_THIS_TRANSLATOR(Bar_engraver
);