]> git.donarmstrong.com Git - lilypond.git/blob - src/clefitem.cc
release: 0.0.25
[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 Clef_item::Clef_item()
9 {
10     change = true;
11     read("violin");
12 }
13 void
14 Clef_item::read(String t)
15 {
16     type = t;
17     if (type == "violin")
18         y_off = 2;
19     if (type == "alto")
20         y_off = 4;
21     if (type == "tenor")
22         y_off = 6;
23     if (type == "bass")
24         y_off = 6;
25 }
26 void
27 Clef_item::read(Clef k)
28 {
29     read(k.clef_type);
30 }
31
32 Molecule*
33 Clef_item::brew_molecule_p()const
34 {
35     String t = type;
36     if  (change)
37         t += "_change";
38     Symbol s = paper()->lookup_p_->clef(t);
39     Molecule*output = new Molecule(Atom(s));
40     output->translate(Offset(0, paper()->interline()/2 * y_off));
41     return output;
42 }
43