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