]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest.cc
e46f3f8673f80cd13896edeaab7d7840df63920d
[lilypond.git] / lily / rest.cc
1 /*
2   rest.cc -- implement Rest
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "molecule.hh"
10 #include "paper-def.hh"
11 #include "lookup.hh"
12 #include "rest.hh"
13 #include "dots.hh"
14 #include "axis-group-element.hh"
15 #include "p-score.hh"
16
17 void
18 Rest::do_add_processing ()
19 {
20   if (balltype_i_ != 0 && balltype_i_ != 1)
21     position_i_ -= 4;
22   else if (balltype_i_ == 0)
23     position_i_ += 2;
24
25   Rhythmic_head::do_add_processing ();
26   if (dots_l_ && balltype_i_ > 1)
27     {
28       dots_l_->position_i_ = position_i_ + 4;
29     }
30 }
31
32 Rest::Rest ()
33 {
34   position_i_ =0;
35 }
36
37 Molecule *
38 Rest::brew_molecule_p () const
39 {
40   int staff_size_i_ = 8;
41   bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&  
42     (balltype_i_ == 0 || balltype_i_ == 1);
43   
44   Atom s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b));
45   Molecule * m = new Molecule ( Atom (s));
46   m->translate_axis (position_i_ *  paper ()->internote_f (), Y_AXIS);
47   return m;
48 }
49
50 IMPLEMENT_IS_TYPE_B1(Rest, Rhythmic_head);