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