]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest.cc
release: 1.1.39
[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_ == 0)
21     position_i_ += 2;
22
23   Rhythmic_head::do_add_processing ();
24   if (dots_l_ && balltype_i_ > 4)
25     {
26       dots_l_->position_i_ = position_i_ + 3;
27       if (balltype_i_ == 7)
28         dots_l_->position_i_++;
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 ledger_b =false;
41
42   if (balltype_i_ == 0 || balltype_i_ == 1)
43     ledger_b = abs(position_i_  - (2* balltype_i_ - 1)) > lines_i (); 
44       
45
46   
47   String style; 
48   SCM style_sym =get_elt_property (style_scm_sym);
49   if (style_sym != SCM_BOOL_F)
50     {
51       style = ly_scm2string (SCM_CDR(style_sym));
52     }
53   
54   Molecule s(lookup_l ()->rest (balltype_i_, ledger_b, style));
55   Molecule * m = new Molecule ( Molecule (s));
56   m->translate_axis (position_i_ *  staff_line_leading_f ()/2.0, Y_AXIS);
57   return m;
58 }
59
60