summaryrefslogtreecommitdiff
path: root/lily/crescendo.cc
blob: 4583bdae2f9dd396dfadcbb7f7cf84b640617b0f (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
/*
  crescendo.cc -- implement Crescendo

  source file of the LilyPond music typesetter

  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#include "dimen.hh"
#include "crescendo.hh"
#include "lookup.hh"
#include "paper-def.hh"
#include "debug.hh"

Crescendo::Crescendo()
    : Staff_side(this)
{
    grow_dir_i_ =0;
    dir_i_ = -1 ;
    left_dyn_b_ = right_dyn_b_ =false;
}

Spanner*
Crescendo::do_break_at(PCol*, PCol*)const
{
    return new Crescendo(*this);
}


Molecule*
Crescendo::brew_molecule_p() const return m_p ;
{
    Real x_off_dim=0.0;
    Real absdyn_dim = 10 PT;	// UGR
    
    m_p = new Molecule;
    Real w_dim = width().length();
    if ( left_dyn_b_ ) {
	w_dim -= absdyn_dim;
	x_off_dim += absdyn_dim;
    }
    if ( right_dyn_b_ ) {
	w_dim -= absdyn_dim;
    }
    
    if (w_dim < 0) {
	error("Crescendo too small");
	w_dim = 0;
    }
    Symbol s( paper()->lookup_l()->hairpin(w_dim, grow_dir_i_ < 0) );
    m_p->add(Atom(s));
    int pos = get_position_i();
    m_p->translate(Offset(x_off_dim,pos * paper()->internote()));
}

IMPLEMENT_STATIC_NAME(Crescendo);