lilypond-0.1.35
[lilypond.git] / lily / rest.cc
blob4cf872f613f0b470edc86ef929f6b5520b77df8f
1 /*
2 rest.cc -- implement Rest
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
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"
17 void
18 Rest::do_add_processing ()
20 if (balltype_i_ != 0 && balltype_i_ != 1)
21 position_i_ -= 4;
22 else if (balltype_i_ == 0)
23 position_i_ += 2;
25 Rhythmic_head::do_add_processing ();
26 if (dots_l_)
27 dots_l_->position_i_ = position_i_;
30 Rest::Rest ()
32 position_i_ =0;
35 Molecule *
36 Rest::brew_molecule_p () const
38 int staff_size_i_ = 8;
39 bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&
40 (balltype_i_ == 0 || balltype_i_ == 1);
42 Atom s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b));
43 Molecule * m = new Molecule ( Atom (s));
44 m->translate_axis (position_i_ * paper ()->internote_f (), Y_AXIS);
45 return m;
48 IMPLEMENT_IS_TYPE_B1(Rest, Rhythmic_head);