2 clef.cc -- implement Clef_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>,
7 Mats Bengtsson <matsb@s3.kth.se>
11 #include "clef-grav.hh"
12 #include "clef-item.hh"
14 #include "command-request.hh"
15 #include "time-description.hh"
17 Clef_engraver::Clef_engraver()
26 Ugh. Should have support for Dictionaries in mudela.
29 Clef_engraver::set_type (String s
)
32 if (clef_type_str_
== "violin")
34 else if (clef_type_str_
== "french")
36 else if (clef_type_str_
== "soprano")
38 else if (clef_type_str_
== "mezzosoprano")
40 else if (clef_type_str_
== "alto")
42 else if (clef_type_str_
== "tenor")
44 else if (clef_type_str_
== "baritone")
46 else if (clef_type_str_
== "varbaritone")
48 else if (clef_type_str_
== "bass")
50 else if (clef_type_str_
== "subbass")
59 Clef_engraver::fill_staff_info (Staff_info
&i
)
61 i
.c0_position_i_l_
= &c0_position_i_
;
65 Clef_engraver::read_req (Clef_change_req
*c_l
)
67 if (!set_type (c_l
->clef_str_
))
68 c_l
->error (_("unknown clef type "));
73 Generate a clef at the start of a measure. (when you see a Bar,
77 Clef_engraver::acknowledge_element (Score_elem_info info
)
79 if (info
.elem_l_
->is_type_b (Bar::static_name ())
80 && clef_type_str_
.length_i())
84 clef_p_
->default_b_
= true;
89 Clef_engraver::do_creation_processing()
91 Scalar def
= get_property ("defaultclef");
92 if (def
.operator bool ()) // egcs: Scalar to bool is ambiguous
94 if (clef_type_str_
.length_i ())
96 clef_p_
->default_b_
= false;
100 Clef_engraver::do_try_request (Request
* r_l
)
102 Command_req
* creq_l
= r_l
->command();
103 if (!creq_l
|| !creq_l
->clefchange())
106 clef_req_l_
= creq_l
->clefchange();
107 read_req (clef_req_l_
);
112 Clef_engraver::create_clef()
116 clef_p_
= new Clef_item
;
117 clef_p_
->break_priority_i_
= -2; // ugh
118 announce_element (Score_elem_info (clef_p_
,clef_req_l_
));
120 clef_p_
->read (*this);
124 Clef_engraver::do_process_requests()
129 clef_p_
->default_b_
= false;
134 Clef_engraver::do_pre_move_processing()
138 typeset_element (clef_p_
);
143 Clef_engraver::do_post_move_processing()
149 Clef_engraver::do_removal_processing()
156 IMPLEMENT_IS_TYPE_B1(Clef_engraver
,Engraver
);
157 ADD_THIS_TRANSLATOR(Clef_engraver
);