2 clef.cc -- implement Clef_register
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>,
7 Mats Bengtsson <matsb@s3.kth.se>
11 #include "clefitem.hh"
13 #include "commandrequest.hh"
14 #include "timedescription.hh"
15 #include "complexwalker.hh"
16 #include "staffcolumn.hh"
18 Clef_register::Clef_register(Complex_walker
*w
)
26 Clef_register::set_type(String s
)
29 if (clef_type_str_
== "violin") {
31 } else if (clef_type_str_
== "alto") {
33 } else if (clef_type_str_
== "tenor") {
35 } else if (clef_type_str_
== "bass") {
39 walk_l_
->set_c0_position(c0_position_i_
);
44 Clef_register::read_req(Clef_change_req
*c_l
)
46 if (!set_type(c_l
->clef_str_
))
47 error("unknown clef type ", c_l
->defined_ch_c_l_
);
51 Clef_register::try_request(Request
* r_l
)
54 Command_req
* creq_l
= r_l
->command();
55 if (!creq_l
|| !creq_l
->clefchange())
58 accepted_req_arr_
.push(creq_l
);
59 // do it now! Others have to read c0_pos.
60 read_req(creq_l
->clefchange());
65 Clef_register::process_request()
67 const Time_description
*time_l
= &walk_l_
->time_
;
68 if (!accepted_req_arr_
.size() &&
69 (!time_l
->whole_in_measure_
|| !time_l
->when_
)) {
71 clef_p_
= new Clef_item
;
72 clef_p_
->change
= false;
73 } else if (accepted_req_arr_
.size()) {
74 clef_p_
= new Clef_item
;
75 clef_p_
->change
= true;
79 // announce_element(Staff_elem_info(clef_p_,
80 // accepted_req_arr_[0], this));
85 Clef_register::do_pre_move_process()
89 if (clef_p_
->change
) {
90 typeset_breakable_item(new Clef_item(*clef_p_
),
91 clef_p_
, new Clef_item(*clef_p_
) );
93 typeset_breakable_item(0, 0, clef_p_
);