]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-sym.cc
release: 0.1.28
[lilypond.git] / lily / staff-sym.cc
1 /*
2   staffsym.cc -- implement Staff_symbol
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "staff-sym.hh"
9 #include "lookup.hh"
10 #include "paper-def.hh"
11 #include "molecule.hh"
12 #include "debug.hh"
13
14
15
16 Staff_symbol::Staff_symbol (int l)
17 {
18   no_lines_i_ = l;
19 }
20
21
22 IMPLEMENT_IS_TYPE_B1(Staff_symbol,Spanner);
23
24 void
25 Staff_symbol::do_print() const
26 {
27 #ifndef NPRINT
28   Spanner::do_print();
29   DOUT << "lines: " << no_lines_i_;
30 #endif
31 }
32
33 Molecule*
34 Staff_symbol::brew_molecule_p() const
35 {
36   Paper_def * p = paper();
37   Atom rule  = p->lookup_l ()->rule_symbol (p->get_var ("rule_thickness"), 
38                                             width ().length ());
39   Real inter = p->interline_f ();
40   Real height = (no_lines_i_-1) * inter/2;
41   Molecule * m = new Molecule;
42   for (int i=0; i < no_lines_i_; i++)
43     {
44       Atom a (rule);
45       a.translate_axis (height - i * inter, Y_AXIS);
46       m->add (a);
47     }
48
49   return m;
50 }
51
52 Real
53 Staff_symbol::inter_note_f() const
54 {
55   return paper()->internote_f ();
56 }
57
58 int
59 Staff_symbol::steps_i() const
60 {
61   return no_lines_i_*2;
62 }