]> git.donarmstrong.com Git - lilypond.git/blob - lily/crescendo.cc
release: 0.0.50
[lilypond.git] / lily / crescendo.cc
1 /*
2   crescendo.cc -- implement Crescendo
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "dimen.hh"
9 #include "crescendo.hh"
10 #include "lookup.hh"
11 #include "paper-def.hh"
12 #include "debug.hh"
13
14 Crescendo::Crescendo()
15     : Staff_side(this)
16 {
17     grow_dir_i_ =0;
18     dir_i_ = -1 ;
19     left_dyn_b_ = right_dyn_b_ =false;
20 }
21
22 Spanner*
23 Crescendo::do_break_at(PCol*, PCol*)const
24 {
25     return new Crescendo(*this);
26 }
27
28
29 Molecule*
30 Crescendo::brew_molecule_p() const return m_p ;
31 {
32     Real x_off_dim=0.0;
33     Real absdyn_dim = 10 PT;    // UGR
34     
35     m_p = new Molecule;
36     Real w_dim = width().length();
37     if ( left_dyn_b_ ) {
38         w_dim -= absdyn_dim;
39         x_off_dim += absdyn_dim;
40     }
41     if ( right_dyn_b_ ) {
42         w_dim -= absdyn_dim;
43     }
44     
45     if (w_dim < 0) {
46         error("Crescendo too small");
47         w_dim = 0;
48     }
49     Symbol s( paper()->lookup_l()->hairpin(w_dim, grow_dir_i_ < 0) );
50     m_p->add(Atom(s));
51     int pos = get_position_i();
52     m_p->translate(Offset(x_off_dim,pos * paper()->internote()));
53 }
54
55 IMPLEMENT_STATIC_NAME(Crescendo);