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