]> git.donarmstrong.com Git - lilypond.git/blob - src/clefitem.cc
release: 0.0.30
[lilypond.git] / src / clefitem.cc
1 #include "clefitem.hh"
2 #include "string.hh"
3 #include "molecule.hh"
4 #include "paper.hh"
5 #include "lookup.hh"
6 #include "clef.hh"
7
8 NAME_METHOD(Clef_item);
9
10 Clef_item::Clef_item()
11 {
12     change = true;
13     read("violin");
14 }
15
16 void
17 Clef_item::read(String t)
18 {
19     type = t;
20     if (type == "violin")
21         y_off = 2;
22     if (type == "alto")
23         y_off = 4;
24     if (type == "tenor")
25         y_off = 6;
26     if (type == "bass")
27         y_off = 6;
28 }
29 void
30 Clef_item::read(Clef k)
31 {
32     read(k.clef_type_str_);
33 }
34
35 Molecule*
36 Clef_item::brew_molecule_p()const
37 {
38     String t = type;
39     if  (change)
40         t += "_change";
41     Symbol s = paper()->lookup_p_->clef(t);
42     Molecule*output = new Molecule(Atom(s));
43     output->translate(Offset(0, paper()->internote() * y_off));
44     return output;
45 }
46