]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest.cc
patch::: 1.1.37.mb1: Re: LilyPond 1.1.37
[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--1999 Han-Wen Nienhuys <hanwen@cs.uu.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_ > 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::do_brew_molecule_p () const
39 {
40   bool streepjes_b = abs(position_i_) > lines_i () / 2 &&  
41     (balltype_i_ == 0 || balltype_i_ == 1);
42   
43   String style; 
44   SCM style_sym =get_elt_property (style_scm_sym);
45   if (style_sym != SCM_BOOL_F)
46     {
47       style = ly_scm2string (SCM_CDR(style_sym));
48     }
49   
50   Molecule s(lookup_l ()->rest (balltype_i_, streepjes_b, style));
51   Molecule * m = new Molecule ( Molecule (s));
52   m->translate_axis (position_i_ *  staff_line_leading_f ()/2.0, Y_AXIS);
53   return m;
54 }
55
56