]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-spanner.cc
release: 0.0.57
[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 IMPLEMENT_STATIC_NAME(Text_spanner);
23
24 void
25 Text_spanner::do_print() const
26 {
27     spec.print();
28 }
29
30 void
31 Text_spanner::do_post_processing()
32 {
33     switch(spec.align_i_) {
34     case 0:
35         text_off_ = support->center() +
36             Offset(0,support->dir_i_ * paper()->internote() * 4); // todo
37         break;
38     default:
39         assert(false);
40         break;
41     }    
42 }
43
44 Molecule*
45 Text_spanner::brew_molecule_p() const
46 {
47     Atom tsym (spec.create_atom());
48     tsym.translate(text_off_);
49
50     Molecule*output = new Molecule;
51     output->add( tsym );
52     return output;
53 }
54
55 void
56 Text_spanner::do_pre_processing()
57 {
58     right_col_l_ = support->right_col_l_;
59     left_col_l_ = support->left_col_l_;
60     assert(left_col_l_ && right_col_l_);
61     spec.pdef_l_ = paper();
62 }
63
64 Interval
65 Text_spanner::height()const
66 {
67     return brew_molecule_p()->extent().y;
68 }
69
70 Spanner*
71 Text_spanner::do_break_at(PCol*c1, PCol*c2)const
72 {
73     return new Text_spanner(*this); // todo
74 }