]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 0.1.48
[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   symbol_= t;
41   if (t == "violin") 
42     {
43       y_position_i_ = -2;
44     }
45   else if (t == "french") 
46     {
47       symbol_="violin";
48       y_position_i_ = -4;
49     }
50   else if (t == "soprano") 
51     {
52       symbol_="alto";
53       y_position_i_ = -4;
54     }
55   else if (t == "mezzosoprano")
56     {
57       symbol_ = "alto";
58       y_position_i_ = -2;
59     }
60   else if (t == "alto") 
61     {
62       y_position_i_ = 0;
63     }
64   else if (t == "tenor") 
65     {
66       symbol_="alto";
67       y_position_i_ = 2;
68     }
69   else if (t == "baritone")
70     {
71       symbol_ = "alto";
72       y_position_i_ = 4;
73     }
74   else if (t == "varbaritone")
75     {
76       symbol_ = "bass";
77       y_position_i_ = 0;
78     }
79   else if (t == "bass") 
80     {
81       y_position_i_ = 2;
82     }
83   else if (t == "subbass")
84     {
85       symbol_ = "bass";
86       y_position_i_ = 4;
87     }
88 }
89
90 void
91 Clef_item::read (Clef_engraver const &k)
92 {
93   read (k.clef_type_str_);
94 }
95
96 Molecule*
97 Clef_item::brew_molecule_p() const
98 {
99   String t = symbol_;
100   if  (change_b_)
101     t += "_change";
102   Atom s = paper()->lookup_l ()->clef (t);
103   Molecule*output = new Molecule (Atom (s));
104   output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
105   return output;
106 }
107
108
109 IMPLEMENT_IS_TYPE_B1(Clef_item,Item);