2 clef-item.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "clef-item.hh"
12 #include "molecule.hh"
13 #include "paper-def.hh"
15 #include "clef-grav.hh"
19 Clef_item::do_pre_processing()
21 change_b_
= ! (break_status_i() == 1);
25 set_empty(break_status_i() != 1);
26 transparent_b_
= (break_status_i() != 1);
30 Clef_item::Clef_item()
39 * Convert input clef string to
40 * a clef symbol and a line position.
41 * This would be better done in the lexer (more efficient)
42 * or as a table-lookup.
45 Clef_item::read (String t
)
56 else if (t
== "G" || t
== "G2" || t
== "treble")
61 else if (t
== "french" || t
== "G1")
66 else if (t
== "soprano" || t
== "C1")
71 else if (t
== "mezzosoprano" || t
== "C2")
86 else if (t
== "tenor" || t
== "C4")
91 else if (t
== "baritone" || t
== "C5")
96 else if (t
== "varbaritone" || t
== "F3")
101 else if (t
== "F" || t
== "F4")
106 else if (t
== "subbass")
111 else if (isdigit(t
[1]))
113 { // we've already dealt with plain F, G or C clef
114 // position 0 is line 3.
118 y_position_i_
= 2 * (t
[1] - '0') - 6;
123 y_position_i_
= 2 * (t
[1] - '0') - 6;
129 Clef_item::read (Clef_engraver
const &k
)
131 read (k
.clef_type_str_
);
135 Clef_item::brew_molecule_p() const
140 Atom s
= paper()->lookup_l ()->clef (t
);
141 Molecule
*output
= new Molecule (Atom (s
));
142 output
->translate_axis (paper()->internote_f () * y_position_i_
, Y_AXIS
);
147 IMPLEMENT_IS_TYPE_B1(Clef_item
,Item
);