]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 0.1.47
[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     y_position_i_ = -2;
43   }
44   else if (t == "soprano") {
45     symbol_="alto";
46     y_position_i_ = -4;
47   }
48   else if (t == "alto") {
49     y_position_i_ = 0;
50   }
51   else if (t == "tenor") {
52     symbol_="alto";
53     y_position_i_ = 2;
54   }
55   else if (t == "bass") {
56     y_position_i_ = 2;
57   }
58 }
59
60 void
61 Clef_item::read (Clef_engraver const &k)
62 {
63   read (k.clef_type_str_);
64 }
65
66 Molecule*
67 Clef_item::brew_molecule_p() const
68 {
69   String t = symbol_;
70   if  (change_b_)
71     t += "_change";
72   Atom s = paper()->lookup_l ()->clef (t);
73   Molecule*output = new Molecule (Atom (s));
74   output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS);
75   return output;
76 }
77
78
79 IMPLEMENT_IS_TYPE_B1(Clef_item,Item);