]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 0.0.45
[lilypond.git] / lily / clef-item.cc
1 /*
2   clef-item.cc -- implement Clef_item
3
4   source file of the 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-reg.hh"
15
16
17
18 Clef_item::Clef_item()
19 {
20     change = true;
21     read("violin");
22 }
23
24 void
25 Clef_item::read(String t)
26 {
27     type = t;
28     if (type == "violin")
29         y_off = 2;
30     if (type == "alto")
31         y_off = 4;
32     if (type == "tenor")
33         y_off = 6;
34     if (type == "bass")
35         y_off = 6;
36 }
37 void
38 Clef_item::read(Clef_register const &k)
39 {
40     read(k.clef_type_str_);
41 }
42
43 Molecule*
44 Clef_item::brew_molecule_p()const
45 {
46     String t = type;
47     if  (change)
48         t += "_change";
49     Symbol s = paper()->lookup_l()->clef(t);
50     Molecule*output = new Molecule(Atom(s));
51     output->translate(Offset(0, paper()->internote() * y_off));
52     return output;
53 }
54
55 IMPLEMENT_STATIC_NAME(Clef_item);