lilypond-0.0.39
[lilypond.git] / src / clefitem.cc
blob037aab69b80aab6504bf11301521b470a598d928
1 /*
2 clefitem.cc -- implement Clef_item
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "clefitem.hh"
10 #include "string.hh"
11 #include "molecule.hh"
12 #include "paperdef.hh"
13 #include "lookup.hh"
14 #include "clefreg.hh"
16 NAME_METHOD(Clef_item);
18 Clef_item::Clef_item()
20 change = true;
21 read("violin");
24 void
25 Clef_item::read(String t)
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;
37 void
38 Clef_item::read(Clef_register const &k)
40 read(k.clef_type_str_);
43 Molecule*
44 Clef_item::brew_molecule_p()const
46 String t = type;
47 if (change)
48 t += "_change";
49 Symbol s = paper()->lookup_p_->clef(t);
50 Molecule*output = new Molecule(Atom(s));
51 output->translate(Offset(0, paper()->internote() * y_off));
52 return output;