]> git.donarmstrong.com Git - lilypond.git/blob - lily/bow.cc
release: 0.0.59
[lilypond.git] / lily / bow.cc
1 /*
2   bow.cc -- implement Bow
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "bow.hh"
10 #include "paper-def.hh"
11 #include "lookup.hh"
12
13 Bow::Bow()
14 {
15     left_pos_i_ = right_pos_i_ = 0;
16     left_dx_f_ = right_dx_f_ = 0.0;
17 }
18
19
20 Offset
21 Bow::center() const
22 {
23     int dy =  right_pos_i_-left_pos_i_;
24
25     Real w = width().length();
26
27     return Offset(w/2,dy * paper()->internote());
28 }
29
30 Molecule*
31 Bow::brew_molecule_p() const
32 {
33     Molecule*output = new Molecule;
34     Real w = width().length();
35     
36     int dy = right_pos_i_ - left_pos_i_;
37     
38     Real nw_f = paper()->note_width();
39     Real nh_f = paper()->internote();
40
41     
42     w+= (right_dx_f_ - left_dx_f_) * nw_f ;
43     Real round_w = w;           // slur lookup rounds the slurwidth .
44     
45     Symbol sl = paper()->lookup_l()->slur(dy , round_w, dir_i_);
46
47     Real error = w-round_w;
48     
49     Atom a(sl);
50     a.translate(Offset((left_dx_f_ + 0.5 )*nw_f + error/2,
51                        left_pos_i_ * nh_f));
52     output->add(a);
53     return output;
54 }
55
56 IMPLEMENT_STATIC_NAME(Bow);