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