]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 0.1.22
[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     {
24       set_empty(break_status_i() != 1);
25       transparent_b_ = (break_status_i() != 1);
26     }
27 }
28
29 Clef_item::Clef_item()
30 {
31   breakable_b_ =true;
32   default_b_ = false;
33   change_b_ = true;
34   read ("violin");
35 }
36
37 void
38 Clef_item::read (String t)
39 {
40   type_= t;
41   if (type_ == "violin")
42     y_position_i_ = -2;
43   if (type_ == "alto")
44     y_position_i_ = 0;
45   if (type_ == "tenor")
46     y_position_i_ = 2;
47   if (type_ == "bass")
48     y_position_i_ = 2;
49 }
50 void
51 Clef_item::read (Clef_engraver const &k)
52 {
53   read (k.clef_type_str_);
54 }
55
56 Molecule*
57 Clef_item::brew_molecule_p() const
58 {
59   String t = type_;
60   if  (change_b_)
61     t += "_change";
62   Atom s = paper()->lookup_l ()->clef (t);
63   Molecule*output = new Molecule (Atom (s));
64   output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
65   return output;
66 }
67
68
69 IMPLEMENT_IS_TYPE_B1(Clef_item,Item);