]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest.cc
release: 0.0.45
[lilypond.git] / lily / rest.cc
1 /*
2   rest.cc -- implement Rest
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "duration.hh"
9 #include "rest.hh"
10 #include "dimen.hh" 
11 #include "debug.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "molecule.hh"
15 #include "rest.hh"
16
17 Rest::Rest(Duration d)
18 {
19     balltype = d.type_i_;
20     dots = d.dots_i_;
21     pos_i_ = 0;
22 }
23
24
25 IMPLEMENT_STATIC_NAME(Rest);
26
27 void
28 Rest::do_print()const
29 {
30 #ifndef NPRINT
31     mtor << "Rest "<<balltype<< "dots " << dots;
32     Item::print();
33 #endif
34 }
35
36 Molecule*
37 Rest::brew_molecule_p()const
38 {
39     Paper_def *p =paper();
40
41     Symbol s;
42     s = p->lookup_l()->rest(balltype);
43     
44     Molecule *m = new Molecule(Atom(s));
45     if (dots) {
46         Symbol d =p->lookup_l()->dots(dots);
47         Molecule dm;
48         dm.add(Atom(d));
49         m->add_right(dm);
50     }
51     m->translate(Offset(0,pos_i_ * paper()->internote()));
52     return m;
53 }
54