]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 0.0.72pre
[lilypond.git] / lily / clef-item.cc
1 /*
2   clef-item.cc -- implement Clef_item
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
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"
15
16
17 void
18 Clef_item::do_pre_processing()
19 {
20     change_b_ = ! (break_status_i() == 1);
21
22     if (default_b_){
23         empty_b_ = (break_status_i() != 1);
24         transparent_b_ = (break_status_i() != 1);
25     }
26 }
27
28 Clef_item::Clef_item()
29 {
30     default_b_ = false;
31     change_b_ = true;
32     read("violin");
33 }
34
35 void
36 Clef_item::read(String t)
37 {
38     type_= t;
39     if (type_ == "violin")
40         y_off = 2;
41     if (type_ == "alto")
42         y_off = 4;
43     if (type_ == "tenor")
44         y_off = 6;
45     if (type_ == "bass")
46         y_off = 6;
47 }
48 void
49 Clef_item::read(Clef_engraver const &k)
50 {
51     read(k.clef_type_str_);
52 }
53
54 Molecule*
55 Clef_item::brew_molecule_p()const
56 {
57     String t = type_;
58     if  (change_b_)
59         t += "_change";
60     Symbol s = paper()->lookup_l()->clef(t);
61     Molecule*output = new Molecule(Atom(s));
62     output->translate_y( paper()->internote_f() * y_off);
63     return output;
64 }
65
66 IMPLEMENT_STATIC_NAME(Clef_item);
67 IMPLEMENT_IS_TYPE_B1(Clef_item,Item);