lilypond-0.1.26
[lilypond.git] / lily / clef-item.cc
blobd6c02e542cfda9d0c369eb821dd8017fc9a9eb5b
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 type_= t;
41 if (type_ == "violin")
42 y_position_i_ = -2;
43 if (type_ == "alto")
44 y_position_i_ = 0;
45 if (type_ == "tenor")
46 y_position_i_ = 2;
47 if (type_ == "bass")
48 y_position_i_ = 2;
50 void
51 Clef_item::read (Clef_engraver const &k)
53 read (k.clef_type_str_);
56 Molecule*
57 Clef_item::brew_molecule_p() const
59 String t = type_;
60 if (change_b_)
61 t += "_change";
62 Atom s = paper()->lookup_l ()->clef (t);
63 Molecule*output = new Molecule (Atom (s));
64 output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
65 return output;
69 IMPLEMENT_IS_TYPE_B1(Clef_item,Item);