]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest.cc
release: 1.3.6
[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 "paper-score.hh"
16
17 void
18 Rest::do_add_processing ()
19 {
20   if (balltype_i_ == 0)
21     set_position (position_f () + 2);
22
23   Rhythmic_head::do_add_processing ();
24 }
25
26 void
27 Rest::do_post_processing ()
28 {
29   Rhythmic_head::do_post_processing ();
30   if (dots_l_
31       && balltype_i_ > 4) // UGH.
32     {
33       /*
34         UGH. 
35        */
36       if (balltype_i_ == 7)
37         dots_l_->set_position (4);
38       else
39         dots_l_->set_position (3);
40     }
41 }
42
43
44 Molecule *
45 Rest::do_brew_molecule_p () const
46 {
47   bool ledger_b =false;
48
49   if (balltype_i_ == 0 || balltype_i_ == 1)
50     ledger_b = abs(position_f ()  - (2* balltype_i_ - 1)) > lines_i (); 
51
52   
53   String style; 
54   SCM style_sym =get_elt_property ("style");
55   if (balltype_i_ >= 2 && style_sym != SCM_UNDEFINED)
56     {
57       style = ly_scm2string (style_sym);
58     }
59
60   String idx =  ("rests-") + to_str (balltype_i_) + (ledger_b ? "o" : "") + style;
61
62   return new Molecule(lookup_l ()->afm_find (idx));
63 }
64
65
66