]> git.donarmstrong.com Git - lilypond.git/blob - lily/bow.cc
release: 0.0.65
[lilypond.git] / lily / bow.cc
1 /*
2   bow.cc -- implement Bow
3
4   source file of the GNU 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_f());
28 }
29
30
31 Molecule*
32 Bow::brew_molecule_p() const
33 {
34     Molecule*output = new Molecule;
35     Real w = width().length();
36     
37     int dy = right_pos_i_ - left_pos_i_;
38     
39     Real nw_f = paper()->note_width();
40     Real nh_f = paper()->internote_f();
41
42     
43     w+= (right_dx_f_ - left_dx_f_) * nw_f ;
44     Real round_w = w;           // slur lookup rounds the slurwidth .
45     
46     Symbol sl = paper()->lookup_l()->slur(dy , round_w, dir_i_);
47
48     Real error = w-round_w;
49     
50     Atom a(sl);
51     a.translate(Offset((left_dx_f_ + 0.5 )*nw_f + error/2,
52                        left_pos_i_ * nh_f));
53     output->add(a);
54     return output;
55 }
56
57 IMPLEMENT_STATIC_NAME(Bow);