lilypond-0.1.57
[lilypond.git] / lily / clef-item.cc
blobb3b468047f9761507ab4b28ab4a00cbff159881c
1 /*
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>
7 */
9 #include "clef-item.hh"
10 #include "string.hh"
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "clef-grav.hh"
17 void
18 Clef_item::do_pre_processing()
20 change_b_ = ! (break_status_i() == 1);
22 if (default_b_)
24 set_empty(break_status_i() != 1);
25 transparent_b_ = (break_status_i() != 1);
29 Clef_item::Clef_item()
31 breakable_b_ =true;
32 default_b_ = false;
33 change_b_ = true;
34 read ("violin");
37 void
38 Clef_item::read (String t)
40 symbol_= t;
41 if (t == "violin")
43 y_position_i_ = -2;
45 else if (t == "french")
47 symbol_="violin";
48 y_position_i_ = -4;
50 else if (t == "soprano")
52 symbol_="alto";
53 y_position_i_ = -4;
55 else if (t == "mezzosoprano")
57 symbol_ = "alto";
58 y_position_i_ = -2;
60 else if (t == "alto")
62 y_position_i_ = 0;
64 else if (t == "tenor")
66 symbol_="alto";
67 y_position_i_ = 2;
69 else if (t == "baritone")
71 symbol_ = "alto";
72 y_position_i_ = 4;
74 else if (t == "varbaritone")
76 symbol_ = "bass";
77 y_position_i_ = 0;
79 else if (t == "bass")
81 y_position_i_ = 2;
83 else if (t == "subbass")
85 symbol_ = "bass";
86 y_position_i_ = 4;
90 void
91 Clef_item::read (Clef_engraver const &k)
93 read (k.clef_type_str_);
96 Molecule*
97 Clef_item::brew_molecule_p() const
99 String t = symbol_;
100 if (change_b_)
101 t += "_change";
102 Atom s = paper()->lookup_l ()->clef (t);
103 Molecule*output = new Molecule (Atom (s));
104 output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
105 return output;
109 IMPLEMENT_IS_TYPE_B1(Clef_item,Item);