]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-spanner.cc
release: 0.0.39-1
[lilypond.git] / lily / text-spanner.cc
1 #include "molecule.hh"
2 #include "boxes.hh"
3 #include "text-spanner.hh"
4 #include "text-def.hh"
5 #include "debug.hh"
6 #include "paper-def.hh"
7
8
9
10 void
11 Text_spanner::set_support(Directional_spanner*d)
12 {
13     support = d;
14     add_dependency(d);
15 }
16
17 Text_spanner::Text_spanner()
18 {
19     support = 0;
20 }
21
22 void
23 Text_spanner::do_print() const
24 {
25     spec.print();
26 }
27
28 void
29 Text_spanner::do_post_processing()
30 {
31     switch(spec.align_i_) {
32     case 0:
33         text_off_ = support->center() +
34             Offset(0,support->dir_i_ * paper()->internote() * 4); // todo
35         break;
36     default:
37         assert(false);
38         break;
39     }    
40 }
41
42 Molecule*
43 Text_spanner::brew_molecule_p() const
44 {
45     Atom tsym (spec.create_atom(paper()));
46     tsym.translate(text_off_);
47
48     Molecule*output = new Molecule;
49     output->add( tsym );
50     return output;
51 }
52
53 void
54 Text_spanner::do_pre_processing()
55 {
56     right = support->right;
57     left = support->left;
58     assert(left && right);
59 }
60
61 Interval
62 Text_spanner::height()const
63 {
64     return brew_molecule_p()->extent().y;
65 }
66
67 Spanner*
68 Text_spanner::do_break_at(PCol*c1, PCol*c2)const
69 {
70     return new Text_spanner(*this); // todo
71 }