blob: 574b91c9ffd88849ebaa3e74eaecb897892e56be (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
crescendo.cc -- implement Crescendo
source file of the GNU LilyPond music typesetter
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#include "molecule.hh"
#include "dimen.hh"
#include "crescendo.hh"
#include "lookup.hh"
#include "paper-def.hh"
#include "debug.hh"
Crescendo::Crescendo()
{
grow_dir_i_ =0;
dir_i_ = -1 ;
left_dyn_b_ = right_dyn_b_ =false;
inside_staff_b_ = false;
}
Interval
Crescendo::symbol_height()const
{
return get_symbol().dim[Y_AXIS];
}
static Real absdyn_dim = 10 PT; // ugh
Symbol
Crescendo::get_symbol()const
{
Real w_dim = width().length ();
if ( left_dyn_b_) {
w_dim -= absdyn_dim;
}
if ( right_dyn_b_) {
w_dim -= absdyn_dim;
}
if (w_dim < 0) {
warning ("Crescendo too small");
w_dim = 0;
}
return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0));
}
Molecule*
Crescendo::brew_molecule_p() const
{
Molecule* m_p =0;
Real x_off_dim=0.0;
if ( left_dyn_b_)
x_off_dim += absdyn_dim;
m_p = new Molecule;
Symbol s (get_symbol());
m_p->add (Atom (s));
m_p->translate (Offset (x_off_dim, pos_i_ * paper()->internote_f ()));
return m_p;
}
IMPLEMENT_IS_TYPE_B1(Crescendo,Spanner);
|